File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 92
92
* var shortestDist = dijkstra(0, 2, distMatrix); // 9
93
93
*/
94
94
return function ( src , dest , graph ) {
95
- var tempDistance = 0 ;
95
+ var tempDistance = 0 ;
96
96
init ( src , graph ) ;
97
97
while ( current . node !== dest && isFinite ( current . distance ) ) {
98
98
for ( var i = 0 ; i < graph . length ; i += 1 ) {
99
99
if ( current . node !== i && //if it's not the current node
100
100
! visited [ i ] && //and if we haven't visited this node
101
101
//and this node is sibling of the current...
102
102
Number . isFinite ( graph [ i ] [ current . node ] ) ) {
103
-
103
+
104
104
tempDistance = current . distance + graph [ i ] [ current . node ] ;
105
105
if ( tempDistance < distance [ i ] . distance ) {
106
106
distance [ i ] . distance = tempDistance ;
107
- current . distance = tempDistance ;
108
107
unvisited . update ( current ) ;
109
108
}
110
109
}
You can’t perform that action at this time.
0 commit comments