ExternalsConfigConfiguration for selecting external nodes.
When to use
Use to configure how externals identifies graph boundary nodes when you
need sinks with no outgoing edges or sources with no incoming edges.
Details
direction chooses which missing edge direction makes a node external:
"outgoing" selects nodes with no outgoing edges, and "incoming" selects
nodes with no incoming edges. If omitted, direction defaults to
"outgoing".
modelsexternals
Source effect/Graph.ts:48063 lines
export interface ExternalsConfig {
readonly ExternalsConfig.direction?: Directiondirection?: type Direction = "outgoing" | "incoming"Direction for graph traversal, indicating which edges to follow.
Example (Traversing by direction)
import { Graph } from "effect"
const graph = Graph.directed<string, string>((mutable) => {
const a = Graph.addNode(mutable, "A")
const b = Graph.addNode(mutable, "B")
Graph.addEdge(mutable, a, b, "A->B")
})
// Follow outgoing edges (normal direction)
const outgoingNodes = Array.from(
Graph.indices(Graph.dfs(graph, { start: [0], direction: "outgoing" }))
)
// Follow incoming edges (reverse direction)
const incomingNodes = Array.from(
Graph.indices(Graph.dfs(graph, { start: [1], direction: "incoming" }))
)
Direction
}Referenced by 1 symbols