本文へ移動

@eightkk/vue-weave / core / layoutGraphIncrementally

Function: layoutGraphIncrementally() ​

layoutGraphIncrementally(nodes, edges, positions, options?): GraphIncrementalLayout

Defined in: src/core/graphIncremental.ts:92

Places the nodes of a graph that have no position yet next to the ones that do, without moving those. Every node in positions keeps its box exactly (unless the relaxed mode maxDisplacement pushes it, and fixed nodes never move); each new node goes on the flow side of its placed neighbours (after its predecessors, or before its successors when no predecessor is placed) in the first free place across the flow, nearest to the middle of those neighbours, below before above, keeping columnGap along and rowGap across the flow from every box. New nodes are placed in breadth-first order from the placed ones, so a chain of new nodes follows its dependency order and several new nodes of one neighbour stack around it. Components without any positioned node are laid out together with layoutLayeredGraph and placed after all other boxes across the flow (below them for LR and RL, to their right for TB and BT; at the padding when nothing has a position). Positions of IDs that are not nodes are ignored. Deterministic for the same input; self-loops and cycles are allowed. Overlap tests use a bucket grid, so the cost grows with the number of nodes and edges, not with their square.

Edges get the curve drawn for a moved node between their boxes, or keep their path from previousLayout while both end boxes are unchanged. Throws Error for invalid graphs (as indexGraph), a fixed ID that is not a node or has no position, and RangeError for an unknown direction, a non-finite position, a size that is not finite and positive, and gaps, padding or maxDisplacement that are not finite and nonnegative. The inputs are not modified.

Parameters ​

nodes ​

readonly IdentifiedNode[]

edges ​

readonly GraphEdge<unknown>[]

positions ​

ReadonlyMap<string, GraphKnownPosition>

options? ​

GraphIncrementalLayoutOptions = {}

Returns ​

GraphIncrementalLayout

MIT ライセンスで公開しています。