Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B

An undirected graph has the vertices C, F, M, N, Q, V, X, Z and the edges V–M, V–C, V–N, F–M, F–C, X–Z, X–Q, X–M, Z–M, Z–N, Q–M, M–C. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?

  1. A. 6
  2. B. 5
  3. C. 3
  4. D. 4

Correct answer: D. 4

Because the graph contains an odd cycle it is not bipartite, so the bipartite shortcut of König's theorem does not apply; the true maximum is 4. Taking edges greedily in the listed order yields only 3, a maximal but not maximum matching.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic