effect-io-ai

Package: effect
Module: Graph

Graph.values

Returns an iterator over the values (data) 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 values = Array.from(Graph.values(dfs))
console.log(values) // ["A", "B"]

Signature

declare const values: <T, N>(walker: Walker<T, N>) => Iterable<N>

Source

Since v3.18.0