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

Function addEdgeByIdentity

packages/effect/src/Graph.ts:979–990  ·  view source on GitHub ↗
(
  mutable: MutableGraph<N, E, T>,
  indexByIdentity: MutableHashMap.MutableHashMap<NI, NodeIndex>,
  identity: EdgeIdentity<NI, EI>,
  data: E
)

Source from the content-addressed store, hash-verified

977
978/** @internal */
979const addEdgeByIdentity = <N, E, T extends Kind, NI, EI>(
980 mutable: MutableGraph<N, E, T>,
981 indexByIdentity: MutableHashMap.MutableHashMap<NI, NodeIndex>,
982 identity: EdgeIdentity<NI, EI>,
983 data: E
984): void => {
985 const sourceIndex = Option.getOrUndefined(MutableHashMap.get(indexByIdentity, identity.source))
986 const targetIndex = Option.getOrUndefined(MutableHashMap.get(indexByIdentity, identity.target))
987 if (sourceIndex !== undefined && targetIndex !== undefined) {
988 addEdge(mutable, sourceIndex, targetIndex, data)
989 }
990}
991
992/** @internal */
993const assertSameKind = <N, E>(self: Graph<N, E, Kind>, that: Graph<N, E, Kind>): void => {

Callers 1

Graph.tsFile · 0.85

Calls 2

addEdgeFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected