Network layouts

Arrange networks by connections, a focal node, or graph distance

Choose a layout

GoalLayout
Bring connected nodes closerforce, d3-force, force-atlas2, fruchterman
Explore connections around one noderadial, with focusNode identifying the center
Group nodes into rings by degreeconcentric, with sortBy: 'degree'
Show graph distance in two dimensionsmds, with linkDistance setting the distance scale

Configuration and example

The example starts with a radial layout. Set focusNode to 0 to choose its center and unitRadius to 68 to space the rings. Use Layout to compare all seven layouts on the same network.

Register Radial and MDS before using them. Optional layouts

Loading example…
Node 0 is purple. Switch Layout to see how it and the other nodes move.
const layouts: Record<string, LayoutConfig> = {
  radial: { type: 'radial', focusNode: '0', unitRadius: 68 },
  concentric: { type: 'concentric', sortBy: 'degree', nodeSize: 24 },
  force: { type: 'force', linkDistance: 100 },
  'd3-force': { type: 'd3-force', linkDistance: 100 },
  'force-atlas2': { type: 'force-atlas2', kr: 8, kg: 2 },
  fruchterman: { type: 'fruchterman', gravity: 12 },
  mds: { type: 'mds', linkDistance: 80 },
};

See the layout reference for force options, the Worker guide for background computation, and the layout gallery for more examples.