[GIS] the difference between Astar and Dijkstra algorithms in Pgrouting

pgrouting

I would like to know what is the difference between A* algorithm and Dijkstra at finding the shortest path at pgrouting.

Which one is faster ,has better performance and returns better results.

Also i would like to know if it is possible for pgrouting to take into account that a road is one way when it computes the shortest path thus not traversing it

Sorry for my english
thanks in advance john

Best Answer

A* is a generalised form of the Dijkstra search algorith. There are good descriptions of both on Wikipedia (A*, Dijkstra) including nice graphical representations.

Essentially A* is faster, and will find the "best" solution given some reasonable assumptions. Dijkstra (i.e. A* without heuristic) is better conditioned. I usually choose Dijkstra until the problem space grows too large and I need something faster.

For the one-way question, just see the documentation on this aspect of pgRouting.

Related Question