Edsger Wybe Dijkstra in 2002 | |
Born | 11 May 1930 Rotterdam, Netherlands |
---|---|
Died | 6 August 2002 (aged 72) Nuenen, Netherlands |
Fields | Computer science |
Institutions | |
Known for | |
Notable awards |
|
Dijkstra's Algorithm
AIM: Implement
Dijkstra’s algorithm to compute the Shortest path through graph.DESCRIPTION:
Dijkstra’s algorithm solves the simple source shortest paths problem on a weighted, directed graph.
G=(V,E) for the case in which all weights are non negative.
The algorithm repeatedly selects the vertex v belong s to v-s with the minimum shortest path estimate add ---
ALGORITHM:
- Take a weighted, directed graph and take number of vertices.
- Next take the weights between the states.
- Start with the source vertex and identify the shortest path.
- Repeat the above process for all the vertices repetitively until the destination is reached.
- Display the shortest path from the source to destination.
Enter the cost matrix:
0 3 23 0
3 0 2 0
23 2 0 5
0 0 5 0
Enter the source node:1
Enter the destination node:4
Shortest path:
1->4,cost=10