Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shortest Path Algorithms. Definitions Variants  Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source.

Similar presentations


Presentation on theme: "Shortest Path Algorithms. Definitions Variants  Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source."— Presentation transcript:

1 Shortest Path Algorithms

2 Definitions

3

4

5 Variants  Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source vertex to all the vertices in the graph (Our problem)  Single-destination shortest-paths problem: If you reverse the directions of all edges, you can solve it as a single-source problem.

6 Variants

7  All-pairs shortest-path problems: Find a shortest part from each vertex to each vertex. Although this problem can be solved by running a single-source algorithm once from each vertex, it can usually be solved faster.

8 Structure of a Shortest Path  Subpaths of shortest paths are shortest paths. (WHY?)  Negative-weight edges?  Cycles?  Negative-weight cycles?

9 Representing Shortest Paths

10 Initialization

11 Relaxation

12

13 The Bellman-Ford Algorithm  The Bellman-Ford Algorithm solves the single- source shortest-path problems in which the edge weights may be negative.  It also alerts us if there is a negative-weight cycle that is reachable from the source.  If there is no such cycle, the algorithm produces the shortest paths and their weights.

14

15 Example and Implementation Issues

16 Correctness

17 Computational Complexity

18 Dijkstra’s Algorithm

19

20

21 Example

22 Implementation Issues

23 Approach

24 Correctness

25 Proof:

26 Computational Complexity


Download ppt "Shortest Path Algorithms. Definitions Variants  Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source."

Similar presentations


Ads by Google