From 196f0185f975c10e47e3d0e596f3cb39261616d5 Mon Sep 17 00:00:00 2001 From: jatin0004 <63697024+jatin0004@users.noreply.github.com> Date: Wed, 13 Oct 2021 01:40:45 +0530 Subject: [PATCH 1/2] explanation updated --- src/algorithms/graph/bellman-ford/bellmanFord.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/graph/bellman-ford/bellmanFord.js b/src/algorithms/graph/bellman-ford/bellmanFord.js index 70e811d9..fec13a84 100644 --- a/src/algorithms/graph/bellman-ford/bellmanFord.js +++ b/src/algorithms/graph/bellman-ford/bellmanFord.js @@ -8,7 +8,7 @@ export default function bellmanFord(graph, startVertex) { const previousVertices = {}; // Init all distances with infinity assuming that currently we can't reach - // any of the vertices except start one. + // any of the vertices except start one and try to get to that point. distances[startVertex.getKey()] = 0; graph.getAllVertices().forEach((vertex) => { previousVertices[vertex.getKey()] = null; From 42b00c3363c2c360e666047660ef9dd11b7d098c Mon Sep 17 00:00:00 2001 From: jatin0004 <63697024+jatin0004@users.noreply.github.com> Date: Wed, 13 Oct 2021 01:43:57 +0530 Subject: [PATCH 2/2] mst explain --- src/algorithms/graph/prim/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/graph/prim/README.md b/src/algorithms/graph/prim/README.md index 49061a27..fe4436a8 100644 --- a/src/algorithms/graph/prim/README.md +++ b/src/algorithms/graph/prim/README.md @@ -1,7 +1,7 @@ # Prim's Algorithm In computer science, **Prim's algorithm** is a greedy algorithm that -finds a minimum spanning tree for a weighted undirected graph. +finds a minimum spanning tree(shortest distance to reach every node) for a weighted undirected graph. The algorithm operates by building this tree one vertex at a time, from an arbitrary starting vertex, at each step adding