lecture7 - CS 473: Algorithms Chandra Chekuri...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 473: Algorithms Chandra Chekuri chekuri@cs.illinois.edu 3228 Siebel Center University of Illinois, Urbana-Champaign Fall 2009 Chekuri CS473ug Part I Dijkstras Algorithm Recap Chekuri CS473ug Dijkstras Algorithm using Priority Queues Shortest paths from node s to all nodes in V : Q = makePQ() insert(Q, (s,0)) for each node u 6 = s insert(Q, (u, )) S = for i = 1 to |V| do (v, dist(s,v)) = extractMin(Q) S = S { v } For each u in Adj(v) do decreaseKey(Q, (u, min (dist(s,u), dist(s,v) + (v,u)))) Algorithm adds nodes to S in order of increasing distance from s Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 6 6 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 9 6 9 6 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 9 6 13 9 13 6 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 9 19 6 13 9 13 6 10 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 9 19 25 6 13 9 13 6 10 6 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 9 19 36 25 6 13 9 13 6 10 11 6 Chekuri CS473ug Example s 2 3 4 5 6 7 t 9 13 6 10 8 20 30 18 11 16 6 19 6 6 25 9 19 36 25 6 13 38 9 13 6 10 11 6 25 Chekuri CS473ug Shortest Path Tree Dijkstras algorithm finds the shortest path distances from s to V . Question: How do we find the paths themselves? Chekuri CS473ug Shortest Path Tree Dijkstras algorithm finds the shortest path distances from s to V . Question: How do we find the paths themselves? Q = makePQ() insert(Q, (s,0)) prev(s) = null for each node u 6 = s insert(Q, (u, )) prev(u) = null S = for i = 1 to |V| do (v, dist(s,v)) = extractMin(Q) S = S { v } For each u in Adj(v) do if (dist(s,v) + (v,u) < dist(s,u) ) then decreaseKey(Q, (u, dist(s,v) + (v,u))) prev(u) = v Chekuri CS473ug Shortest Path Tree Lemma The edge set ( u , prev ( u )) is the reverse of a shortest path tree rooted at s. For each u, the reverse of the path from u to s in the tree is a shortest path from s to u. Proof Sketch. The edgeset { ( u , prev ( u )) | u V } induces a directed in-tree rooted at s (Why?) Use induction on | S | to argue that the tree is a shortest path tree for nodes in V . Chekuri CS473ug Shortest paths to s Dijkstras algorithm gives shortest paths from s to all nodes in V . How do we find shortest paths from all of V to s ? Chekuri CS473ug Shortest paths to s Dijkstras algorithm gives shortest paths from s to all nodes in V . How do we find shortest paths from all of V to s ? In undirected graphs shortest path from s to u is a shortest path from u to s so there is no need to disjtinguish....
View Full Document

This note was uploaded on 01/22/2012 for the course CS 573 taught by Professor Chekuri,c during the Fall '08 term at University of Illinois, Urbana Champaign.

Page1 / 78

lecture7 - CS 473: Algorithms Chandra Chekuri...

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

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