Open In App

GATE | GATE-CS-2007 | Question 5

Consider the DAG with Consider V = {1, 2, 3, 4, 5, 6}, shown below. Which of the following is NOT a topological ordering? 

 


(A)

1 2 3 4 5 6

(B)



1 3 2 4 5 6

(C)

1 3 2 4 6 5

(D)

3 2 4 1 6 5


Answer: (D)
Explanation:

In option D, 1 appears after 2 and 3 which is not possible in Topological Sorting. In the given DAG it is directly visible that there is an outgoing edge from vertex 1 to vertex 2 and 3 hence 2 and 3 cannot come before vertex 1 so clearly option D is an incorrect topological sort. But for questions in which it is not directly visible, we should know how to find a topological sort of a DAG. 

 

Hence Option(D) is the correct answer.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :