Usage guidesLayout

ForceAtlas2 layout

Connected nodes attract while repulsion and gravity shape the network.

Overview

Connected nodes attract while repulsion and gravity shape the network.

When to use it

Use it to see densely connected groups and the links between them.

Basic usage

Set the layout type with layout.type.

const graph = new Graph({
  container,
  data,
  layout: { type: 'force-atlas2' },
});

Options

OptionDescriptionTypeDefault
krRepulsion coefficient between nodes.number5
kgGravity coefficient that pulls nodes toward the center.number1
barnesHutWhether to approximate repulsion with Barnes–Hut.booleantrue
maxIterationMaximum number of iterations.number100, or 50 above 5,000 nodes

Common layout options · Layout reference

Code example

Stronger repulsion and gravity reveal three connected groups.

Loading example…
Drag to pan or scroll to zoom.
const layout = { type: 'force-atlas2', kr: 8, kg: 2 };

Compare network layouts