1

I am trying to implement single_source_dijkstra_path algorithm of the networkx to define the shortest path from a node to all nodes in the network. There are six sources in total, and I want to measure which one of the six nodes has the shortest path to a target node (e.g from node 1 - 6, which node has the shortest distance to node 30). While it works, I think some of the result didn't show the shortest path.

figure 1

for example, the picture above shows the shortest path to AS Calau, which is to be from Stralsund with 353.3 km. However, with only a gap of a node with a distance of 10 km, the shortest path changes as follow:

figure 2

From Calau to Bronkow is only 10 km and my network is proven to be all connected (len(list(nx.connected_components)) = 1 ). In Figure 2, it can be seen that the shortest path is no longer from Stralsund but from Rostock Oberseehafen, and the shortest distance is then 641 km. Further analysis also shown that from Stralsund to Bronkow needs to undergo similar path with figure 2, thus resulting in a longer distance.

Does anybody know what I might be doing wrong in this case or does anyone have any explanation for this?

1
  • 2
    Everything is connected but not where you think it is. There are missing nodes in your network.
    – FelixIP
    Commented Apr 1, 2019 at 18:21

1 Answer 1

2

Based upon what @FelixIP said I would check the junctions marked here:

Image

See if they are genuinely snapped or its not a multi-part shape which breaks network topology.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.