explanation updated

This commit is contained in:
jatin0004 2021-10-13 01:40:45 +05:30 committed by GitHub
parent 4548296aff
commit 196f0185f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ export default function bellmanFord(graph, startVertex) {
const previousVertices = {}; const previousVertices = {};
// Init all distances with infinity assuming that currently we can't reach // 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; distances[startVertex.getKey()] = 0;
graph.getAllVertices().forEach((vertex) => { graph.getAllVertices().forEach((vertex) => {
previousVertices[vertex.getKey()] = null; previousVertices[vertex.getKey()] = null;