Dijkstra Algorithm
Dijkstra Algorithm
return dist
Steps
1. Set distance to Source vertex is Zero
2. Set distance to other vertices to infinity (∞)
3. Repeat Steps 4 to 6 Until Unvisited List is Empty
4. Include the vertex with the smallest cost into Visited List
5. Examine its neighboring nodes and calculate its distance to them
6. If the calculated distance is less than currently known distance,
then update the shortest distances for these vertices
Here for above graph,
Visited = { }
Unvisited = { a, b, c, d, e, z }