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

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

6.006 Introduction to Algorithms Lecture 15: Shortest Paths II Prof. Erik Demaine

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

View Full Document
Today Bellman Ford algorithm for single‐source shortest paths Running time Correctness Handling negative‐weight cycles Directed acyclic graphs
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

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

View Full Document
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
Recall: Relaxation Algorithm for in : while some edge has : pick such an edge relax : if : u v s

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

View Full Document
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 ∞∞∞∞∞∞
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

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

View Full Document
Bellman Ford Algorithm Relaxation algorithm
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/11/2011 for the course MATH 180 taught by Professor Byrns during the Spring '11 term at Montgomery College.

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