Skip to content

Commit 4f497dd

Browse files
committed
Update isFinite check
1 parent 626374c commit 4f497dd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/graphs/shortest-path/dijkstra.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var dijstra = function () {
9292
return function (src, dest, graph) {
9393
var tempDistance = 0;
9494
init(src, graph);
95-
while (current.node != dest && current.distance != Infinity) {
95+
while (current.node !== dest && isFinite(current.distance)) {
9696
for (var i = 0; i < graph.length; i += 1) {
9797
if (current.node !== i && //if it's not the current node
9898
!visited[i] && //and if we haven't visited this node

0 commit comments

Comments
 (0)