(node, visited)
| 40 | } |
| 41 | |
| 42 | dfsTopoSort(node, visited) { |
| 43 | visited.add(node) |
| 44 | for (const child of this.connections[node]) { |
| 45 | if (!visited.has(child)) this.dfsTopoSort(child, visited) |
| 46 | } |
| 47 | this.topoSorted.push(node) |
| 48 | } |
| 49 | |
| 50 | topoSort() { |
| 51 | // Function to perform topological sorting |