ForceLayout
Defined in: network/force.ts:222
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ForceLayout(
graph,params?):ForceLayout
Defined in: network/force.ts:256
Parameters
Section titled “Parameters”params?
Section titled “params?”Partial<ForceParams> = {}
Returns
Section titled “Returns”ForceLayout
Properties
Section titled “Properties”spacing
Section titled “spacing”
readonlyspacing:number
Defined in: network/force.ts:235
The force model’s equilibriumSpacing — the unit of the per-tick step cap and of the
convergence test. 0 for a model without one.
Accessors
Section titled “Accessors”converged
Section titled “converged”Get Signature
Section titled “Get Signature”get converged():
boolean
Defined in: network/force.ts:285
Whether the layout has converged (#124): its last tick moved nodes by less than
CONVERGED_STEP of the spacing on average, and by no more than the tick before (a
layout accelerating from rest has small first steps without being settled), at least
MIN_SETTLE_TICKS ticks into the current heat schedule. Always false for a model without
an equilibrium spacing — that one runs its whole tick budget.
Returns
Section titled “Returns”boolean
meanStep
Section titled “meanStep”Get Signature
Section titled “Get Signature”get meanStep():
number
Defined in: network/force.ts:274
Mean per-node step of the last tick, in world units (Infinity before the first tick).
Returns
Section titled “Returns”number
Methods
Section titled “Methods”cool()
Section titled “cool()”cool(
ticks,from?):void
Defined in: network/force.ts:294
Start a cooling schedule: heat from (a fraction of alpha) decaying geometrically to
MIN_HEAT over ticks ticks (see Cooling.cool). run calls it; a caller
driving tick itself (the worker’s streamed loop, a drag’s re-cool) sets it up front.
Parameters
Section titled “Parameters”number
number = 1
Returns
Section titled “Returns”void
hold()
Section titled “hold()”hold(
heat):void
Defined in: network/force.ts:300
Hold a constant heat, e.g. DRAG_HEAT while a drag reflows the layout (see Cooling.hold).
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
run(
iterations,schedule?):number
Defined in: network/force.ts:445
Solve for at most iterations ticks, stopping as soon as the layout has converged (#124)
— iterations is the maximum, not a fixed count. Returns the ticks run.
"hot" (the default, as before #124) keeps full heat, which a cold disc start needs to untangle —
cooling a random start freezes it half-way (web-NotreDame: mean edge 968 vs 599 after 300 ticks)
— so it stops only once the layout settles on its own. A call shorter than
MIN_SETTLE_TICKS never counts as converged, so batched run(n) calls tick exactly n
times at full heat each. "cool" decays the heat over the budget: for a seeded layout
(multilevel, or a drag’s re-cool) that already has its global arrangement.
Parameters
Section titled “Parameters”iterations
Section titled “iterations”number
schedule?
Section titled “schedule?”"cool" | "hot"
Returns
Section titled “Returns”number
setPinned()
Section titled “setPinned()”setPinned(
ids):void
Defined in: network/force.ts:311
Set the held (pinned) node set for an interactive drag (#140), replacing any previous one. Pinned
nodes are left where the caller put them — tick won’t move them — so the drag session can
hold them exactly under the cursor while the rest of the layout reheats around them. Pass null
(or an empty iterable) to release every pin. Allocates the flag array lazily on first use.
Parameters
Section titled “Parameters”Iterable<number, any, any> | null
Returns
Section titled “Returns”void
tick()
Section titled “tick()”tick():
void
Defined in: network/force.ts:319
Advance the simulation one step at the current heat, mutating graph.positions.
Returns
Section titled “Returns”void