|
-
February 15th, 2005, 08:21 AM
#8
Junior Member
Hello,
Thank you sword_fish,and Jinx for your suggestions.Here is the algorithm to find the 2nd shortest path.Once you find the shortest path by Dijkstra's algorithm (or Bellman-Ford also),
make the last edge of the path equal to infinity, thus cutting it off from the graph.Then run the dijkstra's algorithm again.Restore that edge,and make the second edge=infinity,and continue so on for all edges.The shortest path amongst the collection of all those, will be the 2nd shortest path in the graph.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|