Consider the following sequences of nodes for the undirected graph shown…

GATE · 2008 · IT

Consider the following sequences of nodes for the undirected graph shown below:

image.png
  1. a b e f d g c

  2. a b e f c g d

  3. a d g e b c f

  4. a d b c g e f

A Depth First Search (DFS) is started at node a. The nodes are listed in the order they are first visited. Which of the above can be produced as DFS outputs?

  1. A.

    1 and 3 only

  2. B.

    2 and 3 only

  3. C.

    2, 3 and 4 only

  4. D.

    1, 2, and 3

Attempted by 245 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…