|
Graphs->Shortest Path Algorithm |
||||||||||||||||
Well, you can make
out that it concerns to weighted graphs only. After you apply this
algorithm you get a TREE, which shows you the shortest paths to all the
other vertices from any given starting vertex. Sorry, I am running short
of words. I better take an example for this. Consider the weighted graph
below.
The algorithm is very comprehensive and here it is.... Algorithm:- C implementation:- Note:- The algorithm has been slightly modified wherein I have asked to find the BFS or DFS. As such you can also proceed without that. I would suggest you to go for BFS if your starting vertex is at much lower breadth level and to go for DFS if it is at a lower depth level. How to find that? Well, in that case your Adjacency list should hold the depth and breadth information, remember. Related Operations: |
||||||||||||||||
| Index || Doubts / Clarifications || Related Topics || Web Links | ||||||||||||||||