diff --git a/Graphs/ConnectedComponents.js b/Graphs/ConnectedComponents.js index 2333a545c1..842a2eedcb 100644 --- a/Graphs/ConnectedComponents.js +++ b/Graphs/ConnectedComponents.js @@ -1,4 +1,4 @@ -class GraphUnweightedUndirected { +class GraphUnweightedUndirectedAdjacencyList { // Unweighted Undirected Graph class constructor () { this.connections = {} @@ -46,7 +46,7 @@ class GraphUnweightedUndirected { } function main () { - const graph = new GraphUnweightedUndirected() + const graph = new GraphUnweightedUndirectedAdjacencyList() graph.addEdge(1, 2) // Component 1 graph.addEdge(3, 4) // Component 2 graph.addEdge(3, 5) // Component 2 diff --git a/Graphs/PrimMST.js b/Graphs/PrimMST.js index d38c0f00bd..be1e18c0d0 100644 --- a/Graphs/PrimMST.js +++ b/Graphs/PrimMST.js @@ -163,7 +163,7 @@ class GraphWeightedUndirectedAdjacencyList { } PrimMST (start) { - // Kruskal's Algorithm to generate a Minimum Spanning Tree (MST) of a graph + // Prim's Algorithm to generate a Minimum Spanning Tree (MST) of a graph // Details: https://en.wikipedia.org/wiki/Prim%27s_algorithm const distance = {} const parent = {}