# Routing examples After [installing Inire](../README.md#install), run the scripts from the repository root. They save PNGs in `examples/` by default. Arrows at ports show the direction the route leaves its source or enters its target. ```sh python examples/01_simple_route.py ``` ## Start with a connection | Script | What to look for | Preview | | --- | --- | --- | | [Simple route](01_simple_route.py) | A straight waveguide connects two eastbound ports 80 units apart. | [Straight connection](01_simple_route.png) | | [Port headings](05_orientation_stress.py) | Two routes connect ports just 20 units apart. The lower route departs east and arrives west. The middle route departs north and arrives south. Both need room to turn. | [Two heading reversals and a straight route](05_orientation_stress.png) | ## Route around fixed geometry ![A second waveguide makes a U-shaped detour around the left end of a fixed straight waveguide.](03_locked_paths.png) The first call routes a straight waveguide. The second uses its polygons as keepouts, so the new northbound connection passes to the left of the fixed route. Run [`03_locked_paths.py`](03_locked_paths.py) to reproduce the detour. To hold a route fixed in your own design, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route). ## Fit bends to available room ![An S-bend shifts one route 5 units upward. The other route shifts 80 units upward using two 90-degree bends.](04_sbends_and_radii.png) Run [`04_sbends_and_radii.py`](04_sbends_and_radii.py) to compare a 5-unit shift made with an S-bend and an 80-unit shift made with two 90-degree bends. Both routes leave and arrive heading east. The two 90-degree turns use radius 10 from the allowed radii of 10 and 30. | Script | What to look for | Preview | | --- | --- | --- | | [Bend proxies](06_bend_collision_models.py) | Compare three separate runs. The middle route has round physical bends and uses rectangles to check for collisions during search. The bottom route uses a right-angle polygon for both. | [Arc, box proxy, and custom bend](06_bend_collision_models.png) | | [Custom bends](08_custom_bend_geometry.py) | Two runs connect the same ports. Compare the standard arc with the custom right-angle bend. The shaded box at the turn shows the custom bend's search proxy. | [Two bends at the same corner](08_custom_bend_geometry.png) | The dashed outlines show the shapes used for collision checks during search. The solid outlines show the physical waveguides. ## Diagnose congestion or an incomplete route | Script | What to look for | Preview | | --- | --- | --- | | [Congestion resolution](02_congestion_resolution.py) | The eastbound route bends around the lower ends of two straight vertical routes. | [Detour around vertical routes](02_congestion_resolution.png) | | [Best-effort result](09_unroutable_best_effort.py) | At `node_limit=3`, the route stops after its first turn with outcome `partial`. At 500 it reaches the target heading west. | [Three versus 500 nodes](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short) | | [Fan-out](07_large_scale_routing.py) | Ten routes pass through one opening in a wall and spread out to widely spaced targets on the right. | [Ten routes through one opening](07_large_scale_routing.png) | The fan-out script includes a callback that can adjust the search weight for later iterations. With these settings, the automatically generated starting paths already pass verification. For a multi-net example built on the public API, try the [two-crossing layout](advanced.md#two-crossings-with-an-outside-detour). ## Route a challenging layout Compare each board's inputs with its verified routes in the [advanced gallery](advanced.md). It covers mixed widths, competing passages, preplaced crossings, and both heading configurations of the nine-net Terminal-Bench board.