public List<List<Vertex<Integer>>> findAllSimpleCycles(Graph<Integer> graph) {
        reset();
        List<List<Vertex<Integer>>> result = new ArrayList<>();
        for(Vertex<Integer> vertex : graph.getAllVertex()) {
            findAllSimpleCycles(vertex, vertex, result);
            visited.add(vertex);
            while(!markedStack.isEmpty()) {
                markedSet.remove(markedStack.pollFirst());
            }
        }
        return result;
    }
Find all simple cycles in a directed graph using Tarjan's algorithm.

Space complexity - O(E + V + S) where S is length of all cycles
Time complexity - O(E*V(C+1) where C is total number of cycles

Reference - https://ecommons.cornell.edu/handle/1813/5941
https://github.com/jgrapht/jgrapht/tree/master/jgrapht-core/src/main/java/org/jgrapht/alg/cycle
src/com/interview/graph/AllCyclesInDirectedGraphTarjan.java