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

Method getEdges

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

Source from the content-addressed store, hash-verified

201 }
202
203 public *getEdges(labels: string[]): Iterable<StoredEdge> {
204 // Snapshot keys to prevent infinite loops when edges are added during iteration.
205 // Keys are just strings so this is cheap; actual edge data is still fetched lazily.
206 const keys = [...this.#edges.keys()];
207 for (const key of keys) {
208 const edge = this.#edges.get(key);
209 if (
210 edge !== undefined &&
211 (labels.length === 0 || labels.includes(getLabelFromElementId(edge.id)))
212 ) {
213 yield edge;
214 }
215 }
216 }
217
218 public *getEdgesByIds(ids: Iterable<ElementId>): Iterable<StoredEdge> {
219 for (const id of ids) {

Callers

nothing calls this directly

Calls 2

getLabelFromElementIdFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected