| 826 | |
| 827 | /** @internal */ |
| 828 | const addNodesByIdentity = <N, E, T extends Kind, NI>( |
| 829 | mutable: MutableGraph<N, E, T>, |
| 830 | nodes: Iterable<readonly [NI, N]> |
| 831 | ): MutableHashMap.MutableHashMap<NI, NodeIndex> => { |
| 832 | const indexByIdentity = MutableHashMap.empty<NI, NodeIndex>() |
| 833 | for (const [identity, data] of nodes) { |
| 834 | MutableHashMap.set(indexByIdentity, identity, addNode(mutable, data)) |
| 835 | } |
| 836 | return indexByIdentity |
| 837 | } |
| 838 | |
| 839 | /** @internal */ |
| 840 | const addEdgeByIdentity = <N, E, T extends Kind, NI, EI>( |