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

📖 Explanation
A topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge from vertex u to vertex v, u comes before v in the ordering. A graph has a topological ordering if and only if it is a Directed Acyclic Graph (DAG). The given graph is a DAG, so at least one topological ordering exists.
- Analyze the graph:
- Edges: P→Q, P→R, S→R, Q→Z, R→Z.
- Evaluate Option A: Since the graph is a DAG (no cycles), it must have at least one topological ordering. is false.
- Evaluate Option B (PQRS): In the ordering PQRS, S comes before R. However, there is an edge S→R, which means S must come before R. This part is consistent. However, consider P→R. In PQRS, P comes before R. Consistent.
Evaluate Option B (SRQP): In the ordering SRQP, Q comes before P. But there's an edge P→Q, implying P must come before Q. Thus, SRQP is not a valid topological ordering. is false. - Evaluate Option C (PSRQ):
- P→Q: P comes before Q (Consistent)
- P→R: P comes before R (Consistent)
- S→R: S comes before R (Consistent)
- Q→Z: Q comes before Z (Consistent, as Z is not in this sequence)
- R→Z: R comes before Z (Consistent, as Z is not in this sequence)
- Thus, PSRQ is a valid topological ordering.
Evaluate Option C (SPRQ): - P→Q: P comes before Q (Consistent)
- P→R: P comes before R (Consistent)
- S→R: S comes before R (Consistent)
- Q→Z: Q comes before Z (Consistent, as Z is not in this sequence)
- R→Z: R comes before Z (Consistent, as Z is not in this sequence)
- Thus, SPRQ is also a valid topological ordering.
is true.
- Evaluate Option D: Since we found two valid topological orderings in Option C, PSRQ is not the only topological ordering. is false.

