| 838 | |
| 839 | /** @internal */ |
| 840 | const addEdgeByIdentity = <N, E, T extends Kind, NI, EI>( |
| 841 | mutable: MutableGraph<N, E, T>, |
| 842 | indexByIdentity: MutableHashMap.MutableHashMap<NI, NodeIndex>, |
| 843 | identity: EdgeIdentity<NI, EI>, |
| 844 | data: E |
| 845 | ): void => { |
| 846 | const sourceIndex = Option.getOrUndefined(MutableHashMap.get(indexByIdentity, identity.source)) |
| 847 | const targetIndex = Option.getOrUndefined(MutableHashMap.get(indexByIdentity, identity.target)) |
| 848 | if (sourceIndex !== undefined && targetIndex !== undefined) { |
| 849 | addEdge(mutable, sourceIndex, targetIndex, data) |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | /** @internal */ |
| 854 | const assertSameKind = <N, E>(self: Graph<N, E, Kind>, that: Graph<N, E, Kind>): void => { |