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

Method getVertices

packages/y-graph-storage/src/YGraphStorage.ts:106–127  ·  view source on GitHub ↗
(labels: string[])

Source from the content-addressed store, hash-verified

104 }
105
106 public *getVertices(labels: string[]): Iterable<StoredVertex> {
107 if (labels.length === 0) {
108 labels = Object.keys(this.#config.schema.vertices) as string[];
109 }
110 for (const label of labels) {
111 for (const [uuid, data] of this.getVertexCollectionMap(label)) {
112 const id = `${label}:${uuid}` as ElementId;
113 const existing = this.#vertexIdentities.get(data);
114 if (existing != null) {
115 yield existing;
116 } else {
117 const vertex: StoredVertex = {
118 "@type": "Vertex",
119 id,
120 properties: this.getVertexProperties(label, uuid, data),
121 };
122 this.#vertexIdentities.set(data, vertex);
123 yield vertex;
124 }
125 }
126 }
127 }
128
129 public getEdgeById(id: ElementId): StoredEdge | undefined {
130 const [label, uuid] = parseElementId(id);

Callers

nothing calls this directly

Calls 3

getVertexPropertiesMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected