Skip to main content

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…

​​​​Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph GG is/are TRUE?

  1. A
    A DFS tree of GG is a Shortest Path tree of GG.
  2. B
    Every non-tree edge of GG with respect to a DFS tree is a forward/back edge.
    Correct answer
  3. C
    If (u,v)(u, v) is a non-tree edge of GG with respect to a BFS tree, then the distances from the source vertex ss to uu and vv in the BFS tree are within ±1\pm 1 of each other.
    Correct answer
  4. D
    Both BFS and DFS can be used to find the connected components of GG.
    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.