False. Use vertices , edges , , , and start depth-first search at , scanning before . The times areThere is a directed path and , but and are separate children of . Thus is not a descendant of . The path leaves through an already gray ancestor; its later branch need not be explored inside 's recursive call. This is consistent with the DFS parenthesis property.
DFS counterexamples distinguish reachability from tree ancestry
. Left: the path from u through its ancestor x reaches a later sibling v, after u has finished. Right: root order a,u,c makes three singleton DFS trees, though u has an incoming and an outgoing edge. Details.False. The same ordered traversal gives a path , butA path from can pass through an already discovered ancestor, whose remaining edges are scanned only after finishes. A reachability statement alone therefore does not impose the claimed finishing-time bound.
True for a directed cycle. Suppose there were no back edges. On examining an edge , its target would either be white, in which case its recursive call finishes before ; or black, in which case it has already finished. A gray target would be an active ancestor and hence give a back edge, contrary to the supposition. Therefore every edge would satisfy .
Applying those strict inequalities around a directed cycle would imply , a contradiction. Thus some back edge in depth-first search must exist in the search's edge classification. Such an edge is classified relative to the DFS forest; it is not one of the forest's tree edges.
False. Take edges and , and let the outer DFS loop try vertices in order . The first call finishes immediately. The next discovers , whose only outgoing edge reaches already black , so its tree contains only . Finally sees already black .
Vertex has both an incoming edge from and an outgoing edge to , yet is the sole vertex of its DFS tree. Nonzero incoming and outgoing degrees do not require either edge to become a tree edge in depth-first search.
Articles by others on the same topic
There are currently no matching articles.
