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

Method getVertexById

packages/graph/src/Graph.ts:419–431  ·  view source on GitHub ↗
(
    id: ElementId,
    options?: { throwIfNotFound?: boolean },
  )

Source from the content-addressed store, hash-verified

417 options?: { throwIfNotFound?: false },
418 ): Vertex<TSchema, TVertexLabel> | undefined;
419 public getVertexById<TVertexLabel extends VertexLabel<TSchema>>(
420 id: ElementId,
421 options?: { throwIfNotFound?: boolean },
422 ): Vertex<TSchema, TVertexLabel> | undefined {
423 const data = this.#config.storage.getVertexById(id);
424 if (data === undefined) {
425 if (options?.throwIfNotFound) {
426 throw new VertexNotFoundError(id);
427 }
428 return undefined;
429 }
430 return this.instantiateVertex<TVertexLabel>(data);
431 }
432
433 public *getVertices<TVertexLabel extends VertexLabel<TSchema>>(
434 ...labels: TVertexLabel[]

Callers 2

getElementByIdMethod · 0.95
addEdgeMethod · 0.95

Calls 2

instantiateVertexMethod · 0.95
getVertexByIdMethod · 0.65

Tested by

no test coverage detected