by Samy (Kondasamy Jayaraman)

Module 58 · Finding the way

Intermediate

How a map app picks your route

To the app, a town is junctions joined by roads, each with its minutes. Here you close roads in Larkspur’s toy town, run Dijkstra and A* across it a step at a time, and jam the ring road to watch the van reroute.

Read as

The whole idea in one example

The depot to Orchard

Fewest roads

slower

22 min

7 roads, straight through the slow market streets.

Fewest minutes

quickest

19 min

9 roads, round the fast ring road.

A hand-made town: the junctions, roads and minutes are Larkspur’s stand-ins, not a map. The searches run for real.

How it works

Four ideas carry the module

  1. 1 A map is a graph

    Junctions joined by roads, each with its minutes

  2. 2 Nearest first

    Dijkstra settles the junction nearest the depot, again and again

    Dijkstra (1959) adds points one at a time to the set whose shortest path from the start is known, in order of rising distance, until the goal joins it.

    Source, checked 30 October 2026

  3. 3 Lean toward the goal

    A* adds a guess of the minutes left, and looks at less

    Hart, Nilsson and Raphael (1968) prove that A* finds a cheapest path whenever its guess never exceeds the true cost left, and suggest the straight-line distance for cities joined by roads.

    Source, checked 30 October 2026

  4. 4 Traffic changes the minutes

    A jam or a closure changes the roads; the search stays the same

    Google Maps’ route-planning docs (checked 2026-10-30) ignore current traffic by default, which replies fastest; asked to, the service takes current traffic into account.

    Source, checked 30 October 2026

The story

Larkspur’s delivery van

Larkspur Supply Co.’s delivery van crosses town each morning; you close roads, jam the ring road and watch the app find the way. You’re on the team that runs deliveries.

30
junctions in Larkspur’s hand-made town
44
roads between them, each with hand-set minutes
6
drops in chapter 7’s delivery day
1
setting wins chapter 7’s rule

Your path

The chapters

  1. Chapter 1

    Roads as a graph

    What does a map look like to the app?

  2. Chapter 2

    Fewest roads or fewest minutes

    Is the route with the fewest roads also the quickest?

  3. Chapter 3

    Dijkstra: nearest first

    In what order does Dijkstra’s algorithm settle the town?

  4. Chapter 4

    A*: lean toward the goal

    How can a search look at fewer junctions and still find the quickest way?

  5. Chapter 5

    Live traffic

    What changes inside the app when a road jams?

  6. Chapter 6

    Whole-country maps

    How does a map app answer fast on a map that big?

  7. Chapter 7

    Plan the delivery day

    Which search keeps every drop quick while looking at the fewest junctions?

Who it’s for

  • Engineers
  • Product managers
  • Analysts
  • No code needed

Anyone whose product plans deliveries, shows a map or prices a trip, and wants to know how the route is found and why it changes. No background needed; the maths stays optional.