Graph Algorithms


Answer & solution
Answer: C (no official key was published)
Step 1: If u has an unvisited neighbor when its exploration begins, DFS immediately follows an edge to such a neighbor. Then the next discovery v is adjacent and becomes a child of u.
Step 2: If the next discovery is not adjacent to u, DFS must have exhausted u without discovering any child and backtracked to an ancestor before reaching v. Therefore u is a leaf in the DFS tree, proving C.
The backtrack may cross several ancestors, so u and v need not share a parent. The two options requiring adjacency in every case are also too strong.