User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
algorithm:dijkstras [2016/06/11 15:15]
will Working viz
algorithm:dijkstras [2016/06/28 22:59]
will Fix showing incorrect highlighted edge.
Line 274: Line 274:
     ​     ​
     var distances = x.lookupInScope("​distances"​) || x.lookupInScope("​result"​);​     var distances = x.lookupInScope("​distances"​) || x.lookupInScope("​result"​);​
-    var sourceNode = x.lookupInScope("​source"​);​+    var sourceNode = x.lookupInScope("​source"​) ​|| nodes[0];
     ​     ​
     // Update nodes.     // Update nodes.
Line 301: Line 301:
     // Highlight current edge.     // Highlight current edge.
     var i = x.lookupInScope("​i"​);​     var i = x.lookupInScope("​i"​);​
 +    var inInnerLoop = n && n.lineno >= 17 && n.lineno <= 28;
     var link = svg.selectAll("​line"​).data(links);​     var link = svg.selectAll("​line"​).data(links);​
     link.classed("​checking",​ function(d) {     link.classed("​checking",​ function(d) {
-        return (typeof i === "​number"​ && currentNode && currentNode.edges.length > i) &&+        return (typeof i === "​number" ​&& inInnerLoop ​&& currentNode && currentNode.edges.length > i) &&
             (currentNode.edges[i] === d || currentNode.edges[i].inverse === d);             (currentNode.edges[i] === d || currentNode.edges[i].inverse === d);
     });     });
algorithm/dijkstras.txt · Last modified: 2016/06/28 22:59 by will