# lec14 - 6.006 Introduction to Algorithms Lecture 14...

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

6.006 Introduction to Algorithms Lecture 14: Shortest Paths I Prof. Erik Demaine

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

View Full Document
Today Shortest paths Negative‐weight cycles Triangle inequality Relaxation algorithm Optimal substructure
Shortest Paths

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

View Full Document
Shortest Paths
How Long Is Your Path? Directed graph Edge‐weight function Path Weight of , denoted , is ௞ିଵ v 1 v 2 v 3 v 4 v 5 4− 2 51 Example:

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

View Full Document
My Path Is Shorter Than Yours A shortest path from to is a path of minimum possible weight from The shortest‐path weight from is the weight of any such shortest path: B A D C Example: 1 4 3 7 2 B A D C 1 4 3 7 2 ߜ ܣ, ܦ ൌ6
You Can’t Get There From Here

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

View Full Document
You Can’t Get There From Here If there is no path from to , then neither is there a shortest path from Define in this case B A C Example: 1 4 2 3 7 D
The More I Walk, The Less It Takes A shortest path from to might not exist, even though there is a path from Negative weight cycle has B A C Example: 1 2 3 −7 D

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

View Full Document
The More I Walk, The Less It Takes Define if there’s a path from to that visits a negative‐weight cycle B A C Example: 1 2 3 −7 D s t 2 5 −2 3 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 28

lec14 - 6.006 Introduction to Algorithms Lecture 14...

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

View Full Document
Ask a homework question - tutors are online