You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/src/jsgraphs.js b/src/jsgraphs.js
index 5409240..1392673 100644
--- a/src/jsgraphs.js+++ b/src/jsgraphs.js@@ -936,7 +936,7 @@ var jsgraphs = jsgraphs || {};
this.edgeTo = [];
this.cost = [];
this.pq = new jss.IndexMinPQ(V, function(cost1, cost2){
- return cost1, cost2;+ return cost1 - cost2;
});
for(var v =0; v < V; ++v){
The text was updated successfully, but these errors were encountered:
cxcorp
changed the title
Typo in Dijkstra's priority queue comparison function
Typo in Dijkstra's priority queue comparison function breaks Dijkstra
Jul 10, 2024
When creating the min priority queue, the Dijkstra function passes in
return cost1, cost2
as the function, causing it to always returncost2
:js-graph-algorithms/src/jsgraphs.js
Lines 938 to 940 in 01b5235
It should probably be
cost1 - cost2
, like:The text was updated successfully, but these errors were encountered: