Machine-translated by Google. Questions are authored in English.
Top

Discussion

The discovery and finish time for the vertex 5 in depth first traversal for the following graph is :

Directed graph on vertices 1 to 6 with edges 1 to 2, 1 to 4, 4 to 2, 2 to 5, 4 to 5, 3 to 1, 3 to 5 and 3 to 6

  • A.3, 5
  • B.4, 5
  • C.2, 6
  • D.1, 3

Answer: B

Vertex 5 is discovered at time 4 and finished at time 5, so the answer is 4, 5.

Vertex 5 has no outgoing edges, so once depth first search discovers it at time d, it has nothing to explore and finishes immediately at time d + 1. Of the options, only (4, 5) has the finish time exactly one more than the discovery time, which rules out (3, 5), (2, 6) and (1, 3).

One search giving these times starts at vertex 3, the only vertex with no incoming edge: 3 is discovered at time 1, 1 at time 2, 2 at time 3 and then 5 at time 4, and 5 finishes at time 5.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.