Small Tweaks/Fixes (#235)

This commit is contained in:
Tapajyoti Bose
2020-08-01 09:11:19 +05:30
committed by GitHub
parent fd414e2d05
commit df58a7ed5f
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
class GraphUnweightedUndirected { class GraphUnweightedUndirectedAdjacencyList {
// Unweighted Undirected Graph class // Unweighted Undirected Graph class
constructor () { constructor () {
this.connections = {} this.connections = {}
@ -46,7 +46,7 @@ class GraphUnweightedUndirected {
} }
function main () { function main () {
const graph = new GraphUnweightedUndirected() const graph = new GraphUnweightedUndirectedAdjacencyList()
graph.addEdge(1, 2) // Component 1 graph.addEdge(1, 2) // Component 1
graph.addEdge(3, 4) // Component 2 graph.addEdge(3, 4) // Component 2
graph.addEdge(3, 5) // Component 2 graph.addEdge(3, 5) // Component 2

View File

@ -163,7 +163,7 @@ class GraphWeightedUndirectedAdjacencyList {
} }
PrimMST (start) { 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 // Details: https://en.wikipedia.org/wiki/Prim%27s_algorithm
const distance = {} const distance = {}
const parent = {} const parent = {}