lec15 - 6.006 Introduction to Algorithms Lecture 15:...

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

View Full Document Right Arrow Icon
6.006 Introduction to Algorithms Lecture 15: Shortest Paths II Prof. Erik Demaine
Background image of page 1

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

View Full DocumentRight Arrow Icon
Today Bellman Ford algorithm for single‐source shortest paths Running time Correctness Handling negative‐weight cycles Directed acyclic graphs
Background image of page 2
Recall: Shortest Paths if there’s no path from to if there’s a path from that visits a negative‐weight cycle B A C Example: 1 2 3 −7 D s t 2 5 −2 3 10
Background image of page 3

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

View Full DocumentRight Arrow Icon
Recall: Single Source Shortest Paths Problem: Given a directed graph with edge‐weight function , and a source vertex , compute for all Also want shortest‐path tree represented by Example: B A C 1 2 3 7 D s t 2 5 −2 3 10 0 1 28 4 0
Background image of page 4
Recall: Relaxation Algorithm for in : while some edge has : pick such an edge relax : if : u v s
Background image of page 5

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

View Full DocumentRight Arrow Icon
Relaxation Algorithm Issues Never stop relaxing in a graph with negative‐weight cycles: infinite loop! A poor choice of relaxation order can lead to exponentially many relaxations: v 1 v 2 v 3 v 4 v 5 v 7 v 6 8 8 8 4 44 2 2 21 1 0 ∞∞∞∞∞∞
Background image of page 6
Bellman & Ford Richard E. Bellman (1920–1984) IEEE Medal of Honor, 1979 Lester R. Ford, Jr. (1927–) president of MAA, 1947–48 http://www.amazon.com/Bellman‐Continuum‐ Collection‐Works‐Richard/dp/9971500906 http://www.maa.org/aboutmaa/maaapresidents.html
Background image of page 7

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

View Full DocumentRight Arrow Icon
Bellman Ford Algorithm Relaxation algorithm
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 25

lec15 - 6.006 Introduction to Algorithms Lecture 15:...

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

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