# Topological routing
Guide mode suggests routes through connected free space. Seed mode also tries to realize those suggestions as physical paths.
## Corridor planning and realization

The offset-gates fixture has two openings at different heights. The highlighted triangle edges form the corridor's portals. The dashed line shows the lane suggestion, and the solid S-bend shows the physical route that guide mode found.
1. **Find connected space for centerlines.** Inset the board by half the widest net's width and expand obstacles by that half-width plus clearance. Shared edges of a constrained Delaunay triangulation act as portals. A short lead tries to attach each terminal to the mesh along its heading. Using the widest net gives the planner a common representation. Narrower nets may still find a path in lattice search through a passage this mesh excludes.
2. **Choose a passage and a lane.** Rank portal sequences by distance, occupancy, and estimated overflow. Use lane samples and estimated turn room to select where to cross each portal without crowding another net's access. A different lane through the same portal can make space for a turn. Joint retries use that distinction to revise a shared passage assignment.
3. **Turn the sketch into a path.** Guide mode adds soft costs and move suggestions, so detailed search can leave an awkward corridor. Seed mode first tries to find a physical path inside a corridor and verifies it against obstacles and earlier seeds. It gives the first corridor at least half the per-net budget when there are alternatives. Later detailed iterations can move an incumbent or try another guide. Final verification checks the actual routed geometry.
## When a corridor does not lead to a route
- **No corridor reported.** Inspect `run.topology` from an explicit guide or seed run. Check snapped port access, mesh padding, and which passages remain connected.
- **A corridor exists but seed search stalls.** Check terminal headings and the turn room around each chosen portal.
- **Seeds reach their targets and the final routes overlap.** Inspect lane order and congestion before adding seed nodes. To locate each overlapping component, capture a [conflict trace](routing-diagnostics.md#traces).
To investigate how passages and lane order are chosen, start with the [corridor planner](../inire/router/_topology.py).
## Design background
- For the use of shared triangle edges in detailed routing, see [Curvilinear detailed routing](https://websrv.cecs.uci.edu/~papers/compendium94-03/papers/1998/aspdac98/pdffiles/06c_3.pdf).
- For constraints specific to photonic waveguides, see [LiDAR 2.0](https://scopex-asu.github.io/files/publications/PD_TCAD2025_LiDARv2.pdf).
## Reproduce a routing comparison
- To select a board that exercises the behavior you are studying, use the [benchmark case guide](benchmarks.md#choose-a-case).
- To compare off, guide, and seed on offset gates, run the [matched-budget example](benchmarks.md#compare-routing-modes).
- To check a change to probe limits or retry order, see the [prior experiments](benchmark-results.md#near-port-probe-and-retry-experiments).
- To reproduce an upstream workload, see the [Terminal-Bench and imported fixtures](benchmark-fixtures.md).
- To recover prior measurements and their commands, consult the [experiment archive](benchmark-results.md#experiment-archive).