Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
An undirected graph has the vertices C, D, F, L, U, X and the edges F–L, F–D, F–C, L–U, L–C, U–C, X–C. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?
- A. 5
- B. 4
- C. 2
- D. 3
Correct answer: D. 3
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 3. Taking edges greedily in the listed order yields only 2, a maximal but not maximum matching.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- A directed weighted graph has the arcs u→v (weight): Q→H (15), Q→Y (9), H→Q (8), H→Y (3), H→E (13), B→Q (8), B→Y (2), B→E (4), Y→H (2)…
- A connected undirected graph has the vertices B, G, P, R, S and weighted edges (weights in brackets): S–P (19), G–R (10), G–S (14), S–B…
- An undirected connected graph on the vertices B, N, S, V, Z has the edges B–Z, S–Z, S–N, B–V, Z–N, B–N, B–S, Z–V. How many spanning trees…
- An undirected graph has the vertices A, B, E, F, G, I, J, L, N, R and the edges G–J, G–B, G–R, J–F, J–R, F–L, F–B, F–N, F–E, L–N, L–R…
- A tree has the vertices A, C, F, N, O, S, W, Y, Z and the edges A–C, C–O, A–S, A–Z, O–N, A–F, C–Y, C–W. A centroid is a vertex whose…
- An undirected graph has the vertices J, N, T, U, Z and the edges Z–N, J–U, Z–U, Z–J, T–J, J–N, T–U, T–Z, N–U, T–N. What is the minimum…