MCPcopy
hub / github.com/TheAlgorithms/JavaScript / kosaraju

Method kosaraju

Graphs/Kosaraju.js:69–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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
83function kosaraju(graph) {

Callers 1

constructorMethod · 0.95

Calls 4

dfsKosarajuMethod · 0.95
popMethod · 0.45
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected