Hyperlinkv0.8.0-beta.28

Graph

Graph.indicesconsteffect/Graph.ts:4134
<T, N>(walker: Walker<T, N>): Iterable<T>

Returns an iterator over the indices in the walker.

Example (Iterating walker indices)

import { Graph } from "effect"

const graph = Graph.directed<string, number>((mutable) => {
  const a = Graph.addNode(mutable, "A")
  const b = Graph.addNode(mutable, "B")
  Graph.addEdge(mutable, a, b, 1)
})

const dfs = Graph.dfs(graph, { start: [0] })
const indices = Array.from(Graph.indices(dfs))
console.log(indices) // [0, 1]
iterators
Source effect/Graph.ts:41341 lines
export const indices = <T, N>(walker: Walker<T, N>): Iterable<T> => walker.visit((index, _) => index)