Dijkstra's algorithm - shortest path problem

5 Ansichten (letzte 30 Tage)
Achter
Achter am 7 Aug. 2016
Bearbeitet: Achter am 7 Aug. 2016
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?

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by