effect-io-ai

Package: effect
Module: Graph

Graph.entries

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

Example

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"]]

Signature

declare const entries: <T, N>(walker: Walker<T, N>) => Iterable<[T, N]>

Source

Since v3.18.0