MCPcopy Create free account
hub / github.com/effect-app/libs / formatMermaidNode

Function formatMermaidNode

repos/effect/packages/effect/src/Graph.ts:2322–2347  ·  view source on GitHub ↗
(
  nodeId: string,
  label: string,
  shape: MermaidNodeShape
)

Source from the content-addressed store, hash-verified

2320
2321 // Second pass: remove filtered out nodes and their edges
2322 removeNodes(mutable, remove)
2323}
2324
2325/**
2326 * Filters and optionally transforms edges in a mutable graph using a predicate function.
2327 * Edges that return Option.none are removed from the graph.
2328 *
2329 * **Gotchas**
2330 *
2331 * The function may query the graph, but cannot mutate or finalize the same
2332 * graph while it runs. Retained payloads must remain the same edge type.
2333 *
2334 * **Example** (Filtering and mapping edges)
2335 *
2336 * ```ts import.meta.vitest
2337 * import { Graph, Option } from "effect"
2338 *
2339 * const graph = Graph.directed<string, number>((mutable) => {
2340 * const a = Graph.addNode(mutable, "A")
2341 * const b = Graph.addNode(mutable, "B")
2342 * const c = Graph.addNode(mutable, "C")
2343 * Graph.addEdge(mutable, a, b, 5)
2344 * Graph.addEdge(mutable, b, c, 15)
2345 * Graph.addEdge(mutable, c, a, 25)
2346 *
2347 * // Keep only edges with weight >= 10 and double their weight
2348 * Graph.filterMapEdges(
2349 * mutable,
2350 * (data) => data >= 10 ? Option.some(data * 2) : Option.none()

Callers 1

Graph.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…