YouTLDR SummaryAuto transcript
contraction hierarchy
Google Maps uses a customizable contraction hierarchy. It pre-processes road networks to rank intersections by importance, then uses a bidirectional search up this hierarchy for speed. This is 35,000x faster than Dijkstra's algorithm for long routes.
- πΊοΈ The core algorithm is still based on Dijkstra's, a 70-year-old invention.
- π A-star, a variation of Dijkstra's, uses heuristics to prioritize nodes closer to the target, improving speed but not always for travel time.
- βοΈ Bidirectional Dijkstra searches from both the start and end points simultaneously, reducing the search area by half.
- π Road networks have a hierarchy (highways vs. local roads) that basic algorithms ignore, leading to inefficiencies.
- β³ Pre-processing the network into a hierarchy takes hours but makes subsequent searches nearly instantaneous.
A map with a winding blue route connecting two red location pins, with the word 'How?' prominently displayed.