本文へ移動

@eightkk/vue-weave / core / traverseGraph

Function: traverseGraph() ​

traverseGraph<E>(graph, startIds, options?): GraphTraversalResult

Defined in: src/core/graphTraversal.ts:99

Finds the nodes and edges reached from startIds along options.direction within options.maxHops. With both, the two directions are walked independently, so a shared parent does not pull in its other children. The walk is iterative, so it handles long chains, and it terminates on cycles. Unknown start IDs are reported in unknownIds instead of throwing. edgeFilter, maxNodes and paths are opt-in; without them the result has only nodeIds, edgeIds and unknownIds. Throws RangeError for an invalid maxHops, maxNodes or direction, TypeError for an edgeFilter that is not a function or a paths that is not a boolean, and Error for a duplicate or empty node or edge ID or an edge with an unknown endpoint. Errors thrown by edgeFilter propagate. The inputs are not modified.

Type Parameters ​

E ​

E extends GraphEdge<unknown> = GraphEdge<unknown>

Parameters ​

graph ​

edges ​

readonly E[]

nodes ​

readonly object[]

startIds ​

Iterable<string>

options? ​

GraphTraversalOptions<E> = {}

Returns ​

GraphTraversalResult

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