Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B

An undirected graph has the vertices D, E, H, M, O, P, U, V and the edges H–O, H–M, H–D, H–V, O–E, O–V, O–P, M–U, M–V, E–D, E–U, D–U, D–V, D–P, U–V. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?

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

Correct answer: A. 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