Data Structures & AlgorithmsModerateWipro · Capgemini pattern

What is the maximum number of edges in a directed ACYCLIC graph with 6 vertices (no parallel edges)?

  1. A. 30
  2. B. 15
  3. C. 36
  4. D. 5

Correct answer: B. 15

Fix a topological order; every edge must go from an earlier to a later vertex, so at most one edge per unordered pair: C(6, 2) = 15, achieved by joining every earlier vertex to every later one. 30 would contain both u→v and v→u, a cycle; 5 is a mere path.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic