Hyperlinkv0.8.0-beta.28

Graph

Graph.entriesconsteffect/Graph.ts:4182
<T, N>(walker: Walker<T, N>): Iterable<[T, N]>

Returns an iterator over [index, data] entries in the walker.

Example (Iterating walker entries)

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 entries = Array.from(Graph.entries(dfs))
console.log(entries) // [[0, "A"], [1, "B"]]
iterators
Source effect/Graph.ts:41822 lines
export const entries = <T, N>(walker: Walker<T, N>): Iterable<[T, N]> =>
  walker.visit((index, data) => [index, data] as [T, N])