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

Method constructor

Graphs/Kosaraju.js:12–21  ·  view source on GitHub ↗
(graph)

Source from the content-addressed store, hash-verified

10
11class Kosaraju {
12 constructor(graph) {
13 this.connections = {}
14 this.reverseConnections = {}
15 this.stronglyConnectedComponents = []
16 for (const [i, j] of graph) {
17 this.addEdge(i, j)
18 }
19 this.topoSort()
20 return this.kosaraju()
21 }
22
23 addNode(node) {
24 // Function to add a node to the graph (connection represented by set)

Callers

nothing calls this directly

Calls 3

addEdgeMethod · 0.95
topoSortMethod · 0.95
kosarajuMethod · 0.95

Tested by

no test coverage detected