Download presentation
Presentation is loading. Please wait.
1
Lecture 39 CSE 331 Dec 6, 2010
2
On Friday, Dec 10 hours-a-thon Atri: 2:00-3:30 (Bell 123) Jeff: 4:00-5:00 (Bell 224) Alex: 5:00-6:30 (Bell 242)
3
Shortest Path Problem Input: (Directed) Graph G=(V,E) and for every edge e has a cost c e (can be <0) t in V Output: Shortest path from every s to t 1 1 100 -1000 899 s t Shortest path has cost negative infinity Assume that G has no negative cycle
4
When to use Dynamic Programming There are polynomially many sub-problems Optimal solution can be computed from solutions to sub-problems There is an ordering among sub-problem that allows for iterative solution Richard Bellman
5
Recurrence Relation OPT(i,v) = cost of shortest path from v to t with at most i edges OPT(i,v) = min { OPT(i-1,v), min (v,w) in E { c v,w + OPT(i-1, w) } } Path uses ≤ i-1 edges Best path through all neighbors
6
When to use Dynamic Programming There are polynomially many sub-problems Optimal solution can be computed from solutions to sub-problems There is an ordering among sub-problem that allows for iterative solution Richard Bellman
7
Today’s agenda Finish Bellman-Ford algorithm Analyze the run time Group talk time: Natural order among OPT(i,v) values? Group talk time: Natural order among OPT(i,v) values?
8
The recurrence OPT(i,v) = shortest path from v to t with at most i edges OPT(i,v) = min { OPT(i-1,v), min (v,w) in E { c v,w + OPT(i-1, w) } }
9
Some consequences OPT(i,v) = shortest path from v to t with at most i edges OPT(i,v) = min { OPT(i-1,v), min (v,w) in E { c v,w + OPT(i-1, w) } } OPT(n-1,v) is shortest path cost between v and t Group talk time: How to compute the shortest path between s and t given all OPT(i,v) values Group talk time: How to compute the shortest path between s and t given all OPT(i,v) values
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.