Skip to content

@graphty/graphty-element / index / SnapshotLayoutInput

Interface: SnapshotLayoutInput ​

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:25

What a layout on the snapshot contract is handed each time the element asks for an arrangement.

Every coordinate array here and in the answer is in SCENE UNITS, dimensions numbers per row, and row i is the node whose index is i. A row with no coordinate is NaN.

Properties ​

added ​

readonly added: U32 | null

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:62

When the graph only grew since the last arrangement: the new rows. Every other row is kept where it is (it is in fixed), so a layout that can start from initial places the newcomers among their neighbours. Null for a fresh arrangement.


dimensions ​

readonly dimensions: 2 | 3

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:41

2 or 3, from the element's view mode or the consumer's dim option.


firstRun ​

readonly firstRun: boolean

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:39

True until an answer of this layout has been published since it was chosen with setLayout: the run that turns the graph into this layout's arrangement, rather than one that keeps it up to date after a change.


fixed ​

readonly fixed: object

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:54

The rows the layout cannot move, with their current coordinates: pinned nodes, nodes outside the scope, and after an add every node that was already laid out. The element keeps them where they are whatever the answer says.

positions ​

readonly positions: F32

rows ​

readonly rows: U32


graph ​

readonly graph: GraphSnapshot

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:27

The graph to arrange, undirected: one edge per connected pair, in the element's node rows.


initial ​

readonly initial: F32

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:56

Every row's current coordinates; NaN for a node nothing has placed yet.


options ​

readonly options: Readonly<Record<string, unknown>>

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:43

The consumer's options, validated and defaulted against the descriptor's options.


scope ​

readonly scope: U32 | null

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:48

For a scoped layout run over a set of nodes, the rows it places; null for the whole graph. The rows outside it are in fixed.


signal ​

readonly signal: AbortSignal

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:77

Aborted when the answer is no longer wanted: the graph changed, the layout was replaced or the element was disposed.


stored ​

readonly stored: GraphSnapshot

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:33

The same graph as the element stores it: directed or not, every parallel and reciprocal edge, and the edge weights (stored.edges.byRole("weight"), or stored.edgeList().weights). Read it for what making the graph undirected loses.

Methods ​

column() ​

column(optionName): readonly unknown[] | null

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:69

The values of the node attribute an option names, one per row, undefined where a node has none. The option's value is a path into the node's data, dot separated ("geo.lat").

Parameters ​

optionName ​

string

the option naming the attribute

Returns ​

readonly unknown[] | null

the values, or null when the option is not set to a path


dataPositions() ​

dataPositions(): F32

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:75

Where each node's own data places it: its position field ({ x, y, z } or [x, y, z]), scaled by the element's positionScale. NaN for a node whose data gives none.

Returns ​

F32

the coordinates


report() ​

report(progress): void

Defined in: graphty-element/src/layout/SnapshotLayoutEngine.ts:79

Tell the consumer how far the arrangement has got; the element emits it as layout-progress.

Parameters ​

progress ​

SnapshotLayoutProgress

Returns ​

void