Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional
An undirected graph has the vertices F, I, N, P, X, Y and the edges F–X, F–P, P–Y, P–X, I–Y, F–I, F–Y, F–N, N–I, I–X. What is the minimum number of edges that must be deleted so that the remaining graph is bipartite (its vertices can be split into two sets with every edge joining the two sets)?
- A. 3
- B. 5
- C. 1
- D. 2
Correct answer: D. 2
Trying all deletion sets of increasing size finds 2. Deleting vertices instead needs 1 vertex deletions, and the cyclomatic number m − n + 1 = 5 is only a bound on edges removed to break all cycles.
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 graph has the vertices A, H, R, U, V, Y and the arcs V→A, A→H, A→R, U→R, H→R, Y→R, R→A, R→U, R→H. How many strongly connected…
- A directed graph has the vertices A, D, E, I, U and the arcs E→A, E→I, A→E, A→D, D→E, D→I, D→U, I→A, U→E, U→A, U→D. Count the directed…
- An undirected graph has the vertices A, G, N, O, S and the edges O–N, G–S, S–O, S–A, A–N, A–O, S–N. How many simple cycles does it contain…
- A bipartite graph has left side P1, P2, P3 and right side Q1, Q2, Q3, Q4, Q5, with edges P2–Q2, P3–Q1, P2–Q1, P1–Q5, P1–Q4, P1–Q2. What is…
- An undirected connected graph on 5 vertices has the edges (weights in brackets, all distinct): B–H (11), B–I (7), C–H (30), E–I (16), B–C…
- A directed graph with no directed cycles has arcs u→v (weight) : U→C (-1), U→Z (6), U→H (8), U→K (8), C→Z (-2), C→H (-1), Z→H (5), Z→K…