@graphty/graphty-element / layout/LayoutEngine / SimpleLayoutEngine
Abstract Class: SimpleLayoutEngine ​
Defined in: graphty-element/src/layout/LayoutEngine.ts:194
Base class for simple static layout engines that compute positions synchronously
Extends ​
Constructors ​
Constructor ​
new SimpleLayoutEngine(
opts):SimpleLayoutEngine
Defined in: graphty-element/src/layout/LayoutEngine.ts:206
Create a simple layout engine
Parameters ​
opts ​
SimpleLayoutOpts = {}
Configuration options including scalingFactor
Returns ​
SimpleLayoutEngine
Overrides ​
Properties ​
config? ​
optionalconfig:Record<string,unknown>
Defined in: graphty-element/src/layout/LayoutEngine.ts:39
Inherited from ​
isSettled ​
readonlyisSettled:true=true
Defined in: graphty-element/src/layout/LayoutEngine.ts:341
Overrides ​
maxDimensions ​
staticmaxDimensions:number
Defined in: graphty-element/src/layout/LayoutEngine.ts:38
Inherited from ​
positions ​
positions:
Record<string|number,number[]> ={}
Defined in: graphty-element/src/layout/LayoutEngine.ts:199
scalingFactor ​
scalingFactor:
number=100
Defined in: graphty-element/src/layout/LayoutEngine.ts:200
stale ​
stale:
boolean=true
Defined in: graphty-element/src/layout/LayoutEngine.ts:198
type ​
statictype:string
Defined in: graphty-element/src/layout/LayoutEngine.ts:195
Overrides ​
zodOptionsSchema? ​
staticoptionalzodOptionsSchema:OptionsSchema
Defined in: graphty-element/src/layout/LayoutEngine.ts:47
NEW: Zod-based options schema for unified validation and UI metadata
Subclasses should override this to define their configurable options using the new Zod-based schema system.
Inherited from ​
Accessors ​
edges ​
Get Signature ​
get edges():
Iterable<Edge>
Defined in: graphty-element/src/layout/LayoutEngine.ts:337
Get all edges in the layout
Returns ​
Iterable<Edge>
Iterable of edges
Overrides ​
nodes ​
Get Signature ​
get nodes():
Iterable<Node>
Defined in: graphty-element/src/layout/LayoutEngine.ts:329
Get all nodes in the layout
Returns ​
Iterable<Node>
Iterable of nodes
Overrides ​
type ​
Get Signature ​
get type():
string
Defined in: graphty-element/src/layout/LayoutEngine.ts:89
Get the type identifier for this layout engine
Returns ​
string
The layout engine type string
Inherited from ​
Methods ​
addEdge() ​
addEdge(
e):void
Defined in: graphty-element/src/layout/LayoutEngine.ts:251
Add an edge to the layout and mark positions as stale
Parameters ​
e ​
The edge to add
Returns ​
void
Overrides ​
addEdges() ​
addEdges(
edges):void
Defined in: graphty-element/src/layout/LayoutEngine.ts:79
Add multiple edges to the layout engine
Parameters ​
edges ​
Edge[]
Array of edges to add
Returns ​
void
Inherited from ​
addNode() ​
addNode(
n):void
Defined in: graphty-element/src/layout/LayoutEngine.ts:242
Add a node to the layout and mark positions as stale
Parameters ​
n ​
The node to add
Returns ​
void
Overrides ​
addNodes() ​
addNodes(
nodes):void
Defined in: graphty-element/src/layout/LayoutEngine.ts:69
Add multiple nodes to the layout engine
Parameters ​
nodes ​
Node[]
Array of nodes to add
Returns ​
void
Inherited from ​
doLayout() ​
abstractdoLayout():void
Defined in: graphty-element/src/layout/LayoutEngine.ts:343
Returns ​
void
get() ​
staticget(type,opts):LayoutEngine|null
Defined in: graphty-element/src/layout/LayoutEngine.ts:111
Get a layout engine instance by type
Parameters ​
type ​
string
The layout engine type identifier
opts ​
object = {}
Configuration options for the layout engine
Returns ​
LayoutEngine | null
A new layout engine instance or null if type not found
Inherited from ​
getClass() ​
staticgetClass(type):LayoutEngineClass&LayoutEngineStatics|null
Defined in: graphty-element/src/layout/LayoutEngine.ts:180
Get a layout class by type
Parameters ​
type ​
string
The layout engine type identifier
Returns ​
LayoutEngineClass & LayoutEngineStatics | null
The layout engine class or null if not found
Inherited from ​
getEdgePosition() ​
getEdgePosition(
e):EdgePosition
Defined in: graphty-element/src/layout/LayoutEngine.ts:284
Get the position of an edge based on its endpoints
Parameters ​
e ​
The edge to get position for
Returns ​
The edge's source and destination positions
Overrides ​
getNodePosition() ​
getNodePosition(
n):Position
Defined in: graphty-element/src/layout/LayoutEngine.ts:261
Get the position of a node, computing layout if stale
Parameters ​
n ​
The node to get position for
Returns ​
The node's position coordinates
Overrides ​
getOptionsForDimension() ​
staticgetOptionsForDimension(dimension):object|null
Defined in: graphty-element/src/layout/LayoutEngine.ts:217
Get dimension-specific options for simple layouts
Parameters ​
dimension ​
The desired dimension (2 or 3)
2 | 3
Returns ​
object | null
Options object with dim parameter or null if unsupported
Overrides ​
LayoutEngine.getOptionsForDimension
getOptionsForDimensionByType() ​
staticgetOptionsForDimensionByType(type,dimension):object|null
Defined in: graphty-element/src/layout/LayoutEngine.ts:142
Get dimension-specific options for a layout by type
Parameters ​
type ​
string
The layout engine type identifier
dimension ​
The desired dimension (2 or 3)
2 | 3
Returns ​
object | null
Options object for the dimension or null if type not found or unsupported
Inherited from ​
LayoutEngine.getOptionsForDimensionByType
getRegisteredTypes() ​
staticgetRegisteredTypes():string[]
Defined in: graphty-element/src/layout/LayoutEngine.ts:171
Get a list of all registered layout types
Returns ​
string[]
Array of registered layout type identifiers
Inherited from ​
LayoutEngine.getRegisteredTypes
getZodOptionsSchema() ​
staticgetZodOptionsSchema():OptionsSchema
Defined in: graphty-element/src/layout/LayoutEngine.ts:155
Get the Zod-based options schema for this layout
Returns ​
The options schema, or an empty object if no schema defined
Inherited from ​
LayoutEngine.getZodOptionsSchema
hasZodOptions() ​
statichasZodOptions():boolean
Defined in: graphty-element/src/layout/LayoutEngine.ts:163
Check if this layout has a Zod-based options schema
Returns ​
boolean
true if the layout has options defined
Inherited from ​
init() ​
init():
Promise<void>
Defined in: graphty-element/src/layout/LayoutEngine.ts:234
Initialize the layout engine
Simple layouts compute positions synchronously and don't require initialization.
Returns ​
Promise<void>
Overrides ​
pin() ​
pin():
void
Defined in: graphty-element/src/layout/LayoutEngine.ts:311
Pin a node in place
Simple layouts are static and don't support interactive node pinning.
Returns ​
void
Overrides ​
register() ​
staticregister<T>(cls):T
Defined in: graphty-element/src/layout/LayoutEngine.ts:98
Register a layout engine class in the global registry
Type Parameters ​
T ​
T extends LayoutEngineClass
Parameters ​
cls ​
T
The layout engine class to register
Returns ​
T
The registered class for chaining
Inherited from ​
setNodePosition() ​
setNodePosition():
void
Defined in: graphty-element/src/layout/LayoutEngine.ts:275
Set node position
Simple layouts are static and recompute all positions from scratch, so individual position setting is not supported.
Returns ​
void
Overrides ​
step() ​
step():
void
Defined in: graphty-element/src/layout/LayoutEngine.ts:302
Step the layout animation
Simple layouts are static and don't animate, so stepping has no effect.
Returns ​
void
Overrides ​
unpin() ​
unpin():
void
Defined in: graphty-element/src/layout/LayoutEngine.ts:320
Unpin a node
Simple layouts are static and don't support interactive node pinning.
Returns ​
void