Partition a directed graph into cycles

directed graphsgraph theory

I would like to partition a directed graph into subgraphs that all contain a simple cycle (if there is a solution for the given graph).

I know there are algorithms to compute the strongly connected components of a directed graph, like Kosaraju's algorithm for example. I'm looking for something similar, but a strongly connected component does not necessarily contain a simple cycle.

Can someone point me to the algorithm I'm looking for?

Best Answer

Let us start by making some observing that if some set of vertices induces a simple cycle, then these vertices are in the same strongly connected component (SCC), so any simple cycle of a directed graph must reside completely in one SCC. Also note that two vertices which are connected by edges in both directions is a simple cycle, so the only SCCs which do not contain a simple cycle are singletons (i.e. they consist of exactly 1 vertex). The vertex contained in such a SCC is not part of any simple cycle (otherwise it would be in a different SCC by our first observation) so any graphs with singleton SCCs does not admit a partition of the kind you are seeking.

It follows that such a partition can be obtained (if it exists) by partitioning the graph into SCCs.