Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph is/are TRUE?
GATE CSE 2025Algorithms › Graph AlgorithmsVerified
GATE CSE 2025 PYQ: Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on…
- AA DFS tree of is a Shortest Path tree of .
- BEvery non-tree edge of with respect to a DFS tree is a forward/back edge.Correct answer
- CIf is a non-tree edge of with respect to a BFS tree, then the distances from the source vertex to and in the BFS tree are within of each other.Correct answer
- DBoth BFS and DFS can be used to find the connected components of .Correct answer
Answer
(B, C, D) Every non-tree edge of G G G with respect to a DFS tree is a forward/back edge.; If ( u , v ) (u, v) ( u , v ) is a non-tree edge of G G G with respect to a BFS tree, then the distances from the source vertex s s s to u u u and v v v in the BFS tree are within ± 1 \pm 1 ± 1 of each other.; Both BFS and DFS can be used to find the connected components of G G G .
Approach
Evaluate each statement against standard BFS/DFS properties for undirected graphs, using known edge classifications and distance-level guarantees.
The true statements are B, C, and D. Statement A is false because DFS does not guarantee shortest paths; BFS does in unweighted graphs.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.