GATE DA 2026 · Graph Traversals (BFS & DFS)

MCQ · 2 marks · Problem PROG-DIVC-0063

Consider a directed graph \(G=(V, E)\), where \(V\) is the finite set of vertices and \(E\) is the set of directed edges between the vertices. \(G\) may contain cycles but there is no self-loop. Further, \(G\) may not be strongly connected. Let \(G^{R}\) be the graph obtained by reversing the directions of all the edges in \(G\) without changing the set of vertices. Assume that Breadth First Search (BFS) or Depth First Search (DFS) from any given vertex \(v\) of a graph visits only the reachable vertices from \(v\) in that graph. Which of the following statements must always be true, regardless of the structure of \({G}?\)
  1. A
    If \(u\) is a reachable vertex in the BFS of \(G^{R}\) from \(v\), then \(u\) is also a reachable vertex in the DFS of \(G\) from \(v\).
  2. B
    In \(G^{R}\), the BFS traversal from \(v\) will visit exactly the same set of vertices as the DFS from \(v\) in \(G\).
  3. C
    The order of vertices visited in the BFS of \(G^{R}\) from \(v\) is the reverse of the order of vertices visited in the DFS of \(G\) from \(v\).
  4. D
    If \(u\) is a reachable vertex in the DFS of \(G\) from \(v\), then \(v\) is also a reachable vertex in the BFS of \(G^{R}\) from \(u\).

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

Show the worked solutionLet \(u\) be reachable from \(v\) in \(G\) (via DFS or any traversal) — meaning there's a directed path \(v\to u\) in \(G\). Reversing every edge along this path gives a directed path \(u\to v\) in \(G^R\) (by the very definition of the reversed graph). So \(v\) is guaranteed reachable from \(u\) in \(G^R\) — regardless of whether BFS or DFS is used to actually discover this (both correctly find all reachable vertices, just possibly in different orders). This is always true.The other options incorrectly assume that reachability sets or visiting orders must match up directly between \(G\) and \(G^R\), or between BFS and DFS specifically — but reachability in \(G\) and in \(G^R\) can genuinely differ (they involve opposite edge directions), and BFS/DFS traversal orders have no guaranteed relationship to each other beyond visiting the same reachable set within the same graph.Answer: If u is reachable in the DFS of G from v, then v is also reachable in the BFS of \(G^R\) from u.Click Here for Detail SolutionGateOverflow discussion: https://gateoverflow.in/523185/gate-da-2026-question-30

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