Find all path between two vertex

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Find all path between two vertex



I´ve seen, that this kind of question has already been posted, but I haven´t found a real solution in the archives yet.

So my problem is: I wonder, if there is a good way to find all possible paths between two vertexes.

I´m currently working with a DefaultDirectedWeightedGraph and I can be sure, that I do not have more than 5 different vertexes. So there won´t be a too big complexity within this graph.
The different edges between these vertexes are defined dynamically.
So now I would like to find out all possible path between one source-vertex and a target-vertex, where both vertex can also be the same (like in the eulerian cycle).

I tried to work with the „EulerianCircuit“, but that doesn´t work, because I do not have a unidirectional graph. Using the „shortestPath“-algorithms (such as KShortestPaths) isn´t working for me as well, because I need ALL paths.

I found this article (, dealing with this kind of a problem – but actually the pseudo-code isn´t really easy to understand for me.
Maybe someone else already adopted this algorithm to JGraphT or might help me to translate this into a pseudo-jgrapht-code.

I would be very thankful, if someone can point me in the right direction, about what to do best in my case.

Thanks for your help


jgrapht-users mailing list
[hidden email]