Lemma
Let
be a directed graph with two strongly connected components and . Let be the result of running the DFS to find connected components in an undirected graph algorithm . If there exists and such that then
Proof
As
During the fun of DFS to find connected components in an undirected graph
Suppose we first visit a vertex explore
from
Suppose instead we first visit a vertex