(node)
| 21 | } |
| 22 | |
| 23 | addNode(node) { |
| 24 | // Function to add a node to the graph (connection represented by set) |
| 25 | this.connections[node] = new Set() |
| 26 | this.reverseConnections[node] = new Set() |
| 27 | this.topoSorted = [] |
| 28 | } |
| 29 | |
| 30 | addEdge(node1, node2) { |
| 31 | // Function to add an edge (adds the node too if they are not present in the graph) |