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

Method getEdges

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

Source from the content-addressed store, hash-verified

161 }
162
163 public *getEdges(labels: string[]): Iterable<StoredEdge> {
164 if (labels.length === 0) {
165 labels = Object.keys(this.#config.schema.edges) as string[];
166 }
167 for (const label of labels) {
168 for (const [uuid, data] of this.getEdgeCollectionMap(label)) {
169 const id = `${label}:${uuid}` as ElementId;
170 const existing = this.#edgeIdentities.get(data);
171 if (existing != null) {
172 yield existing;
173 } else {
174 const inV = data.get($InVKey) as ElementId | undefined;
175 if (inV == null) {
176 continue;
177 }
178 const outV = data.get($OutVKey) as ElementId | undefined;
179 if (outV == null) {
180 continue;
181 }
182 const properties = this.getEdgeProperties(label, uuid, data);
183 const edge: StoredEdge = {
184 "@type": "Edge",
185 id,
186 properties,
187 inV,
188 outV,
189 };
190 this.#edgeIdentities.set(data, edge);
191 yield edge;
192 }
193 }
194 }
195 }
196
197 public *getIncomingEdges(vertexId: ElementId): Iterable<StoredEdge> {
198 const [label, uuid] = parseElementId(vertexId);

Callers

nothing calls this directly

Calls 3

getEdgeCollectionMapMethod · 0.95
getEdgePropertiesMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected