How this calculation works
Find the fewest vertex deletions making an undirected graph bipartite, with an explicit retained two-coloring.
τ_odd(G)=min{|S|: G[V\S] is bipartite}; equivalently S meets every odd cycle.A worked example
The five-cycle is not bipartite. Deleting vertex 0 leaves path 1–2–3–4 with classes {1,3} and {2,4}, proving an optimal deletion count of 1.
Good to know
Simple undirected graphs on 1–18 vertices. Increasing-cardinality exact deletion search with 300,000 candidate-test cap, breadth-first bipartition checks and a returned witness. Unit vertex costs only; no edge deletions, all-cycle removal, weighted interventions or unique optimum guarantee.
Reference: Research definition: odd-cycle transversal and bipartiteness (opens in a new tab) ↗
Delete vertices to remove every odd cycle
An odd-cycle transversal is a set of vertices meeting every odd cycle in an undirected graph. Deleting that set leaves a bipartite graph. The objective is to minimize the number of deleted vertices while retaining every remaining edge between surviving vertices.
This differs from a feedback vertex set, which must destroy all cycles, including even ones. An even cycle can remain completely intact after a valid odd-cycle deletion. The target is bipartiteness rather than a forest, so using a general cycle-removal answer may delete more vertices than necessary.
Compare this with the Minimum feedback vertex set calculator for a directed graph. Delete the fewest vertices to make an undirected graph bipartite; deleting all directed or undirected cycles is a different target.
Declare the entire simple graph
Enter a vertex count and unordered edges using zero-based labels. Isolated vertices remain in the universe and normally need not be deleted. Disconnected components are allowed; a surviving bipartition can be chosen independently within each component, with either side swapped without changing validity.
The page does not delete selected edges or attach different costs to vertices. Every deleted vertex has unit cost, regardless of its degree. Loops and parallel pairs are excluded so that the usual simple-graph equivalence between bipartiteness and absence of odd cycles applies directly to every accepted input.
Enumerate deletion sizes in increasing order
The search tests deletion sets of size zero first, then size one, and continues upward. For each candidate, a breadth-first two-coloring explores the retained induced graph. An edge joining two vertices assigned the same color is a contradiction and rejects that candidate.
The first successful deletion cardinality is minimal because every smaller cardinality has already been exhausted. The calculator returns one successful set and the resulting two-coloring. It does not need to list every odd cycle: a valid bipartition simultaneously certifies that none remain in the surviving graph.
One vertex breaks the default five-cycle
The default graph is the cycle 0–1–2–3–4–0. It has five edges and therefore an odd cycle, so a zero-deletion solution is impossible. Deleting vertex zero removes its two incident edges and leaves the four-vertex path 1–2–3–4.
That path is bipartite, with classes {1,3} and {2,4}. Thus one deletion is sufficient and, because zero failed, one is optimal. Any cycle vertex would work for this symmetric example, so the returned removed label is a witness rather than a uniquely required intervention.
Audit the returned bipartition
Every retained vertex receives color zero or one, and deleted vertices receive a separate sentinel in the displayed color vector. The left and right lists contain exactly the surviving vertices. Check each original edge whose endpoints survive: its endpoints must lie in opposite lists.
Edges incident to a removed vertex are absent from the retained induced graph and should not be tested as if both endpoints remained. If your application physically removes only some of a vertex's connections, it is an edge-deletion problem instead. That operation is different from the whole-vertex deletion model solved here.
Exactness within the supported universe
The supported graph has at most eighteen vertices and a fixed candidate-test cap. Search is finite, but difficult instances may require examining many deletion sets before reaching the first feasible cardinality. The reported subset count describes completed candidate tests, not a statistical sample or probability of optimality.
An exhausted resource budget raises an unresolved-search error rather than a minimum deletion count. A bipartition found only after relaxing the objective would be a feasible upper bound, not automatically a minimum, so this page reports optimality only after the increasing-cardinality search has completed the necessary preceding layers.
Interpret surviving cycles correctly
A surviving square is not evidence that the calculator failed. Four-cycle vertices can alternate between the two sides, and the even cycle is consistent with bipartiteness. The obstruction is an odd cycle, whose alternating colors return to the starting vertex with the wrong parity.
For an already bipartite input, the minimum is zero and the result still provides a two-coloring certificate. For a graph with several components, each component can choose its side orientation independently. Therefore differences in color numbers across runs or relabelings do not imply different retained structures when the underlying partition equivalence is unchanged.
A few questions, answered
May an even cycle survive?
Yes. Even cycles are bipartite and do not need to be destroyed by an odd-cycle transversal.
How does this differ from a feedback vertex set?
A feedback vertex set destroys every cycle, whereas this objective only requires the remaining graph to have no odd cycles.
Does deleting a vertex remove its incident edges?
Yes. The retained graph is induced by the surviving vertices, so all edges incident to a removed vertex disappear.
Why can different bipartition labels both be correct?
The two sides can be swapped independently in each connected component without changing bipartiteness.