MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / addNode

Method addNode

Graphs/Kosaraju.js:23–28  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

21 }
22
23 addNode(node) {
24 // Function to add a node to the graph (connection represented by set)
25 this.connections[node] = new Set()
26 this.reverseConnections[node] = new Set()
27 this.topoSorted = []
28 }
29
30 addEdge(node1, node2) {
31 // Function to add an edge (adds the node too if they are not present in the graph)

Callers 1

addEdgeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected