How Google Maps Solves Traffic: Dijkstra's Algorithm

AI-generated illustrated lesson. Hand-drawn and narrated, step by step.

How Google Maps Solves Traffic: Dijkstra's Algorithm

Have you ever wondered how Google Maps instantly finds the fastest route out of millions of possibilities? To do this, it first strips away all the buildings and trees, turning the entire city into a giant spiderweb.

In computer science, we call this web a graph. Intersections where you can turn become circles called nodes, while the roads connecting them are drawn as lines called edges.

But not all roads are equal. To represent travel times, we assign a number to each edge called a weight; a highway might get a low weight of 5 minutes, while a congested downtown street gets a heavy weight of 15.

Premium unlocks the full lesson — watch it in My Magic Pencil.

▶ Watch on My Magic Pencil