380 likes | 406 Views
Lecture 7 All-Pairs Shortest Paths. All-Pairs Shortest Paths. Path Counting Problem. Adjacency Matrix. 1. 3. 2. 1. 2. 3. 1. 2. 3. Theorem. Proof . We prove it by induction on k. k =1 True!. 1. 3. 2. 1. 2. 3. 1. 2. 3. Induction Step.
E N D
1 3 2 1 2 3 1 2 3
Theorem Proof. We prove it by induction on k.
k=1 True! 1 3 2 1 2 3 1 2 3
Recursive formula Proof.
Case 1. The path with length contains at most edges. Case 2. the path with length contains exactly edges.
1 4 5 6 3 2 1 2 3 1 2 3
Theorem Proof. We prove it by induction on k.
1 k=1 True! 4 5 6 3 2 1 2 3 1 2 3
All-Pairs Shortest Paths Theorem Proof
What we learnt in this lecture? • The relationship between shortest path and matrix multiplication. • Faster-All-Pairs-Shortest-Pathsalgorithm • Floyd-Warshall algorithm.