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 229 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…