Feature Library

Elbow connectors and graph layouts

0.91 CPU ms
A still of the Elbow connectors and graph layouts demo
Still
The live demo starts when it’s in view.Drag steps and watch the lines re-route · drag the board to pan · Tab to a step, arrows move it, N adds one, T follows the lines instead

Orthogonal connectors routed round every box by A* over a sparse grid, with a bend cost and a tie-break that keeps elbow corners from flipping as things move…

What it costs a frame

0.91 ms
GPU
not used
CPU, median
0.91 ms
CPU, 95th pct
1.82 ms
Draw calls
0
Weight
Moderate

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured in the layered layout with one step circling through its neighbours, so every frame routes all 12 connectors afresh (A* round all 11 steps each) and redraws them. Idle, nothing moves and nothing is routed: 0 ms. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed0.911.82
apple · Apple A19 Proin a browser tab · 16 November 2026not timed2.546.18
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed1.001.70

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Flowcharts and process maps
  2. Node editors
  3. Mind maps
  4. Org charts and dependency graphs
  5. Whiteboards
  6. Architecture diagrams
  7. Shares, counts and statuses on flow lines
  8. Diagrams a keyboard can follow
  9. A diagram as a table for screen readers

Pitfalls, in brief

  1. Many routes tie (a Z’s middle leg can cross anywhere between its ends at the same length and bends): without the tie-break the corner goes wherever the grid’s lines happen to fall, and jumps as a box moves a pixel.
  2. Route against boxes at rest, not as drawn: a card that grows on hover would otherwise move its line’s corner.
  3. Each route builds a grid of (2 × boxes + 3)² points and five headings: fine for dozens of boxes per line, not thousands.
  4. Two lines between the same pair route on top of each other: pin a loop back to other sides (anchors s → s gives a U under both).
  5. The layered layout lays out along x for direction right: give lanes in y (top and height), and size them from how many steps share a layer in each lane.
4 more in brief
  1. A mark at a fixed place along a line (a share, a count) lands on the line’s label once the line gets short: place it with markAlong, pass the label’s box (and other marks) in avoid and the arrowhead’s length as the end clearance, and draw it where it says, on the line or beside it.
  2. Routing is not free per frame: route only when a box, a port or an option changed, never on an idle frame.
  3. Travel follows the lines on show, so build its graph from the same links you draw (the flow, or a mind map’s branches), and build it again when they change.
  4. A diagram is a picture to a screen reader: give its steps as a table too (diagramAsTable), in flow order, with where each comes from and goes.
9 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

WAI-ARIA Authoring Practices Guide (W3C): the Radio Group pattern for the demo’s arrow-key switch, and a polite live region that reads each step reached

A* search (Hart, Nilsson and Raphael, 1968): The router’s search: shortest path with a Manhattan-distance heuristic, over (node, heading) states so a corner can cost extra.

Orthogonal connector routing (Wybrow, Marriott and Stuckey, 2009): The published form of the same idea: a sparse orthogonal grid from the obstacles’ edges, searched for the shortest route with the fewest bends.

Layered graph drawing (Sugiyama, Tagawa and Toda, 1981): The layered layout’s four steps: break cycles, assign layers, order each layer by its neighbours’ average place (barycentre) to cut crossings, then place.

connectorsorthogonal routingA*elbow linesgraph layoutSugiyamaswimlanesmind mapsvgkeyboardaccessibilityscreen readerstablesno dependencies

Near it in the frame