Skip to content

@eightkk/vue-weave / core / mergeGraphExpansionPage

Function: mergeGraphExpansionPage() ​

mergeGraphExpansionPage<N, E>(state, page, expandedIds?, options?): GraphExpansionState<N, E>

Defined in: src/core/graphExpansion.ts:149

Merges a page into the state: nodes and edges are added or replaced by ID, so overlapping pages (a cycle reached from two sides, a neighbour shared by two expanded nodes) never duplicate anything, and expandedIds (the nodes whose neighbours the page holds) are marked expanded and no longer pending. Throws Error for an item without a non-empty string ID, an ID twice in the page or an edge without string ends. With options.key, expandedIds are marked expanded for that key only (in expandedIdsByKey) and no longer pending for it; they stay in the unkeyed frontier. Without a key they are expanded for every key. Throws Error for a key that is not a non-empty string. The inputs are not modified.

Type Parameters ​

N ​

N extends object

E ​

E extends GraphEdge<unknown>

Parameters ​

state ​

GraphExpansionState<N, E>

page ​

GraphExpansionPage<N, E>

expandedIds? ​

Iterable<string> = []

options? ​

GraphExpansionKeyOptions

Returns ​

GraphExpansionState<N, E>

Released under the MIT License.