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

Method getEdgeById

packages/y-graph-storage/src/YGraphStorage.ts:129–152  ·  view source on GitHub ↗
(id: ElementId)

Source from the content-addressed store, hash-verified

127 }
128
129 public getEdgeById(id: ElementId): StoredEdge | undefined {
130 const [label, uuid] = parseElementId(id);
131 const collection = this.getEdgeCollectionMap(label);
132 const data = collection.get(uuid);
133 if (data == null) {
134 return undefined;
135 }
136 const existing = this.#edgeIdentities.get(data);
137 if (existing != null) {
138 return existing;
139 }
140 const inV = data.get($InVKey) as ElementId | undefined;
141 if (inV == null) {
142 return undefined;
143 }
144 const outV = data.get($OutVKey) as ElementId | undefined;
145 if (outV == null) {
146 return undefined;
147 }
148 const properties = this.getEdgeProperties(label, uuid, data);
149 const edge: StoredEdge = { "@type": "Edge", id, properties, inV, outV };
150 this.#edgeIdentities.set(data, edge);
151 return edge;
152 }
153
154 public *getEdgesByIds(ids: ElementId[]): Iterable<StoredEdge> {
155 for (const id of ids) {

Callers 3

getEdgesByIdsMethod · 0.95
getIncomingEdgesMethod · 0.95
getOutgoingEdgesMethod · 0.95

Calls 4

getEdgeCollectionMapMethod · 0.95
getEdgePropertiesMethod · 0.95
parseElementIdFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected