plotor / k-shortest-paths

Automatically exported from code.google.com/p/k-shortest-paths
0 stars 0 forks source link

Not listing all shortest paths #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use data file 

7

0 1 1
1 0 1
0 2 7
2 0 7 
1 2 1
2 1 1
1 3 3
3 1 3
1 4 2
4 1 2
2 4 4
4 2 4
3 5 6
5 3 6
3 4 1
4 3 1
4 5 2
5 4 2
3 6 100
6 3 100
6 1 1
1 6 1

2.
  Use test program 
   System.out.println("Testing Yen's algorithm for top-k shortest paths!");
        //VariableGraph graph = new VariableGraph("data/network");
        VariableGraph graph = new
VariableGraph("/home/cygnet/usr/NMSWorks/GraphAlgosLit/KSPImplementation/data/te
stUD2");
        DijkstraShortestPathAlg alg = new DijkstraShortestPathAlg(graph);
        //System.out.println(alg.get_shortest_path(graph.get_vertex(0),
graph.get_vertex(20)));
        //System.out.println(alg.get_shortest_path(graph.get_vertex(1),
graph.get_vertex(3)));

        System.out.println("Testing top-k shortest paths!");
        YenTopKShortestPathsAlg yenAlg = new YenTopKShortestPathsAlg(graph);
        List<Path> shortest_paths_list = yenAlg.get_shortest_paths(
                //graph.get_vertex(1), graph.get_vertex(3), 300);
                graph.get_vertex(0), graph.get_vertex(2), 100);
        System.out.println(":"+shortest_paths_list);
        System.out.println(yenAlg.get_result_list().size());
    }
3.

What is the expected output? What do you see instead?
 The output should contain many shortest paths. I see only two shortest paths.
 The output is 

Testing Yen's algorithm for top-k shortest paths!
Testing top-k shortest paths!
:[[0, 1, 2]:2.0, [0, 1, 4, 2]:7.0]
2

What version of the product are you using? On what operating system?
  I am using Linux and the java version of the kshortestpaths implementation.  

What am i doing wrong?
Thanks

Please provide any additional information below.

Original issue reported on code.google.com by weareus....@gmail.com on 7 Oct 2008 at 9:43

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I meant to say that there are more than two loopless paths between the given 
source
and destination. The output gives only two loopless paths. Maybe there is a 
variable
i have to set somewhere to make it list the paths exhaustively?
Thanks

Original comment by weareus....@gmail.com on 30 Oct 2008 at 9:48

GoogleCodeExporter commented 8 years ago
Hi, Weareus
 Thanks a lot! I made a mistake in the algorithm, and now it has been corrected. Hope
it's correct now!

Best regards

Yan

Original comment by yan.qi....@gmail.com on 5 Feb 2009 at 7:50

GoogleCodeExporter commented 8 years ago

Original comment by yan.qi....@gmail.com on 5 Feb 2009 at 7:52