End of Term Review 2.9

# End of Term Review 2.9 - Example 2 Single-Source Shortest...

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

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Example 2. Single-Source Shortest Path on a General Graph (May Contain Cycles) This is fundamentally harder, because the first paths we discover may not be the shortest (not monotonic). CSE 2011 Prof. J. Elder - 91 - Last Updated: 4/1/10 2:37 PM Dijkstra’s Algorithm: Operation We grow a “cloud” S of vertices, beginning with s and eventually covering all the vertices We store with each vertex v a label d(v) representing the distance of v from s in the subgraph consisting of the cloud S and its adjacent vertices At each step We add to the cloud S the vertex u outside the cloud with the smallest distance label, d(u) We update the labels of the vertices adjacent to u s 9 S 1 7 CSE 2011 Prof. J. Elder - 92 - 4 11 Last Updated: 4/1/10 2:37 PM Dijkstra’s algorithm: Analysis Analysis: Using minheap, queue operations takes O(logV) time CSE 2011 Prof. J. Elder - 93 - Last Updated: 4/1/10 2:37 PM Example CSE 2011 Prof. J. Elder Key: White Grey Black - 94 - Vertex Q = V - S Vertex = min(Q) Vertex S, Off Queue Last Updated: 4/1/10 2:37 PM Example CSE 2011 Prof. J. Elder - 95 - Last Updated: 4/1/10 2:37 PM ...
View Full Document

{[ snackBarMessage ]}

### Page1 / 5

End of Term Review 2.9 - Example 2 Single-Source Shortest...

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

View Full Document
Ask a homework question - tutors are online