mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
explanation updated
This commit is contained in:
parent
4548296aff
commit
196f0185f9
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user