cycles
Finds all simple cycles in a directed graph. A cycle is defined as a non-empty sequence of vertices such that the first and last vertices in the sequence are the same, and each edge in the sequence is traversed exactly once.
The algorithm analyzes strongly connected subgraphs of the input graph to identify cycles.
Return
A list of cycles, where each cycle is represented as a list of vertices.
Parameters
V
The type representing the vertices in the graph.
E
The type representing the edges in the graph.
graph
The directed graph to analyze for cycles.