title: What algorithms compute directions from point A to point B on a map?
body: <p>How do map providers (such as Google or Yahoo! Maps) suggest directions?</p>
  
  <p>I mean, they probably have real-world data in some form, certainly including distances but also perhaps things like driving speeds, presence of sidewalks, train schedules, etc.  But suppose the data were in a simpler format, say a very large directed graph with edge weights reflecting distances.  I want to be able to quickly compute directions from one arbitrary point to another.  Sometimes these points will be close together (within one city) while sometimes they will be far apart (cross-country).</p>
  
  <p>Graph algorithms like Dijkstra's algorithm will not work because the graph is enormous.  Luckily, heuristic algorithms like A* will probably work.  However, our data is very structured, and perhaps some kind of tiered approach might work?  (For example, store precomputed directions between certain "key" points far apart, as well as some local directions.  Then directions for two far-away points will involve local directions to a key points, global directions to another key point, and then local directions again.)</p>
  
  <p>What algorithms are actually used in practice?</p>
  
  <p>PS.  This question was motivated by finding quirks in online mapping directions.  Contrary to the triangle inequality, sometimes Google Maps thinks that <a href="http://maps.google.com/maps?f=d&amp;saddr=Place+Jacques+Bonsergent,+75010+Paris&amp;daddr=Place+Louis+Lepine,+75004+Paris&amp;hl=en&amp;geocode=&amp;mra=ls&amp;dirflg=w&amp;sll=48.861295,2.35161&amp;sspn=0.013778,0.029655&amp;ie=UTF8&amp;z=14" rel="noreferrer" title="Place Jacques Bonsergent - Place Louis Lepine">X-Z</a> takes longer and is farther than using an intermediate point as in <a href="http://maps.google.com/maps?f=d&amp;saddr=Place+Jacques+Bonsergent,+75010+Paris&amp;daddr=Square+Emile+Chautemps,+75003+Paris+to:Place+Louis+Lepine,+75004+Paris&amp;hl=en&amp;geocode=&amp;mra=ls&amp;dirflg=w&amp;sll=48.869359,2.357833&amp;sspn=0.006888,0.014827&amp;ie=UTF8&amp;z=14" rel="noreferrer" title="via Square Emile Chautemps">X-Y-Z</a>.  But maybe their walking directions optimize for another parameter, too?</p>
  
  <p>PPS.  Here's another violation of the triangle inequality that suggests (to me) that they use some kind of tiered approach: <a href="http://maps.google.com/maps?f=d&amp;saddr=214,+boulevard+de+la+Villette,+75019+Paris&amp;daddr=Passage+des+Patriarches,+75005+Paris&amp;hl=en&amp;geocode=&amp;sll=48.86278,2.35595&amp;sspn=0.05511,0.118618&amp;mra=cc&amp;dirflg=w&amp;ie=UTF8&amp;z=13" rel="noreferrer" title="214, boulevard de la Villette - Passages des Patriarches">X-Z</a> versus <a href="http://maps.google.com/maps?f=d&amp;saddr=214,+boulevard+de+la+Villette,+75019+Paris&amp;daddr=Square+Emile+Chautemps,+75003+Paris+to:Passage+des+Patriarches,+75005+Paris&amp;hl=en&amp;geocode=&amp;mra=ls&amp;dirflg=w&amp;sll=48.86278,2.35595&amp;sspn=0.05511,0.118618&amp;ie=UTF8&amp;ll=48.862682,2.357941&amp;spn=0.05511,0.118618&amp;z=13" rel="noreferrer" title="via Square Emile Chautemps">X-Y-Z</a>.  The former seems to use prominent Boulevard de Sebastopol even though it's slightly out of the way.</p>
  
  <p><strong>Edit</strong>: Neither of these examples seem to work anymore, but both did at the time of the original post.</p>