r/programming • u/hazadess • Apr 23 '13
PathFinding algorithm, visually explained
http://qiao.github.io/PathFinding.js/visual/
2.2k
Upvotes
r/programming • u/hazadess • Apr 23 '13
View all comments
7
u/Uberhipster Apr 24 '13
For complex ambiguous problems it appears Best-first takes less time (9ms) to find a longer path (128.28) than Jump point (11ms, 109.46)
http://imgur.com/a/oXIZi
In this example, using Best-first saves ~20% in computation time but adds ~17% to the length...
So if the computation time cost vs. path travel cost ratio is heavily in favor of path travel cost, Best-first produces a "better" solution.
To take a clear cut albeit banal example: if there are a million nodes (1000x1000 grid) and the cost of traveling node to node is a nanosecond than Best-first produces a better time saving solution because the travel time will be only 0.2ms higher but the computation time will be 2ms lower.