Expand description
§Connector routing
Global connector routing: route many connectors at once around rectangular obstacles (diagram nodes, schematic parts, cabinets in a cable plan), minimising length, bends, crossings and overlaps, and place the final segments apart from each other.
All geometry is exact integer arithmetic (Point coordinates within
MAX_COORD); there are no floating-point robustness issues and results are
reproducible. The crate is no_std and needs only alloc.
§Orthogonal routing
flowchart LR
S[Scene: obstacles, ports, OVG] --> A[route: one connector]
S --> G[global::route_all: PathFinder]
G --> C[crossing::reduce_crossings]
C --> N[nudge::nudge]
P[pipeline::draw] --> SScene: obstacles andPorts with their orthogonal visibility graph (Wybrow, Marriott and Stuckey 2009), updated incrementally as obstacles and ports change.incrementalreports which committed routes a change affects.route: the optimal route of one connector under anObjective(length and bends, exact lexicographic orders available), by A* over(vertex, heading); the 1-bend visibility graph of Marriott et al. (2014) is available asSearch::OneBend.global::route_all: many connectors withPathFindernegotiated congestion over channel capacities, rip-up and reroute, and crossing penalties.crossing: required crossings between routes, crossing reduction, and the crossing points of finished routes for drawing hops.nudge: ordering of shared segments and exact separation by difference constraints (no LP); the constraints are exported for layout engines.pipeline::draw: the pipeline of arXiv 2309.01671 from boxes and edges to a drawing, port assignment included.hyperedge: nets with more than two ports as rectilinear Steiner trees (Wybrow et al. 2012).check: independent validation of routes.
§Any-angle routing
sleeve: sleeve routing through an exact constrained Delaunay triangulation with the funnel algorithm (arXiv 2605.17498).polyline: incremental shortest poly-line routing over the visibility graph (Wybrow et al. 2005).
§Features
multi-objective:pareto::front, the Pareto front of one connector over length, bends and crossings (NAMOA*dr frommultiobjective-search).
§Example
use connector_routing::{Connector, DirSet, Point, Port, Rect, Scene, check, global, nudge};
let mut scene = Scene::new();
let boxes = [Rect::new(0, 0, 20, 10), Rect::new(60, 0, 80, 10), Rect::new(30, -30, 50, 40)];
for b in boxes {
scene.add_obstacle(b)?;
}
// Two connectors from the left box to the right box, around the box in between.
let a = scene.add_port(Port::new(Point::new(20, 3), DirSet::RIGHT))?;
let b = scene.add_port(Port::new(Point::new(60, 3), DirSet::LEFT))?;
let c = scene.add_port(Port::new(Point::new(20, 7), DirSet::RIGHT))?;
let d = scene.add_port(Port::new(Point::new(60, 7), DirSet::LEFT))?;
let connectors = [Connector { source: a, target: b }, Connector { source: c, target: d }];
let routing = global::route_all(&scene, &connectors, &global::Config::default())?;
let nudged = nudge::nudge(scene.graph(), &boxes, &routing.routes, &nudge::Config::default());
for route in &nudged.routes {
assert!(check::orthogonal(route, &boxes).is_ok());
}
assert_eq!(nudged.overlaps, 0);See docs/design.md for the models, the deviations from the papers found by
testing, and the paper table.
Repository: https://github.com/sunsided/connector-routing
Modules§
- check
- Independent route validation.
- crossing
- Crossings between routes in the routing graph, and crossing reduction (arXiv 2309.01671; crossing detection on shared paths as in Dwyer et al. 2006).
- global
- Global routing of many connectors with
PathFindernegotiated congestion (McMurchieand Ebeling 1995), rip-up and reroute. - hyperedge
- Orthogonal hyperedge routing (Wybrow, Marriott and Stuckey 2012): one net connecting more than two ports as a rectilinear Steiner tree of minimal length and bends.
- incremental
- Which committed routes a scene change affects (Wybrow, Marriott and Stuckey 2005; Dwyer, Marriott and Wybrow 2006).
- nudge
- Nudging: final placement of routed segments (Wybrow et al. 2009, section 5; arXiv 2309.01671).
- pareto
- Pareto-optimal routes for one connector over length, bends and crossings (feature
multi-objective), via NAMOA*dr frommultiobjective-search. - pipeline
- The orthogonal drawing pipeline of Hegemann and Wolff (arXiv 2309.01671) for fixed boxes: port assignment, routing, crossing reduction, path ordering and nudging.
- polyline
- Incremental poly-line connector routing (Wybrow, Marriott and Stuckey 2005; Wybrow’s thesis 2008, chapter 5): shortest any-angle routes over the visibility graph of the obstacle corners, kept up to date as obstacles come and go.
- sleeve
- Sleeve routing (Nachmanson and Chen, arXiv 2605.17498, section 4): smooth any-angle routes through a constrained Delaunay triangulation of the free space.
Structs§
- Connector
- A connector to route between two ports.
- DirSet
- A set of
Directions, such as the directions a port may be left in. - Endpoints
- A routing request between two graph vertices.
- Net
- One routed net: the graph edges it uses and its terminals.
- Obstacle
Id - An obstacle of a
Scene. Stable until the obstacle is removed; ids of removed obstacles are reused. - Plain
Costs - No extra cost: plain length and bends.
- Point
- A point with integer coordinates.
- Port
- A connection point: where connectors start or end, and in which directions.
- PortId
- A port of a
Scene. Stable until the port is removed; ids of removed ports are reused. - Rect
- A closed axis-aligned rectangle with positive width and height.
- Route
- An orthogonal route through a routing graph.
- Routing
Graph - A partial grid: points joined by axis-parallel, obstacle-free edges.
- Scene
- Obstacles, ports and their orthogonal visibility graph, updated incrementally.
- Vertex
Id - A vertex of a
RoutingGraph. - Weights
- The length and bend weights of an
Objectiveon a given graph.
Enums§
- Axis
- One of the two coordinate axes.
- Direction
- An axis-parallel direction of travel.
- Error
- Why an operation failed.
- Objective
- What a route minimises.
- Search
- Which single-connector search to use.
- Side
- A side of a rectangle.
Constants§
- MAX_
COORD - The largest absolute coordinate the crate accepts.
Traits§
- Edge
Costs - Extra costs a caller charges on top of length and bends, such as congestion.
Functions§
- cost_of
- The cost of a route of
lengthandbendsunderweights, saturating. - endpoints
- The endpoints of a connector between two ports of
scene. - min_
bends - The minimum number of bends an orthogonal route needs in the obstacle-free plane to
get from
from, currently moving inheading, toto, arriving with a heading inarrivals.Noneifarrivalsis empty. - route
- The optimal route for one connector between two ports of
scene. - route_
vertices - The cheapest route between two vertices of
graph, orNoneif there is none. - simplify
- Removes repeated points and merges collinear runs of an orthogonal polyline.