Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.