Skip to content

@graphty/layout / index / createSimulation

Function: createSimulation() ​

createSimulation(type, options?, accelerator?): LayoutSimulation

Defined in: simulation/create-simulation.ts:21

The layout-side dispatcher (design 9.3): the accelerator's method when it has one, else the CPU simulation; evaluated BEFORE any GPU work and never after it (design 2.4: the only branch that chooses the CPU). A thrown accelerator error propagates.

Parameters ​

type ​

SimulationType

the simulation type ("spring" is Fruchterman-Reingold)

options? ​

ForceAtlas2Options | FruchtermanReingoldOptions | SpringElectricalOptions

the type's options

accelerator? ​

LayoutAccelerator | null

the injected accelerator, or null / undefined for the CPU

Returns ​

LayoutSimulation

a simulation ready for load()