Usage guidesLayout

Fruchterman layout

Balance edge attraction and node repulsion, with gravity pulling the graph inward.

Overview

Balance edge attraction and node repulsion, with gravity pulling the graph inward.

When to use it

Use it for networks without a clear center or hierarchy.

Basic usage

Set the layout type with layout.type.

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

Options

OptionDescriptionTypeDefault
gravityStrength of the pull toward the layout center.number10
speedSpeed factor for node movement in the simulation.number5
maxIterationMaximum number of iterations.numberDepends on node count

Common layout options · Layout reference

Code example

The example sets gravity to 12.

Loading example…
Drag to pan or scroll to zoom.
const layout = { type: 'fruchterman', gravity: 12 };

Compare network layouts