Answer
Showing that if G is a directed graph and T is a spanning tree constructed using depth-first search, then every edge not in the spanning tree is a forward edge connecting
--an ancestor to a descendant, a back edge connecting a
--descendant to an ancestor, or a cross edge connecting a
-vertex to a vertex in a previously visited subtree
Work Step by Step
--If a directed edge uv is not followed while we are processing its tail u during the depth-first search process,
then
- it must be the case that its head v had already been visited.
-There are three cases.
-- If vertex v was visited after we started processing u, then, because we are not finished processing u yet, v must appear in the subtree rooted at u
(and hence, must be a descendant of u), so we have a forward edge. Otherwise,
--the processing of v must have already begun before we started
processing u. If it had not yet finished (i.e., we are still forming
the subtree rooted at v), then u is a descendant of v, and hence,
v is an ancestor of u (we have a back edge).
-- Finally, if the processing of v had already finished, then by definition we have a cross edge