Let be a directed graph and a depth first search spanning tree in that is rooted at a vertex . Suppose is also a breadth first search tree in , rooted at . Which of the following statements is/are TRUE for every such graph and tree ?
View worked solution
Answer: C
For any breadth first search (BFS) tree rooted at , every directed edge in the graph must satisfy the BFS level property:
Let us analyze the options with respect to this property:
- Forward edges (Option C): A forward edge goes from an ancestor to a descendant that is not a direct child. This implies: Since this directly violates the BFS property , no forward edges can exist in with respect to . Thus, Option C is always true.
- Back edges (Option A): A back edge goes from a descendant to an ancestor , so , which satisfies the BFS property. For example, in with edges , the tree is both a DFS and BFS tree, and is a valid back edge.
- Cross edges (Option B): A cross edge connects nodes where neither is an ancestor of the other. For example, in with edges , if DFS visits first and then , the tree is both a DFS and BFS tree, and is a valid cross edge.
Free practice · Your answers on this page are not saved.
