GateAI
Graph Traversals

GATE CSE 2016 Set 1 · Q11

NAT1 markEasy

Time

Consider the following directed graph: The number of different topological orderings of the vertices of the graph is _________.

GATE CSE 2016 Set 1 Q11 diagram

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 6 (±0)

Graph Traversals

In a topological ordering of a Directed Acyclic Graph (DAG), for every directed edge u→vu \to v, vertex uu must appear before vertex vv.

  1. Vertex aa has in-degree 00, so it must always appear first (at position 1).

  2. Vertex ff has out-degree 00, so it must always appear last (at position 6).

  3. The remaining vertices are along two independent paths:

    • Path 1: b→cb \to c (meaning bb must appear before cc)

    • Path 2: d→ed \to e (meaning dd must appear before ee)

  4. The 4 intermediate positions (positions 2, 3, 4, 5) must be filled by the set of vertices {b,c,d,e}\{b, c, d, e\}.

The total number of valid topological orderings corresponds to the number of ways to interleave the sequences (b,c)(b, c) and (d,e)(d, e) into 4 positions:

(42)=4!2!×2!=6\binom{4}{2} = \frac{4!}{2! \times 2!} = 6

The 6 possible topological orderings are:

  • a,b,c,d,e,fa, b, c, d, e, f

  • a,b,d,c,e,fa, b, d, c, e, f

  • a,b,d,e,c,fa, b, d, e, c, f

  • a,d,b,c,e,fa, d, b, c, e, f

  • a,d,b,e,c,fa, d, b, e, c, f

  • a,d,e,b,c,fa, d, e, b, c, f

Hence, the correct answer is 6.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Graph Traversals previous year question is Q11 of the GATE CSE 2016 Set 1 paper. Find more GATE CSE PYQs on Graph Traversals in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Graph Traversals PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Graph Traversals in GATE CSE

Graph Traversals has 16 GATE CSE PYQs across 12 papers from 2014 to 2026. 2 of them are 1-mark NAT questions like this one, and it is the only one in GATE CSE 2016 Set 1.

How GATE tests Graph Traversals

More from GATE CSE 2016 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2016 Set 1 · Q11 · NAT

Consider the following directed graph: The number of different topological orderings of the vertices of the graph is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.