Two roads or five?
transcript
A courier. A customer. Two routes. One has two roads. One has five. Which one is faster? Count the roads, and one answer wins. Count the minutes, and the other wins.
The two road route costs four, then seven. That is eleven minutes. The five road route is quick, one road at a time. It takes only eight minutes.
Dijkstra spreads by cost, not by count. It settles the soonest junction first. Then it relaxes the roads that leave it.
Breadth first search finds the fewest roads. It treats every road as one step. Real roads have different costs. A slow road and a quick road count the same. So the fewest roads can cost more minutes.
Every road the same? Breadth first search. Roads with costs? Dijkstra.
Fewest roads is not fewest minutes. When roads have costs, use Dijkstra. It spreads by minutes, not by roads. Full breakdown in the lecture.