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

Method deleteVertex

packages/graph/src/Graph.ts:556–565  ·  view source on GitHub ↗

* Delete a vertex from the graph. * @param id The id of the vertex to delete, or the vertex itself.

(id: ElementId | Vertex<TSchema, any>)

Source from the content-addressed store, hash-verified

554 * @param id The id of the vertex to delete, or the vertex itself.
555 */
556 public deleteVertex(id: ElementId | Vertex<TSchema, any>): void {
557 if (typeof id === "object") {
558 id = id.id;
559 }
560 const vertex = this.#config.storage.getVertexById(id);
561 if (vertex) {
562 this.#indexManager.onElementRemove(vertex);
563 }
564 this.#config.storage.deleteVertex(id);
565 }
566
567 /**
568 * Add an edge to the graph.

Callers

nothing calls this directly

Calls 3

onElementRemoveMethod · 0.80
getVertexByIdMethod · 0.65
deleteVertexMethod · 0.65

Tested by

no test coverage detected