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

Function addEdgeByIdentity

packages/effect/src/Graph.ts:840–851  ·  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

838
839/** @internal */
840const addEdgeByIdentity = <N, E, T extends Kind, NI, EI>(
841 mutable: MutableGraph<N, E, T>,
842 indexByIdentity: MutableHashMap.MutableHashMap<NI, NodeIndex>,
843 identity: EdgeIdentity<NI, EI>,
844 data: E
845): void => {
846 const sourceIndex = Option.getOrUndefined(MutableHashMap.get(indexByIdentity, identity.source))
847 const targetIndex = Option.getOrUndefined(MutableHashMap.get(indexByIdentity, identity.target))
848 if (sourceIndex !== undefined && targetIndex !== undefined) {
849 addEdge(mutable, sourceIndex, targetIndex, data)
850 }
851}
852
853/** @internal */
854const 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