import { traverseDepthFirstCustom } from "https://deno.land/x/rimbu@1.0.0/graph/main/traverse/index.ts";
Returns a stream of connections that can be reached in the given graph
starting at the given startNode
, and using depth-first traversal. It can
avoid loops if needed in a custom way by supplying the addVisitedNode
function.
Examples
Example 1
Example 1
const g = EdgeGraphHashed.of([1, 2], [2, 3], [1, 3], [3, 4])
const stream = traverseDepthFirstCustom(g, 1)
console.log(stream.toArray())
// => [[1, 2], [2, 3], [1, 3], [3, 4]]
Type Parameters
G extends VariantGraphBase<N, any>