Skip to content

@graphty/layout / index / toLayoutSnapshot

Function: toLayoutSnapshot() ​

toLayoutSnapshot(G, weightAttr?): GraphSnapshot

Defined in: simulation/snapshot.ts:35

The undirected snapshot of a layout input (graph-format design 14.3): a snapshot is returned as its undirected derived graph (the input itself when already undirected); a legacy duck-typed graph is walked on every call, never cached by object identity, because nothing tells a mutated object from an unchanged one; a node list becomes an edgeless snapshot. A getEdgeData result of null or undefined leaves that edge unweighted and a string is coerced with Number() (a non-numeric string is NaN, which the builder rejects).

Parameters ​

G ​

Graph | GraphSnapshot | Node[]

the input

weightAttr? ​

string | null

the edge attribute read through getEdgeData, or null for unweighted

Returns ​

GraphSnapshot

the undirected snapshot