GATE | GATE-CS-2014-(Set-1) | Question 22

Consider the directed graph given below. Which one of the following is TRUE?

GATECS2014Q22
(A) The graph doesn’t have any topological ordering
(B) Both PQRS and SRPQ are topological ordering
(C) Both PSRQ and SPRQ are topological ordering
(D) PSRQ is the only topological ordering


Answer: (C)

Explanation: The graph doesn’t contain any cycle, so there exist topological ordering.

P and S must appear before R and Q because there are edges from P to R and Q, and from S to R and Q.

See Topological Ordering for more details.


Quiz of this Question

My Personal Notes arrow_drop_up