Mental Model
We find the shortest paths between every pair of points by checking if going through a middle point is better than going directly.
Analogy: Imagine you want to find the quickest way to travel between every pair of cities. Sometimes, stopping at a third city on the way makes the trip faster than going straight.
0 3 ∞ ∞ 2 0 ∞ ∞ ∞ 7 0 1 6 ∞ ∞ 0 Here, numbers show direct travel times between cities; ∞ means no direct path.
