lec17 - MIT OpenCourseWare http:/ocw.mit.edu 6.006...

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

View Full Document Right Arrow Icon
MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .
Background image of page 1

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

View Full DocumentRight Arrow Icon
17 Shortest Paths III: Dijkstra 6.006 Spring 2008 Lecture 17: Shortest Paths III - Dijkstra and Special Cases Lecture Overview Shortest paths in DAGs Shortest paths in graphs without negative edges Dijkstra’s Algorithm Readings CLRS, Sections 24.2-24.3 DAGs: Can’t have negative cycles because there are no cycles! 1. Topologically sort the DAG. Path from u to v implies that u is before v in the linear ordering 2. One pass over vehicles in topologically sorted order relaxing each edge that leaves each vertex Θ( V + E ) time Example: r s t x y z 0 3 5 2 7 -1 6 4 1 -2 2 Figure 1: Shortest Path using Topological Sort Vertices sorted left to right in topological order Process r : stays . All vertices to the left of s will be by de±nition Process s : t : ∞ → 2 x
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.

Page1 / 5

lec17 - MIT OpenCourseWare http:/ocw.mit.edu 6.006...

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