0

I'm working on realization of Dijkstra Shortest Path algorithm in Python. Graph is oriented and weighed. Graph has 1070375 vertices. First task is to find shortest path between vertex #100562 and 1070345. I did it. I have not problem with it. But second task is to find number of unique paths between these vertices, that have the same length and different internal vertices. My question is what does it mean: unique paths between, that have the same length and different internal vertices. Is there can be few paths from 100562 to 1070345, or unique path it's also path, for example, from vertex # 111700 to vertex #111704. Could U show it on simple graph example?

ks1322
  • 33,961
  • 14
  • 109
  • 164
denys.p.
  • 1
  • 2

1 Answers1

0

Simple example of multiple unique shortest paths between two vertices would be:

  (111700) -2-> (1117002) -2-> (1117004)
         \        /           /   
          \      /          3   
           1    3         /      
            \  /        /      
             \/       /      
           (1117001)      

In this case you have 2 shortest paths from 111700 to 1117004. One is 111700 -> 1117002 -> 1117004 of length 4, but there is another from 1117000 -> 1117001 -> 1117004, which is also of length 4

But 111700 -> 1117001 -> 1117002 -> 1117004 is obviously not a shortest length path because this path has length 5 (And note if in this example the edge 1117001 -> 1117002 was of weight 1 we would have a third shortest path)

rfj001
  • 7,948
  • 8
  • 30
  • 48