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

Method getOutgoingEdges

packages/y-graph-storage/src/YGraphStorage.ts:217–235  ·  view source on GitHub ↗
(vertexId: ElementId)

Source from the content-addressed store, hash-verified

215 }
216
217 public *getOutgoingEdges(vertexId: ElementId): Iterable<StoredEdge> {
218 const [label, uuid] = parseElementId(vertexId);
219 const collection = this.getVertexCollectionMap(label);
220 const data = collection.get(uuid);
221 if (data == null) {
222 return;
223 }
224 const outgoingEdges = data.get($OutEKey) as undefined | Y.Map<unknown>;
225 if (outgoingEdges == null) {
226 return;
227 }
228 for (const edgeId of outgoingEdges.keys() as IterableIterator<ElementId>) {
229 const edge = this.getEdgeById(edgeId);
230 if (edge == null) {
231 continue;
232 }
233 yield edge;
234 }
235 }
236
237 public addVertex(vertex: StoredVertex): void {
238 const [label, uuid] = parseElementId(vertex.id);

Callers

nothing calls this directly

Calls 4

getEdgeByIdMethod · 0.95
parseElementIdFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected