本文へ移動

@eightkk/vue-weave / core / graphTracePath

Function: graphTracePath() ​

graphTracePath(result, nodeId, options?): GraphTracedPath | undefined

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

Rebuilds a path from a start node to nodeId from a traverseGraph result made with paths: true, following the first step of each node back to a start. The path has the fewest hops within its walk. With options.direction, only that walk is used; otherwise the walk with the shorter path, the backward walk on a tie. A start node gives a path of the node alone. Returns undefined when the node was not reached (by that walk). Throws Error when the result has no via or its steps form a cycle and RangeError for an invalid direction. The inputs are not modified.

Parameters ​

result ​

Pick<GraphTraversalResult, "nodeIds" | "via">

nodeId ​

string

options? ​

direction? ​

GraphWalkDirection

Returns ​

GraphTracedPath | undefined

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