Question

i know how to find a shortest path by using DijkstraShortestPath but i wonder how i can find all the shortest paths between two node, and print them out.

For example there are two shortest path both are 3 hops between vertex A and C, print out like this [A,B,D,C] and [A,E,F,C] Thanks!!

Was it helpful?

Solution

You'll have to hack the DSP code a bit to do this; JUNG does not have this capability built in. There are a few different ways you could go about this depending on what your needs are, but the basic idea is that you find the termination conditions and adjust them, and make sure that the data structures will store what you need as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top