Lemma
A directed graph
has a cycle if and only if its DFS tree has a back edge.
Proof
Suppose we have a graph
Suppose it has some cycle
All other vertices
Suppose we have some back edge
Therefore there are edges
Lemma
A directed graph
has a cycle if and only if its DFS tree has a back edge.
Suppose we have a graph
Suppose it has some cycle
All other vertices
Suppose we have some back edge
Therefore there are edges