(id: ElementId)
| 359 | } |
| 360 | |
| 361 | public deleteEdge(id: ElementId): void { |
| 362 | const [label, uuid] = parseElementId(id); |
| 363 | const collection = this.getEdgeCollectionMap(label); |
| 364 | const data = collection.get(uuid); |
| 365 | if (data == null) { |
| 366 | throw new EdgeNotFoundError(id); |
| 367 | } |
| 368 | // inV is the target, outV is the source |
| 369 | const inV = data.get($InVKey) as ElementId; |
| 370 | const outV = data.get($OutVKey) as ElementId; |
| 371 | const inVMap = this.getVertexMap(inV); |
| 372 | const outVMap = this.getVertexMap(outV); |
| 373 | this.transact(() => { |
| 374 | // Remove from target's incoming edges |
| 375 | const incomingEdges = inVMap.get($InEKey) as undefined | Y.Map<unknown>; |
| 376 | incomingEdges?.delete(id); |
| 377 | // Remove from source's outgoing edges |
| 378 | const outgoingEdges = outVMap.get($OutEKey) as undefined | Y.Map<unknown>; |
| 379 | outgoingEdges?.delete(id); |
| 380 | collection.delete(uuid); |
| 381 | }); |
| 382 | } |
| 383 | |
| 384 | protected getVertexMap(vertexId: ElementId): Y.Map<unknown> { |
| 385 | const [label, uuid] = parseElementId(vertexId); |
nothing calls this directly
no test coverage detected