The graph keeps your place: once you’ve learned the picture, nothing moves unless you ask.

The problem

You spend a minute building a map in your head. Customers on the left, the supplier you care about near the middle. Then you expand one more node and the layout engine reruns on the bigger graph, finds a different “best” answer, and everything you memorized is gone.

The same loss happens in quieter ways. A layout switch makes every node jump at once. Edges leave from fixed top and bottom handles and loop around in a way that hides which node is which. And when you share a link, the other person gets the starting query with none of your exploring, because it all lived in component state.

What I concluded

The auto layout is a starting point, not an authority. After the first pass, the positions belong to the person.

Lay out once, then place incrementally

The engine runs once, on the first complete input, off the main thread. A full layout only happens when the person asks for it (first render, a layout mode switch) or when a new result barely overlaps the old one. Everything else is incremental: new nodes never move existing ones.

// Fan new nodes out on the far side of an already placed neighbor.
const away = Math.atan2(anchor.y - center.y, anchor.x - center.x);
const arc = Math.min((2 * Math.PI) / 3, (count - 1) * (Math.PI / 6));
// spread `count` points across `arc`, centered on `away`

The arc is capped, so a 50-neighbor expansion still reads as “out that way” instead of wrapping back into the graph it came from. The viewport only re-fits after a full layout.

Glide, don’t jump

When positions do change, nodes ease to their new spots over about a quarter second, and new children grow out of their parent. The tween runs on the real positions in the graph’s store, frame by frame, not as a CSS transition on the DOM node. Otherwise edges snap to the destination while the nodes trail behind. Reduced motion lands everything in one frame.

Edges attach at the nearest side

Each edge leaves a node where the line between the two centers crosses its border, and curves out along that angle. In an exploration graph, where position is about relationships rather than direction, that reads better than fixed ports. For a flowchart where “inputs left, outputs right” means something, keep the ports.

Expansions live in the URL

The base query is one param, and the expanded node ids are another, in order: /explore?q=suppliers&expand=sup_12,ord_881,cus_40.

Opening that link waits for all the expansion queries before laying out, so it lands as one picture that matches the sender’s. Writes use replace, and undo lives in the canvas, so Back still leaves the page in one press.

Rules

  • Full layout only on request. First render, a mode switch, or a mostly new result. Never a hover or a label change.
  • Existing nodes never move on an add. New ones fan out from a placed neighbor.
  • Animate the data, not the DOM. Edges are drawn from positions, so tween the positions.
  • The link rebuilds the canvas. Expansions go in the URL. Hover, selection and pack peels don’t.
  • Undo is the canvas’s job. One timeline covers expansions and peels, and browser history stays clean.

What you get

A graph you can explore for ten minutes without losing the map you built, then hand to someone else intact. It does get untidy after many expansions, and that’s what the layout switch is for: an explicit “tidy up” the person chooses.

Related: Dense graphs, URL as shared state