Graph Traversal: BFS and DFS Previous Year Questions (PYQs) for GATE DA: 4+ Solved Questions with Step-by-Step Solutions

    Solve 4+ Graph Traversal: BFS and DFS previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Graph Traversal

    Chapter Roadmap: Graph Traversal

    1. Reachability in Directed Graphs Forward and reverse reachability, SCCs 2. DFS Discovery and Edge Classification Tree edges, back edges, cross edges 3. Graph Traversal on Given Diagrams Visual tracing and structural properties

    What you will master

    • How directed edges break the symmetry of connectivity.
    • Using reverse graphs to find strongly connected components.
    • Classifying edges discovered during Depth First Search.
    • Accurately tracing traversals on complex visual diagrams.

    Reachability in Directed Graph Traversals

    Reachability in Directed Graph Traversals

    Understanding how one-way edges change the fundamental nature of graph exploration.

    The Core Shift

    In an undirected graph, a traversal from a source vertex naturally discovers its entire connected component. The path can be traversed in both directions.

    In a directed graph, edges are one-way streets. A traversal from vertex only discovers vertices that are reachable from by following the directed edges. It does not guarantee that those discovered vertices can reach back to .

    Graph Traversal: BFS and DFS: Solved Questions with Step-by-Step Explanations (4 Problems)

    Question 1 · Programming, Data Structures and Algorithms MSQ
    1. A.

    2. B.

    3. C.

    4. D.

    Question 2 · Programming, Data Structures and Algorithms MCQ
    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 ?
    1. A.

      If is a reachable vertex in the BFS of from , then is also a reachable vertex in the DFS of from .

    2. B.

      In , the BFS traversal from will visit exactly the same set of vertices as the DFS from in .

    3. 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 .

    4. D.

      If is a reachable vertex in the DFS of from , then is also a reachable vertex in the BFS of from .

    Question 3 · Programming, Data Structures and Algorithms NAT
    Consider a directed graph , where and . Suppose the adjacency list of each vertex is in decreasing order of vertex number, and depth-first search (DFS) is performed at vertex . The number of vertices that will be discovered after vertex is
    (Answer in integer)
    Question 4 · Programming, Data Structures and Algorithms MCQ
    Consider performing depth-first search (DFS) on an undirected and unweighted
    graph starting at vertex . For any vertex in , is the length of the shortest
    path from to . Let be an edge in such that . If the edge
    is explored first in the direction from to during the above DFS, then
    becomes a ______ edge.
    1. A.

      tree

    2. B.

      cross

    3. C.

      back

    4. D.

      gray

    More previous year questions (pyqs) in this unit

    chapter
    Graph Traversal: BFS and DFS Previous Year Questions (PYQs) for GATE DA: 4+ Solved Questions with Step-by-Step Solutions

    Solve 4+ Graph Traversal: BFS and DFS previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    A question from this chapter

    Question 1
    Question 2
    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 ?
    Question 3
    Consider a directed graph , where and . Suppose the adjacency list of each vertex is in decreasing order of vertex number, and depth-first search (DFS) is performed at vertex . The number of vertices that will be discovered after vertex is
    (Answer in integer)
    Question 4
    Consider performing depth-first search (DFS) on an undirected and unweighted
    graph starting at vertex . For any vertex in , is the length of the shortest
    path from to . Let be an edge in such that . If the edge
    is explored first in the direction from to during the above DFS, then
    becomes a ______ edge.
    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.