GATE DA 2026 | Question 40

Programming, Data Structures and Algorithms › Graphs · MCQ · 2 marks · Answer: D

  1. Question 40Programming, Data Structures and Algorithmsmcq2 marks
    Consider a directed graph , where is the finite set of vertices and is the set of directed edges between the vertices. may contain cycles but there is no self-loop. Further, may not be strongly connected. Let be the graph obtained by reversing the directions of all the edges in without changing the set of vertices. Assume that Breadth First Search (BFS) or Depth First Search (DFS) from any given vertex of a graph visits only the reachable vertices from in that graph. Which of the following statements must always be true, regardless of the structure of ?
    • A.
      If is a reachable vertex in the BFS of from , then is also a reachable vertex in the DFS of from .
    • B.
      In , the BFS traversal from will visit exactly the same set of vertices as the DFS from in .
    • C.
      The order of vertices visited in the BFS of from is the reverse of the order of vertices visited in the DFS of from .
    • D.
      If is a reachable vertex in the DFS of from , then is also a reachable vertex in the BFS of from .
      ✓

    Answer: D

    Solution

    Key fact: a path in is exactly a path in . - (D) If is reachable from in , reversing that path gives in . So BFS of from reaches . Always true. - (A) and (B) Reachable from in means "can reach in ", which is not the same set. Counterexample: the single edge . In , reaches , but in , does not reach . - (C) Visiting orders have no such reversal relationship. Answer: (D).

Attempt GATE DA 2026 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →