Question
Let be a directed graph and a depth first search (DFS) spanning tree in that is rooted at a vertex . Suppose is also a breadth first search (BFS) tree in , rooted at . Which of the following statements is/are TRUE for every such graph and tree ?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2024 answer key
Solution
Use the BFS tree level property for every directed edge to rule out forward edges.
Let denote the depth (distance from the root ) of vertex in the spanning tree . Since is a BFS tree of rooted at , every directed edge in must satisfy:
- Forward-edges (C): With respect to the DFS tree , a forward-edge is a non-tree edge from an ancestor to a proper descendant , which means . This contradicts the BFS property . Hence there can be no forward-edges in with respect to , so (C) is TRUE.
- Back-edges (A) and Cross-edges (B): A back-edge goes from a descendant to an ancestor (), and a cross-edge between two children of has . Both are compatible with being both a DFS tree and a BFS tree, so (A), (B), and (D) are FALSE.
Option (C)
Confusing undirected BFS/DFS trees with directed graphs where back-edges and cross-edges between siblings can still exist.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 1 (CS1)
- Question
- 45 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.