()
| 67 | } |
| 68 | |
| 69 | kosaraju() { |
| 70 | // Function to perform Kosaraju Algorithm |
| 71 | const visited = new Set() |
| 72 | while (this.topoSorted.length > 0) { |
| 73 | const node = this.topoSorted.pop() |
| 74 | if (!visited.has(node)) { |
| 75 | this.stronglyConnectedComponents.push([]) |
| 76 | this.dfsKosaraju(node, visited) |
| 77 | } |
| 78 | } |
| 79 | return this.stronglyConnectedComponents |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | function kosaraju(graph) { |
no test coverage detected