This commit is contained in:
EricVincon 2024-09-18 15:02:07 -03:00
parent ca3d16dcce
commit 4d64921e7c

View File

@ -7,7 +7,7 @@ export default function bellmanFord(graph, startVertex) {
const distances = {}; const distances = {};
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.
distances[startVertex.getKey()] = 0; distances[startVertex.getKey()] = 0;
graph.getAllVertices().forEach((vertex) => { graph.getAllVertices().forEach((vertex) => {