I have a directed graph with a special root node from which all other nodes are reachable.
It is quite easy to find an arbitrary algorithm to find all pathes from a giving node to the root, for example this solution (DFS) using LinkedHashSets.
Well, this algorithm works well for small graphs but with larger graphs it doesn't come to an end in a reasonable amount of time.
My example graph has 129 nodes and 200 edges. In my eyes not an extremly HUGE graph...
Can somebody give me a hint how to solve this problem efficiently?
Maybe we can make use of other properties of my graphs. They all are:
- connected
- directed with loops
- have a designated starting node
- have a designated end node