lec17

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

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

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 .

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

View Full Document
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
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/24/2010 for the course CS 6.006 taught by Professor Erikdemaine during the Spring '08 term at MIT.

### 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
Ask a homework question - tutors are online