I am trying to randomly traverse through the graph in jgrapht (until I find some target node). To do it, I need to start at the sourceNode, randomly pick any coming out edge and follow it.
I know there there is a method getAllEdges(sourceVertex, targetVertex)
that returns all the edges between two given nodes. But how can I get all edges while having only sourceNode, without the target one?
You can use Graphs.predecessorListOf and Graphs.successorListOf apis directly.