This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: o Run Time: O(n+e) • Step 0: O(n+e) • Step 1: O(n) • Step 2: O(e) • Overall: O(n+e) Dijkstra's Shortest Path Algorithm • Weighted graphs (Positive) • Used for finding the shortest distance between point a to point b • "Greedy" algorithms o Go for the best current solution, then correct later if a better solution is found o Trial and error • Similar to BFS • Need an array that contains the best path from the sources to that vertex • Array D stores current best distance from source to each vertex • Array Previous keeps for each vertex, the previous vertex n current shortest path from source to it • Fringe: set of all vertices that are not done & have non • Step Done D[B] D[C] D[D] D[E] D[F] D[G] A 5 10 ∞ ∞ ∞ ∞ 1 B10 11 8 ∞ ∞ 2 E10 10 • ∞ 10 A 0 C 2 B 1 D 3 E 4...
View
Full Document
 Spring '09
 VENUGOPAL
 Graph Theory, Vertex, #, Dijkstra, Array D

Click to edit the document details