This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: First the node closest to s (ie. S itself) Then the second closest Then third closest c. Example Graph with nondirected edges with a value for the edge, take shortest paths Add up the distances along the way S A B C D E F I I I I I I 0 2 6 I I I I 0 2 6 3 I I I 4 6 8 I 5 8 I 7 I 8 d. Why does this work? Suppose we have identified the k closest nodes to S, with correct distance values Distance estimate to u === length of shortest path to u using only the k closest nodes >= length of shortest path to u. Say w is the (k+1) st closest node. The shortest path to it uses only the k closest nodes. Therefore, estimate for w is correct, and w will be finalized next. e. Dijkstras algorithm For all u in V Dist[u] = infinity Dist[s] = 0 H =V (nodes to which distance is not yet finalized) While H is not empty U = node in H with smallest dist Remove u from H For all (u, w) in E: If dist[w] > dist[u] + l(u,w): dist[w] = dist[u] + l(u, w) f....
View Full Document
This note was uploaded on 01/09/2012 for the course CSE 101 taught by Professor Staff during the Spring '08 term at UCSD.
- Spring '08