Data Structures & AlgorithmsVery hardGATE CSE · Advanced

A DAG has edges A->B, A->C, B->D, C->D, E->C and F->E (six vertices). How many distinct topological orderings does it have?

  1. A. 6
  2. B. 8
  3. C. 12
  4. D. 9

Correct answer: D. 9

Counting linear extensions of the partial order (A before B, C; B, C before D; F before E before C) gives 9.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic