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

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

View Full Document Right Arrow Icon
Bellman Ford Single Source Shortest Path on a DAG Dijkstra IE170: Algorithms in Systems Engineering: Lecture 22 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 23, 2007 Jeff 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 Jeff 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 Jeff 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 = δ ( ) Jeff Linderoth IE170:Lecture 22
Background image of page 1

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

View Full DocumentRight Arrow Icon
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?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/06/2008 for the course IE 170 taught by Professor Ralphs during the Spring '07 term at Lehigh University .

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 Right Arrow Icon
Ask a homework question - tutors are online