Dijkstra's Algorithm
OUTPUT:
Enter no. of vertices : 4
No. of edges : 5
Enter edges (u,v,weight) : 0 1 2
1 2 1
2 3 2
3 0 5
0 2 3
Enter the starting node : 1
Distance of 0 = 2
Path = 0 <- 1
Distance of 2 = 1
Path = 2 <- 1
Distance of 3 = 3
Path = 3 <- 2 <- 1
No comments:
Post a Comment