Presentation is loading. Please wait.

Presentation is loading. Please wait.

All Pairs Shortest Path Examples While the illustrations which follow only show solutions from vertex A (or 1) for simplicity, students should note that.

Similar presentations


Presentation on theme: "All Pairs Shortest Path Examples While the illustrations which follow only show solutions from vertex A (or 1) for simplicity, students should note that."— Presentation transcript:

1 All Pairs Shortest Path Examples While the illustrations which follow only show solutions from vertex A (or 1) for simplicity, students should note that as an All-Pairs problem the algorithm is computing similar information for each vertex.

2 Matrix Multiply Method for APSP

3 The graph for the Slow “Matrix Multiply” Method 2 3 4 1 3 8 2 -4 -5 1 7 4 5 6

4 π: 1 d: 3 Slow “Matrix Multiply” Method Initial conditions, e.g., L(1) 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: nil d: ∞ π: 1 d: -4

5 π: 1 d: 3 Slow “Matrix Multiply” Method L(2) – bolded values indicate change 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: 5 d: 2 π: 1 d: -4

6 π: 1 d: 3 Slow “Matrix Multiply” Method L(3) – bolded values indicate change 2 3 4 π: 4 d: -3 1 3 8 2 -4 -5 1 7 4 5 6 π: 5 d: 2 π: 1 d: -4

7 π: 3 d: 1 Slow “Matrix Multiply” Method L(4) – bolded values indicate change 2 3 4 π: 4 d: -3 1 3 8 2 -4 -5 1 7 4 5 6 π: 5 d: 2 π: 1 d: -4

8 The graph for the Fast “Matrix Multiply” Method 2 3 4 1 3 8 2 -4 -5 1 7 4 5 6

9 π: 1 d: 3 Fast “Matrix Multiply” Method Initial conditions, e.g., L(1) 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: nil d: ∞ π: 1 d: -4

10 π: 1 d: 3 Fast “Matrix Multiply” Method L(2) – bolded values indicate change 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: 5 d: 2 π: 1 d: -4

11 π: 3 d: 1 Fast “Matrix Multiply” Method L(4) – bolded values indicate change 2 3 4 π: 4 d: -3 1 3 8 2 -4 -5 1 7 4 5 6 π: 5 d: 2 π: 1 d: -4

12 Floyd-Warshall Method for APSP

13 The graph for the Floyd-
Warshall Method 2 3 4 1 3 8 2 -4 -5 1 7 4 5 6

14 π: 1 d: 3 Floyd-Warshall Method Initial conditions, e.g., D(0) 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: nil d: ∞ π: 1 d: -4

15 π: 1 d: 3 Floyd-Warshall Method D(1) – No Changes 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: nil d: ∞ π: 1 d: -4

16 π: 1 d: 3 Floyd Warshall Method D(2) – bolded values indicate change 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: 2 d: 4 π: 1 d: -4

17 π: 1 d: 3 Floyd Warshall Method D(3) – No changes 2 3 4 π: 1 d: 8 1 3 8 2 -4 -5 1 7 4 5 6 π: 2 d: 4 π: 1 d: -4

18 π: 1 d: 3 Floyd Warshall Method D(4) – bolded values indicate change 2 3 4 π: 4 d: -1 1 3 8 2 -4 -5 1 7 4 5 6 π: 2 d: 4 π: 1 d: -4

19 π: 3 d: 1 Floyd Warshall Method D(5) – bolded values indicate change 2 3 4 π: 4 d: -3 1 3 8 2 -4 -5 1 7 4 5 6 π: 5 d: 2 π: 1 d: -4


Download ppt "All Pairs Shortest Path Examples While the illustrations which follow only show solutions from vertex A (or 1) for simplicity, students should note that."

Similar presentations


Ads by Google