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

Method getVertices

packages/graph/src/GraphStorage.ts:175–188  ·  view source on GitHub ↗
(labels: string[])

Source from the content-addressed store, hash-verified

173 }
174
175 public *getVertices(labels: string[]): Iterable<StoredVertex> {
176 // Snapshot keys to prevent infinite loops when vertices are added during iteration.
177 // Keys are just strings so this is cheap; actual vertex data is still fetched lazily.
178 const keys = [...this.#vertices.keys()];
179 for (const key of keys) {
180 const vertex = this.#vertices.get(key);
181 if (
182 vertex !== undefined &&
183 (labels.length === 0 || labels.includes(getLabelFromElementId(vertex.id)))
184 ) {
185 yield vertex;
186 }
187 }
188 }
189
190 public *getVerticesByIds(ids: Iterable<ElementId>): Iterable<StoredVertex> {
191 for (const id of ids) {

Callers

nothing calls this directly

Calls 2

getLabelFromElementIdFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected