Shortest path, step by step
Tap a town to make it the start, then tap another to make it the end. Now press Step. Each press picks the unsettled town with the smallest label, settles it, and uses its roads to improve the labels of its neighbours. A label is the length of the best route found so far. Before each press, guess which town will be settled next. When the end is settled, the shortest route lights up.
What's going on
The number on each road is its length. The number inside each town is its label: the length of the shortest route from the start that has been found so far. At the beginning the start has label 0 and every other town has label ∞, meaning "no route found yet".
One step does two things. First, look at every town that is not yet settled and pick the one with the smallest label. Settle it: its label is now final. Second, for each road out of that town, add the road's length to the town's label. If that total beats the neighbour's label, the neighbour gets the smaller label and remembers which town it came from.
Why is the smallest label final? Suppose the smallest unsettled label is 8, at town D. Any other route to D has to leave the settled towns somewhere, and the first unsettled town it reaches already has a label of at least 8. Roads never have negative length, so the route can only get longer from there. Nothing can beat 8, so the method never has to go back and change its mind.
This is Dijkstra's method, found by Edsger Dijkstra in 1956. Map apps use faster versions of the same idea. Try the map called "Fewest roads is not shortest": the route with the fewest roads loses to a route with more of them.