Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 23 CSE 331 Oct 24, 2011. Reminder 2 points for Piazza participation 3 points for mini-project.

Similar presentations


Presentation on theme: "Lecture 23 CSE 331 Oct 24, 2011. Reminder 2 points for Piazza participation 3 points for mini-project."— Presentation transcript:

1 Lecture 23 CSE 331 Oct 24, 2011

2 Reminder 2 points for Piazza participation 3 points for mini-project

3 Online Office Hr @10:00-11:00pm

4 Shortest Path Problem http://xkcd.com/85/

5 Another more important application Is BGP a known acronym for you? Routing uses shortest path algorithm

6 Shortest Path problem Input: Directed graph G=(V,E) Edge lengths, l e for e in E “start” vertex s in V Output: All shortest paths from s to all nodes in V 100 15 5 s u w 5 s u 5 s u w

7 Dijkstra’s shortest path algorithm E. W. Dijkstra (1930-2002)

8 Dijkstra’s shortest path algorithm Input: Directed G=(V,E), l e ≥ 0, s in V R = {s}, d(s) =0 While there is a x not in R with (u,x) in E, u in R d’(w) = min e=(u,w) in E, u in R d(u)+l e Pick w that minimizes d’(w) Add w to R d(w) = d’(w) s s w w u u z z x x y y 1 2 4 3 3 1 2 1 2 d(s) = 0 1 4 2 s s u u d(u) = 1 4 2 w w d(w) = 2 5 x x d(x) = 2 3 4 y y d(y) = 3 z z d(z) = 4 Shortest paths

9 Couple of remarks The Dijkstra’s algo does not explicitly compute the shortest paths Can maintain “shortest path tree” separately Dijkstra’s algorithm does not work with negative weights Left as an exercise

10 Rest of Today’s agenda Prove the correctness of Dijkstra’s Algorithm Runtime analysis of Dijkstra’s Algorithm

11 Reading Assignment Sec 4.4 of [KT]

12 Building a fiber network Lay down fibers to connect n locations All n locations should be connected Laying down a fiber costs money What is the cheapest way to lay down the fibers?


Download ppt "Lecture 23 CSE 331 Oct 24, 2011. Reminder 2 points for Piazza participation 3 points for mini-project."

Similar presentations


Ads by Google