Dijkstra's algorithm - shortest path problem
5 次查看(过去 30 天)
显示 更早的评论
I calculated the shortest paths in a grid network of links with the same length in the smaller grid and the same length in the bigger grid in a digraph using 'positive' method explained in "shortest path MATLAB documentation". The network formation is shown in the attached figure. If I calculate the shortest path from node 19 to 32, it gives me one path. But if I calculate from 32 to 19, it gives me two paths.(The network is a digraph but only for visual purpose, it is a single line graph)
This problem can be solved by renaming the nodes in a sequence. Which means that (number 7) which is appearing between node 19 and 32 will not be there, rather a sequential number.
The problem is solved but I want to know why it is like this. Why Dijkstra's algorithm takes into account the node numbers.. shouldn't it be independent of them?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dijkstra algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!