Question
Write the Dijkstra’s shortest path algorithm. Also, find the time complexity of this shortest path algorithm. Find the shortest paths from the vertex ‘A’ using Dijkstra’s shortest path algorithm for the graph given in Figure 1. Show all the steps of computation.
Answer :
Word Count : 298
_________ ____ ________ ____ ________ ________ _______ ____ __________.
_____ ___ _______ _______ _______ ________ _____ _________ _____ ___ ______.
______ ___ _________ ________ _________ ___ ____.
____ ________ ______ ______ ___ __________ _________.
______ __________ ____ ______ _______.
_____ ___ ______ _____ ________ ______ _____ _______ ____ ____.
__________ __________ __________ __________ _________ ______ _______ ______.
_______ ___ ____ _________ ___ _______ _______ __________ ___ __________ _____ _______.
_________ _________ _______ __________ ________ ____ _____ ____ ___ ______.
_______ ___ ______ ________ _____ ________ _______.
____ _____ _______ ________ _______ _____ _________ ________ _______.
____ _____ _________ _________ ________ ____ ________ ________.
____ _________ _____ _____ _____ ____ __________.
___ _______ _________ ____ __________.
__________ _________ ___ ________ ___ _______ _____ _____.
____ ________ ____ ________ ________ ______ ________.
_______ ____ _______ _____ ___.
______ _____ _____ ____ ____ ________.
_________ _______ ____ ________ ________.
_______ _______ ___ _______ _______.
__________ _____ ___ ___ _____ _____ __________ ___ ____.
_____ _________ ___ _____ ____.
_____ _______ _____ _______ _______ ________ ___.
____ _________ _______ _________ ____ ___ _________ ___.
________ ___ ___ ________ ___ ___ ____ _______ ___ ____ _______ ______.
Skip in 10
### **Algorithm Steps** 1. Assign tentative distance for all vertices: 0 for source, ∞ for others. 2. Set source as current. For all neighbors not yet visited, update their distance if path through current is smaller. 3. Mark current as visited. Set next unvisited vertex with smallest tentative distance as current. 4. Repeat until all vertices visited. **Time Complexity:** - With Min Heap: $$O((V+E)\log V)$$ - With array: $$O(V^2)$$ *** ### **Apply Dijkstra’s Algorithm from A** Initialize: - A=0, others=∞ | Visited | Distances | Next Vertex | |---------|------------------------------------|-------------| | - | A(0), B(∞), C(∞), D(∞), E(∞), F(∞), G(∞) | A
______ ___ ___ ________ ____._________ ____ ________ ____ ________ ________ _______ ____ __________.
_____ ___ _______ _______ _______ ________ _____ _________ _____ ___ ______.
______ ___ _________ ________ _________ ___ ____.
____ ________ ______ ______ ___ __________ _________.
______ __________ ____ ______ _______.
_____ ___ ______ _____ ________ ______ _____ _______ ____ ____.
__________ __________ __________ __________ _________ ______ _______ ______.
_______ ___ ____ _________ ___ _______ _______ __________ ___ __________ _____ _______.
_________ _________ _______ __________ ________ ____ _____ ____ ___ ______.
_______ ___ ______ ________ _____ ________ _______.
____ _____ _______ ________ _______ _____ _________ ________ _______.
____ _____ _________ _________ ________ ____ ________ ________.
____ _________ _____ _____ _____ ____ __________.
___ _______ _________ ____ __________.
__________ _________ ___ ________ ___ _______ _____ _____.
____ ________ ____ ________ ________ ______ ________.
_______ ____ _______ _____ ___.
______ _____ _____ ____ ____ ________.
_________ _______ ____ ________ ________.
_______ _______ ___ _______ _______.
__________ _____ ___ ___ _____ _____ __________ ___ ____.
_____ _________ ___ _____ ____.
_____ _______ _____ _______ _______ ________ ___.
____ _________ _______ _________ ____ ___ _________ ___.
________ ___ ___ ________ ___ ___ ____ _______ ___ ____ _______ ______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.