The second shortest path in Dijkstra algorithm problem ?
1 view (last 30 days)
Show older comments
Hi, Do you know how can I choose the second shortest path in a graph?
i.e: I have this Matrix:
GR = [0 1 10 15 2 0;
1 0 4 1 5 10;
10 4 0 4 11 20;
15 1 4 0 9 8;
2 5 11 9 0 18;
0 10 20 8 18 0];
[C, L] = dijkstra(GR,6,1);
it will give me the shortest path from 1 to 6, which is
L =
1 2 4 6
but I need not only the shortest path, but the second, third ..... shortest path. thank you
1 Comment
Geoff Hayes
on 13 Feb 2016
Edited: Geoff Hayes
on 13 Feb 2016
Babak - please confirm that you are using Dimas Aryo's algorithm from the MATLAB File Exchange found at http://www.mathworks.com/matlabcentral/fileexchange/36140-dijkstra-algorithm. Or are you using one of the other implementations found there?
Answers (0)
See Also
Categories
Find more on Dijkstra algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!