lec19 - Introduction to Algorithms 6.046J/18.401J LECTURE...

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

View Full Document Right Arrow Icon
November 21, 2005 Copyright © 2001-5 by Erik D. Demaine and Charles E. Leiserson L1 9 .1 Introduction to Algorithms 6.046J/18.401J L ECTURE 1 9 Shortest Paths III All-pairs shortest paths Matrix-multiplication algorithm Floyd-Warshall algorithm Johnson’s algorithm Prof. Charles E. Leiserson
Background image of page 1

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

View Full DocumentRight Arrow Icon
November 21, 2005 Copyright © 2001-5 by Erik D. Demaine and Charles E. Leiserson L1 9 .2 Shortest paths Single-source shortest paths Nonnegative edge weights ± Dijkstra’s algorithm: O ( E + V lg V ) General ± Bellman-Ford algorithm: O ( VE ) DAG ± One pass of Bellman-Ford: O ( V + E )
Background image of page 2
November 21, 2005 Copyright © 2001-5 by Erik D. Demaine and Charles E. Leiserson L1 9 .3 Shortest paths Single-source shortest paths Nonnegative edge weights ± Dijkstra’s algorithm: O ( E + V lg V ) General ± Bellman-Ford: O ( VE ) DAG ± One pass of Bellman-Ford: O ( V + E ) All-pairs shortest paths Nonnegative edge weights ± Dijkstra’s algorithm | V | times: O ( VE + V 2 lg V ) General ± Three algorithms today.
Background image of page 3

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

View Full DocumentRight Arrow Icon
November 21, 2005 Copyright © 2001-5 by Erik D. Demaine and Charles E. Leiserson L1 9 .4 All-pairs shortest paths Input: Digraph G = ( V , E ) , where V = {1, 2, …, n } , with edge-weight function w : E R . Output: n × n matrix of shortest-path lengths δ ( i , j ) for all i , j V .
Background image of page 4
November 21, 2005 Copyright © 2001-5 by Erik D. Demaine and Charles E. Leiserson L1 9 .5 All-pairs shortest paths Input: Digraph G = ( V , E ) , where V = {1, 2, …, n } , with edge-weight function w : E R . Output: n × n matrix of shortest-path lengths δ ( i , j ) for all i , j V . I DEA : Run Bellman-Ford once from each vertex. Time = O( V 2 E ) . Dense graph ( n 2 edges) ⇒Θ ( n 4 ) time in the worst case. Good first try!
Background image of page 5

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

View Full DocumentRight Arrow Icon
November 21, 2005 Copyright © 2001-5 by Erik D. Demaine and Charles E. Leiserson L1 9 .6 Dynamic programming Consider the n × n adjacency matrix A = ( a ij ) of the digraph, and define d ij ( m ) = weight of a shortest path from i to j that uses at most m edges.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/19/2010 for the course CS 477 taught by Professor Gewali during the Spring '08 term at University of Nevada, Las Vegas.

Page1 / 23

lec19 - Introduction to Algorithms 6.046J/18.401J LECTURE...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online