MCPcopy Create free account
hub / github.com/Effect-TS/effect / graphEdgeData

Function graphEdgeData

packages/effect/test/Graph.test.ts:74–87  ·  view source on GitHub ↗
(graph: Graph.Graph<SetNode, E, T>)

Source from the content-addressed store, hash-verified

72}
73
74const graphEdgeData = <E, T extends Graph.Kind>(graph: Graph.Graph<SetNode, E, T>) => {
75 const nodeIds = new Map(Array.from(graph, ([index, node]) => [index, node.id]))
76 return new Map(
77 Array.from(
78 Graph.edges(graph),
79 ([, edge]) => [
80 graph.type === "directed"
81 ? `${nodeIds.get(edge.source)}->${nodeIds.get(edge.target)}`
82 : `${nodeIds.get(edge.source)}--${nodeIds.get(edge.target)}`,
83 edge.data
84 ]
85 )
86 )
87}
88
89describe("Graph", () => {
90 describe("constructors", () => {

Callers 1

Graph.test.tsFile · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected