MCPcopy Create free account
hub / github.com/codemix/graph / deleteEdge

Method deleteEdge

packages/graph/src/GraphStorage.ts:297–319  ·  view source on GitHub ↗
(id: ElementId)

Source from the content-addressed store, hash-verified

295 }
296
297 public deleteEdge(id: ElementId): void {
298 const edge = this.#edges.get(id);
299 if (edge == null) {
300 throw new EdgeNotFoundError(id);
301 }
302 // edge.inV is the target - remove from target's incoming edges
303 const incomingEdges = this.#incomingEdges.get(edge.inV);
304 if (incomingEdges != null) {
305 const index = incomingEdges.indexOf(edge);
306 if (index !== -1) {
307 incomingEdges.splice(index, 1);
308 }
309 }
310 // edge.outV is the source - remove from source's outgoing edges
311 const outgoingEdges = this.#outgoingEdges.get(edge.outV);
312 if (outgoingEdges != null) {
313 const index = outgoingEdges.indexOf(edge);
314 if (index !== -1) {
315 outgoingEdges.splice(index, 1);
316 }
317 }
318 this.#edges.delete(id);
319 }
320
321 public getIncomingEdges(vertexId: ElementId): Iterable<StoredEdge> {
322 const existing = this.#incomingEdges.get(vertexId);

Callers

nothing calls this directly

Calls 1

getMethod · 0.65

Tested by

no test coverage detected