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

Method dfsTopoSort

Graphs/Kosaraju.js:42–48  ·  view source on GitHub ↗
(node, visited)

Source from the content-addressed store, hash-verified

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

Callers 1

topoSortMethod · 0.95

Calls 3

addMethod · 0.45
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected