lec16 - 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 Document Right Arrow Icon
16 Shortest Paths II: Bellman-Ford 6.006 Spring 2008 Lecture 16: Shortest Paths II: Bellman-Ford Lecture Overview Review: Notation Generic S.P. Algorithm Bellman Ford Algorithm Analysis Correctness Recall: path p = < v 0 ,v 1 , ..., v k > ( v 1 ,v i +1 ) E 0 i < k k 1 w ( p ) = w ( v i ,v i +1 ) i 0 Shortest path weight from u to v is δ ( u, v ). δ ( u, v ) is if v is unreachable from u , unde±ned if there is a negative cycle on some path from u to v . u v -ve Figure 1: Negative Cycle Generic S.P. Algorithm Initialize: for v V : d [ v ] Π[ v ] NIL d [ S ] 0 Main: repeat select edge ( u, v ) [somehow] if d [ v ] > d [ u ] + w ( u, v ) : “Relax” edge ( u, v ) d [ v ] d [ u ] + w ( u, v ) π [ v ] u until you can’t relax any more
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.

{[ snackBarMessage ]}

Page1 / 5

lec16 - 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