Interface: ForceOptions
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
algorithm? | readonly | ForceAlgorithm | Default 'spring'. |
alphaDecay? | readonly | number | How fast alpha cools per tick, alpha ← alpha × (1 − alphaDecay). Default 1 − alphaMin^(1 / ticks), which reaches alphaMin after ticks ticks. |
alphaMin? | readonly | number | The simulation is at rest once alpha is below this. Default 0.001. |
center? | readonly | readonly number[] | Where the layout is centered, [x, y] or [x, y, z]. Default: the origin, or along an axis on which some nodes have a given coordinate, the mean of those. |
centerStrength? | readonly | number | Pull of each connected component, moved as a whole, toward center. It keeps the layout centered and disconnected parts from drifting apart without squeezing or bending any of them. A component with a node held along an axis is not pulled along that axis. Default 0.05. 'spring': against the default repulsion that leaves unconnected nodes about 43 units apart (`√(π × |
chargeStrength? | readonly | number | Many-body strength: negative repels, positive attracts. Default −30. |
collide? | readonly | boolean | Keep nodes from overlapping, each taken as a circle (a sphere in 3D) of the larger of its halfWidth and halfHeight. Default true. |
collideIterations? | readonly | number | Collision passes per tick; more settle dense clumps better. Default 1. |
collidePadding? | readonly | number | Room left between two nodes' outlines. Default 0. |
collideStrength? | readonly | number | Share of an overlap removed per tick, 0 to 1. Default 1. |
dimensions? | readonly | 2 | 3 | 2 lays out in the plane (the result has no z); 3 in space, reading graph.z for pins. Default 2. |
distanceMax? | readonly | number | Pairs farther apart than this do not repel. Default Infinity. |
distanceMin? | readonly | number | Pairs closer than this repel as if this far apart. Default 1. |
gravity? | readonly | number | Pull of every node toward center, times degree + 1, the same at any distance. Default 1. |
groupStrength? | readonly | number | Pull of each node toward the centroid of its group (graph.group), which keeps a group together. Default 0 (off). |
initialRadius? | readonly | number | Spacing of the start spiral (2D) or ball (3D). Default linkDistance / 3. |
jitterTolerance? | readonly | number | How much swinging is tolerated: higher is faster and less precise. Default 1. |
linkDistance? | readonly | number | Rest length of a link. Default 30. |
linkIterations? | readonly | number | Passes over the links per tick; more make the springs stiffer. Default 1. |
linkStrength? | readonly | number | Strength of every link, 0 to 1. Default: per link, 1 / min(degree(source), degree(target)), so the links of a hub do not crush its neighbours onto it. Scaled by the weight when linkWeight is 'strength' and never above 1 (a link closing its whole gap in one tick). |
linkWeight? | readonly | LinkWeightMode | Default 'strength'. |
linLog? | readonly | boolean | Attraction grows with the logarithm of a link's length instead of the length (Noack's LinLog): tighter, better separated clusters. Default false. |
scalingRatio? | readonly | number | Repulsion constant: the larger, the larger the layout (by its square root when attraction is linear). Default 10, or 1 with linLog, whose attraction is far weaker at a distance; both give links of some tens to a hundred layout units on graphs of a hundred nodes. |
seed? | readonly | number | Seed of the generator that separates coincident nodes. Default 1. |
strongGravity? | readonly | boolean | Gravity that grows with the distance from the center: a tighter, rounder layout, in which long chains curl. Default false. |
theta? | readonly | number | Barnes–Hut accuracy: a cell is taken as one mass when width / distance < theta. 0 is the exact sum. Default 0.9 for 'spring', 1.2 for 'forceatlas2' (the paper's value). |
ticks? | readonly | number | Ticks from start to rest: forceLayout runs this many, and the cooling rate is derived from it. Default defaultTicks: 300 up to 3,000 nodes, fewer above. |
velocityDecay? | readonly | number | Share of its velocity a node loses per tick, 0 to 1. Default 0.4. |
xStrength? | readonly | number | Strength of each positional force: the share of the gap closed per tick at alpha 1. Default 0.1. |
xTarget? | readonly | PerNode | Positional forces: pull nodes toward a coordinate along one axis, the same for all or one per node (a timeline network: xTarget from each node's date, a strong xStrength). Default none. |
yStrength? | readonly | number | - |
yTarget? | readonly | PerNode | - |
zStrength? | readonly | number | - |
zTarget? | readonly | PerNode | - |