Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 7 All-Pairs Shortest Paths

Similar presentations


Presentation on theme: "Lecture 7 All-Pairs Shortest Paths"— Presentation transcript:

1 Lecture 7 All-Pairs Shortest Paths

2 All-Pairs Shortest Paths

3 Path Counting Problem

4 Adjacency Matrix

5 1 3 2 1 2 3 1 2 3

6 Theorem Proof. We prove it by induction on k.

7 k=1 True! 1 3 2 1 2 3 1 2 3

8 Induction Step

9 All-Pairs Shortest Paths with at most k edges

10 Recursive formula Proof.

11 Case 1. The path with length contains
at most edges. Case 2. the path with length contains exactly edges.

12 Key Observation

13 Dynamic Program

14 Speed Up dynamic Program

15 Idea

16 Weighted Adjacency Matrix

17 1 4 5 6 3 2 1 2 3 1 2 3

18

19 A New Multiplication

20 Associative Law

21 Theorem Proof. We prove it by induction on k.

22 1 k=1 True! 4 5 6 3 2 1 2 3 1 2 3

23 Induction Step

24 All-Pairs Shortest Paths
Theorem Proof

25 How to Compute

26 Lemma

27 Theorem

28 Theorem

29 Floyd-Warshall Algorithm

30 Observation

31 Dynamic Program

32

33 Theorem

34 Theorem

35 What we learnt in this lecture?
The relationship between shortest path and matrix multiplication. Faster-All-Pairs-Shortest-Paths algorithm Floyd-Warshall algorithm.

36 Puzzle 1

37 Puzzle 2

38 Puzzle 3


Download ppt "Lecture 7 All-Pairs Shortest Paths"

Similar presentations


Ads by Google