Mental Model
We find the shortest paths between every pair of points by checking if going through a middle point is shorter than the direct path.
Analogy: Imagine you want to travel between every pair of cities. Sometimes, going through a third city is faster than going directly. We check all cities as possible middle stops to find the quickest routes.
[0] -> [1] -> [2]
↑ ↑ ↑
dist matrix with direct distances or infinity if no direct path