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

2016

Consider the following directed graph:

The number of different topological orderings of the vertices of the graph is ______________ .

Attempted by 19 students.

Show answer & explanation

Correct answer: 6

Key insight: the graph splits into two chains that start at a and merge at f; a must come before b and d, and f must come after c and e.

  • Step 1: Identify the chains. After a, the two chains are b → c and d → e, and both chains must finish before f.

  • Step 2: Fix a at the start and f at the end. All topological orders have a first and f last because a is the only vertex with no incoming edges and f has incoming edges from both chains.

  • Step 3: Count interleavings. We need the number of ways to interleave the two length-2 sequences (b,c) and (d,e) while preserving order within each. The number of such interleavings is choose(4,2) = 6.

Therefore the number of different topological orderings is 6.

Example explicit orderings (all begin with a and end with f):

  1. a, b, c, d, e, f

  2. a, b, d, c, e, f

  3. a, b, d, e, c, f

  4. a, d, b, c, e, f

  5. a, d, b, e, c, f

  6. a, d, e, b, c, f

Explore the full course: Gate Guidance By Sanchit Sir