Algorithms & Distributed Systems · 4 min
How Google Maps Works: Contraction Hierarchies, S2 Geometry, and Graph Neural Networks
From Edsger Dijkstra's twenty-minute Amsterdam café algorithm to Contraction Hierarchies, Hilbert curves on S2 spheres, and DeepMind's Graph Neural Networks for future traffic forecasting.
01 · Foundations
From a twenty-minute café idea to combinatorial explosion
Planetary navigation begins by abstracting asphalt and concrete into a weighted mathematical graph: intersections and roundabouts become nodes, road segments become edges, and travel times become edge weights. In 1956, Dutch computer scientist Edsger Dijkstra sketched the canonical shortest-path algorithm for that graph in roughly twenty minutes while having coffee with his fiancée at an Amsterdam café.
Dijkstra's algorithm radiates outward from the origin like ripples across a pond, guaranteeing the mathematically optimal path. Across a small neighborhood, that symmetry is effortless. Across a continental road network containing hundreds of millions of vertices, searching radially from New York to Los Angeles wastes vast compute scanning dead-end cul-de-sacs and rural backroads in every wrong direction.
A* search trims that waste by adding a geometric heuristic, f(n) = g(n) + h(n), combining actual distance traveled with a straight-line Euclidean estimate toward the destination. Yet whenever coastlines, mountain ranges, rivers, or congested metro rings force detours, A* still expands far too many redundant nodes to serve billions of live queries within milliseconds.
- Representing physical geography as a weighted graph remains the enduring core; modern routing layers speed and prediction onto Dijkstra rather than discarding it.
- Pure runtime graph search hits a memory-bandwidth wall when millions of concurrent drivers request dynamic recalculations.
02 · Hierarchy
Contraction Hierarchies: precomputing the highway skeleton
Developed in the mid-2000s, Contraction Hierarchies (CH) solved continental latency by splitting pathfinding into heavy offline preprocessing and featherweight live queries. Rather than inspecting every street each time a user taps "Directions," the preprocessing pipeline ranks intersections by structural importance—placing residential turnarounds near the bottom and major interstate interchanges at the top.
Nodes are then systematically "contracted" from lowest to highest importance. Whenever removing a local node disrupts a shortest path between two remaining neighbors, the algorithm inserts a direct shortcut edge storing the exact precomputed cost. When a live driver asks for a route, two tiny searches run simultaneously—one climbing strictly upward in importance from the origin, and one climbing upward from the destination—until they meet along the upper highway spine.
Because queries only traverse upward shortcuts and are laid out for CPU cache locality, continental routes that once required inspecting millions of intersections collapse to a few hundred node evaluations in a fraction of a millisecond.
- Precomputed shortcut hierarchies move expensive graph exploration offline so interactive queries stay sub-millisecond.
- Deterministic hardware-friendly memory layouts echo the latency discipline behind compiler-scheduled inference accelerators.
03 · Indexing
S2 geometry, Hilbert curves, and urban-canyon map matching
Routing algorithms are useless until real-world latitude and longitude coordinates can be indexed and matched to road geometry at scale. To avoid slow spherical trigonometry during billions of spatial lookups, Google built the S2 Geometry library. S2 projects the curved Earth onto the six faces of a cube and threads a continuous 1D Hilbert space-filling curve across every face, subdividing space from Level 0 hemispheres down to Level 30 cells smaller than a centimeter.
Because Hilbert curves preserve spatial locality—points close in 2D space generally stay close along the 1D curve—nearby intersections, businesses, and live traffic probes collapse into ultra-fast 1D integer range lookups.
Ingesting live telemetry from billions of smartphones introduces another physical headache: GPS multipath errors inside steel-and-glass "urban canyons," where satellite signals bounce off skyscrapers and scatter position estimates across parallel streets. A Map Matching pipeline based on Hidden Markov Models combines raw position pings with velocity, heading, and legal turn topology to snap noisy coordinates onto the single physically coherent road segment—solving a geometric inference problem closely related to acoustic localization from noisy physical sensors.
04 · Forecasting
DeepMind Graph Neural Networks and proactive traffic routing
Knowing how fast cars are moving at the moment of departure still produces wrong ETAs on any trip longer than fifteen minutes, because traffic conditions mutate before a driver reaches the highway bottleneck. In partnership with Google DeepMind, Google Maps transitioned ETA forecasting from static lookup heuristics to Graph Neural Networks (GNNs).
Road traffic is inherently relational: a stalled merge on an off-ramp ripples backward along the expressway and spills onto surface arterials. Google groups strongly correlated road links into Supersegments and feeds live probe speeds alongside time-of-day historical baselines into a GNN architecture. Through iterative message passing between adjacent road segments, the model learns how shockwaves of congestion form, intensify, and dissipate 10 to 50 minutes ahead of real time.
Rather than reacting after a driver hits brake lights, the routing engine updates future edge weights along each leg of the journey before departure—turning planetary navigation from static geometry into continuous spatiotemporal forecasting alongside systems like autonomous maritime routing and large-scale predictive AI.
Connected notes & backlinks
Bidirectional references across the research vault. Hover inline [[wikilinks]] above to preview notes, or inspect this note’s neighborhood in the interactive graph.
- AI Systems2 min
CS153 Frontier Systems: AI as a Utility
§ Scale · Systems break differently when the graph becomes exponential
“At frontier scale, AI becomes engineering under compounding stress, much like scaling autonomous fleets in physical environments or routing billions of live map queries. Training, inference, compute procurement, reliability, capital, and organizational conviction are part of the same system, where small assumptions fail in nonlinear ways.”
- AI Infrastructure6 min
Jonathan Ross & Groq: Deterministic Compute and the Speed of Thought
§ Reasoning · AlphaGo's Move 37 and why inference speed changes intelligence
“Low latency is easily dismissed as mere interface polish once tokens stream faster than a human can read. That assumption collapses as soon as the consumer of model output is another piece of software. In multi-step agent loops—where a planner calls search, executes code, invokes verification sub-models, and revises its output—even modest delays compound multiplicatively across serial steps. Ross traces this intuition back to DeepMind's 2016 match between AlphaGo and Lee Sedol. Shortly before the match, DeepMind ported AlphaGo onto Google's early TPUs. Because faster hardware allowed the search tree to evaluate deeper continuations within the same clock budget, the system uncovered Game 2's famous Move 37—a move a slower hardware setup failed to reach in time. Faster silicon did not alter the trained weights; it expanded how thoroughly the algorithm could explore the decision tree before committing. Modern test-time compute follows the same rule. When models spend inference cycles branching, sampling, verifying, and self-correcting—much like the real-time traversal budgets inside planetary routing engines—compute speed stops being cosmetic. It converts raw clock cycles into higher-quality judgment.”
- Signal Processing & Physics5 min
Acoustic Geolocation: Pinpointing a Camera on Earth from Aircraft Doppler Curves
§ Pruning · Delayed 3D slant distance and the fifteen-minute silence filter
“Because each aircraft pass spans nearly two minutes, timestamps are anchored to the Closest Point of Approach (CPA)—the steepest inflection point where radial velocity flips sign. Laying a 200-meter search grid within 10 kilometers of candidate tracks immediately hits two physical corrections: acoustic propagation delay and terrain elevation. Sound travels at roughly 343 m/s, meaning a plane passing 3 to 5 kilometers away reaches the microphone 9 to 15 seconds late; the spectrogram logs the delayed arrival time, not the physical CPA. Furthermore, ADS-B transponders broadcast barometric altitude above sea level rather than ground height, requiring a nationwide USGS Digital Elevation Model (DEM) to compute the true 3D slant distance: the square root of the horizontal distance squared plus the height difference squared. Even a 920-second gap left tens of thousands of points inside a tiny test region. Two aggressive physical filters—echoing the spatial pruning inside large-scale map indexing—cut the entire country down to size: total frequency drop bounds aircraft speed (about 100 m/s) and CPA steepness bounds slant distance, narrowing the continent to 73,000 airport-clustered points. A silence filter then disqualified any coordinate that would have heard another aircraft during the 15-minute quiet gap between passes, collapsing candidates to 15,000 rural-suburban points.”
Jonathan Ross & Groq: Deterministic Compute and the Speed of Thought
How Groq rethought silicon around compiler-scheduled determinism and on-chip SRAM, why inference latency changes reasoning quality, and how a chip startup weeks from running out of cash ended up licensing its architecture to NVIDIA.
Referenced via [[compiler-scheduled inference accelerators]] in § Hierarchy
Acoustic Geolocation: Pinpointing a Camera on Earth from Aircraft Doppler Curves
How an inaudible 60–400 Hz airplane hum in a video's audio track can be inverted against 50 gigabytes of public ADS-B flight telemetry and retarded-time wave physics to locate a camera within 100 meters.
Referenced via [[acoustic localization from noisy physical sensors]] in § Indexing
The SpaceX of the Ocean: Ulysses
A maritime robotics note on autonomous underwater vehicles, modular fleets, ecological restoration, infrastructure inspection, and the ocean as an under-instrumented platform.
Referenced via [[autonomous maritime routing]] in § Forecasting
CS153 Frontier Systems: AI as a Utility
A synthesis of Sam Altman's CS153 themes: AI as infrastructure, the product journey from model to interface, scaling as systems engineering, and the societal stakes of cheap intelligence.
Referenced via [[large-scale predictive AI]] in § Forecasting
Editorial record
Sources and methodology
This systems analysis connects algorithmic routing fundamentals covered in Veritasium's technical deep dive with Google DeepMind's published research on Graph Neural Networks and the S2 Geometry specification.
- 01How Does Google Maps Actually Work?
Veritasium
secondary
Accessed November 16, 2026
- 02Traffic prediction with advanced Graph Neural Networks
Google DeepMind
primary
Accessed November 16, 2026
- 03S2 Geometry Library Overview
Google S2 Geometry
primary
Accessed November 16, 2026