We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f812ecc commit df792e3Copy full SHA for df792e3
astar.js
@@ -17,6 +17,16 @@
17
}
18
})(function() {
19
20
+function pathTo(node){
21
+ var curr = node,
22
+ path = [];
23
+ while(curr.parent) {
24
+ path.push(curr);
25
+ curr = curr.parent;
26
+ }
27
+ return path.reverse();
28
+}
29
+
30
var astar = {
31
init: function(graph) {
32
for (var i = 0, len = graph.nodes.length; i < len; ++i) {
@@ -56,17 +66,6 @@ var astar = {
56
66
57
67
start.h = heuristic(start, end);
58
68
59
- function pathTo(node){
60
- var curr = node;
61
- var path = [];
62
- while(curr.parent) {
63
- path.push(curr);
64
- curr = curr.parent;
65
- }
- return path.reverse();
-
69
70
openHeap.push(start);
71
72
while(openHeap.size() > 0) {
0 commit comments