| 62 | new Map(Array.from(graph, ([, node]) => [node.id, node.label])) |
| 63 | |
| 64 | const graphEdgeKeys = <E, T extends Graph.Kind>(graph: Graph.Graph<SetNode, E, T>) => { |
| 65 | const nodeIds = new Map(Array.from(graph, ([index, node]) => [index, node.id])) |
| 66 | return new Set( |
| 67 | Array.from(Graph.edges(graph), ([, edge]) => |
| 68 | graph.type === "directed" |
| 69 | ? `${nodeIds.get(edge.source)}->${nodeIds.get(edge.target)}` |
| 70 | : `${nodeIds.get(edge.source)}--${nodeIds.get(edge.target)}`) |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | const graphEdgeData = <E, T extends Graph.Kind>(graph: Graph.Graph<SetNode, E, T>) => { |
| 75 | const nodeIds = new Map(Array.from(graph, ([index, node]) => [index, node.id])) |