{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture22

# lecture22 - Bellman Ford Single Source Shortest Path on a...

This preview shows pages 1–3. Sign up to view the full content.

Bellman Ford Single Source Shortest Path on a DAG Dijkstra IE170: Algorithms in Systems Engineering: Lecture 22 Jeﬀ Linderoth Department of Industrial and Systems Engineering Lehigh University March 23, 2007 Jeﬀ Linderoth IE170:Lecture 22 Bellman Ford Single Source Shortest Path on a DAG Dijkstra Taking Stock Last Time Single-Source Shortest Paths This Time All-Pairs Shortest Paths Jeﬀ Linderoth IE170:Lecture 22 Bellman Ford Single Source Shortest Path on a DAG Dijkstra Review The Algorithm All-Pairs Shortest Paths Given directed graph G = ( V,E ) , w : E R | E | . (To ease notation, we let V = { 1 , 2 ,...,n } .) Goal: Create an n × n matrix of shortest path distances δ ( i,j ) We could run Bellman-Ford if negative weights edges Running Time: O ( | V | 2 | E | ) . We could run Dijkstra if no negative weight edges Running Time: ( | V | 3 lg | V | ) (with binary heap implementation) We’ll see how to do slightly better, by exploiting an analogy to matrix multiplication Jeﬀ Linderoth IE170:Lecture 22 Bellman Ford Single Source Shortest Path on a DAG Dijkstra Review The Algorithm New Graph Data Structure This is maybe the one and only time we are going to use an adjacency matrix graph representation. Given G = ( ) and weight function w : E R | E | , create | V | × | V | matrix W as w ij = 0 i = j w ( ) ( ) E ( ) ±∈ E In this case it is useful to consider having 0 weight “loops” on the nodes ( w ii = 0 ) The output of an all pairs shortest path algorithm is a matrix D = ( d ) ij , where d ij = δ ( ) Jeﬀ Linderoth IE170:Lecture 22

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Bellman Ford Single Source Shortest Path on a DAG Dijkstra Review The Algorithm Dynamic Programming: Attempt #1 Subpaths of shortest paths are shortest paths Let ± ( m ) ij be the shortest path from i V to j V that uses m edges To initialize ± (0) ij = ± 0 i = j i ± = j What is the recursion we are looking for?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

lecture22 - Bellman Ford Single Source Shortest Path on a...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online