MCPcopy
hub / github.com/Effect-TS/effect / findEdge

Function findEdge

packages/effect/src/Graph.ts:654–664  ·  view source on GitHub ↗
(
  graph: Graph<N, E, T> | MutableGraph<N, E, T>,
  predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean
)

Source from the content-addressed store, hash-verified

652 * @category getters
653 */
654export const findEdge = <N, E, T extends Kind = "directed">(
655 graph: Graph<N, E, T> | MutableGraph<N, E, T>,
656 predicate: (data: E, source: NodeIndex, target: NodeIndex) => boolean
657): Option.Option<EdgeIndex> => {
658 for (const [edgeIndex, edgeData] of graph.edges) {
659 if (predicate(edgeData.data, edgeData.source, edgeData.target)) {
660 return Option.some(edgeIndex)
661 }
662 }
663 return Option.none()
664}
665
666/**
667 * Finds all edges that match the given predicate.

Callers

nothing calls this directly

Calls 1

predicateFunction · 0.50

Tested by

no test coverage detected