GATE CS 2025 · Set 2 · Graph Traversals (BFS & DFS)

MSQ · 1 mark · Problem PROG-GRPH-0011

Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph \(G\) is/are TRUE?
  1. A
    A DFS tree of \(G\) is a Shortest Path tree of \(G\).
  2. B
    Every non-tree edge of \(G\) with respect to a DFS tree is a forward/back edge.
  3. C
    If \((u, v)\) is a non-tree edge of \(G\) with respect to a BFS tree, then the distances from the source vertex \(s\) to \(u\) and \(v\) in the BFS tree are within \(\pm 1\) of each other.
  4. D
    Both BFS and DFS can be used to find the connected components of \(G\).

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solutionOfficial GATE Answer Key: B, C, D.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/460816/gate-cse-2025-set-2-question-19

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com