Search for a command or topic.

LOCAL SEARCH · NO DATA LEAVES YOUR BROWSER
How it works

Connections and routing

How connections find a clear path, and how to guide them when needed.

The router draws right-angle connections between the placed cards. It tries simple paths first, then uses A* grid search when it needs to find a way around obstacles. Later passes resolve conflicts and place labels.

A short path is useful only if you can follow it. Select a candidate below to see why a clear detour can beat a direct line.

A clear path is worth a detour

simplified example
Client Worker Storage
Rejected

This path runs through the worker card.

route costNot usable
Client Worker Storage
Costly

The direct path clears the cards but crosses another connection.

route cost300,160
Client Worker Storage
Preferred here

Two bends and a longer path avoid both obstacles.

route cost1,120
The dashed line is an existing connection. Attachment preferences are held equal; the clear path's calculation is below.

How the costs add up

Each bend and extra unit of distance adds to a route’s cost. Crossings carry a much larger penalty, so the router usually prefers a longer, clearer path. This score helps choose a connection; it is separate from the quality comparison for the whole drawing.

The clear path costs 1,120 points

320 × bends+length+3 × excess length+conflict penalties
2 bends640
240-unit path240
80 excess units × 3240
clear path total1,120
Excess length is the distance beyond the direct 160-unit path. One crossing adds 300,000 points; other routing stages can add costs or reject a path.

The search has limits. If it cannot find a suitable route within its budget, it uses a fallback and reports a warning. Dense diagrams may still need an adjustment in Studio.

Default connector shape

Clean and simple wins by default. A connection leaves its source through the side that points at the target, and it arrives through the side that faces back at the source.

  • Straight when aligned. If two stacked icons share part of a column, or two side-by-side icons sit on almost the same row, and nothing is in between, the connection is one straight line. It may pass over the two icons’ own labels, because a detour around them would be harder to read.
  • One turn when offset. A dashed connection to a stacked icon that is not aligned makes a single turn and enters through the top or bottom that faces its source.
  • Around, never through. If another icon sits in the way, the connection goes around it instead.

In Studio, moving an icon redraws only the connections attached to it, using these same rules. Everything else keeps its current path. If you move both ends of a connection together, it keeps its shape.

Guide a connection

from e prefers the east side of a card, but lets the router choose another side if needed. Adding a fractional offset fixes the attachment point: from e offset 0.25 attaches a quarter of the way down that side.

diagram port_strength {
  grammar aws
  flow lr
  cloud-agnostic.actor client "Client"
  cloud-agnostic.server api "API"
  client -> api { id preferred from e to w }
  api -> client { id fixed from w offset 0.25 to e offset 0.75 style dashed }
}

If a connection is hard to read, try clearer grouping, fewer relationships, or removing an old route override. Use a manual route in Studio when you want to keep a particular shape.

Contributors can find the stage-specific penalties and rejection rules in packages/runtime/ROUTING.md.