Skip to content

ForceLayout

Defined in: network/force.ts:222

new ForceLayout(graph, params?): ForceLayout

Defined in: network/force.ts:256

LayoutGraph

Partial<ForceParams> = {}

ForceLayout

readonly spacing: 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.

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.

boolean


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).

number

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.

number

number = 1

void


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).

number

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.

number

"cool" | "hot"

number


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.

Iterable<number, any, any> | null

void


tick(): void

Defined in: network/force.ts:319

Advance the simulation one step at the current heat, mutating graph.positions.

void