Quantcast
Channel: How does Dijkstra's Algorithm and A-Star compare? - Stack Overflow
Viewing all articles
Browse latest Browse all 13

Answer by dharm0us for How does Dijkstra's Algorithm and A-Star compare?

$
0
0

If you look at the psuedocode for Astar :

foreach y in neighbor_nodes(x)
             if y in closedset
                 continue

Whereas, if you look at the same for Dijkstra :

for each neighbor v of u:         
             alt := dist[u] + dist_between(u, v) ;

So, the point is, Astar will not evaluate a node more than once,
since it believes that looking at a node once is sufficient, due
to its heuristics.

OTOH, Dijkstra's algorithm isn't shy of correcting itself, in case
a node pops up again.

Which should make Astar faster and more suitable for path finding.


Viewing all articles
Browse latest Browse all 13

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>