How this calculation works
Find the smallest number of edge insertions and deletions turning a simple graph into a disjoint union of cliques.
cost(Π)=#{uv∈E:Π(u)≠Π(v)}+#{uv∉E:Π(u)=Π(v)}.A worked example
The path 0–1–2 is not a cluster graph. Inserting 0–2 makes a triangle with one edit; deleting either existing edge also gives a one-edit optimum.
Good to know
Simple undirected unweighted graphs on 1–10 vertices, every absent pair treated as a nonedge. Canonical set-partition search with nonnegative-cost pruning and 1,000,000 partial-state cap. One optimum and edit list; no weighted or unknown-pair model, fixed cluster count or forced assignments.
Reference: Abu-Khzam: cluster-editing definition and scope (opens in a new tab) ↗
Turn a graph into disjoint cliques
Cluster editing seeks a graph in which every connected component is complete. Vertices assigned to the same cluster must be adjacent, and vertices assigned to different clusters must not be adjacent. Both inserting a missing edge and deleting an existing edge count as one edit.
This differs from finding a clique partition of the original graph. A partition into complete classes may leave many original edges between those classes. Cluster editing must remove those cross-cluster edges as well, or else the edited components would remain connected without forming the required separate cliques.
Compare this with the Minimum clique partition calculator with vertex classes. Insert and delete the fewest edges to obtain disjoint cliques; a clique partition cannot delete arbitrary missing inter-clique edges for this objective.
Interpret an absent edge deliberately
Declare all vertices, including any isolated items, then list each undirected edge once. An edge expresses a pair that currently belongs together, while a missing edge expresses a pair currently separated. The objective penalizes disagreeing with either kind of observation equally.
The unweighted setting does not allow an unknown or unobserved pair to be omitted without consequence: omission means a nonedge. If your data contain uncertain relationships, treating all unknown pairs as negative evidence may be inappropriate. That modeling issue cannot be corrected by the optimization, which only sees the entered simple graph.
Every partition defines one edited graph
Fix a partition of the vertex set. Its target graph is uniquely determined: include every within-class pair and exclude every between-class pair. Counting differences from the input edge set gives the exact edit cost of that partition, without having to search separate insertion and deletion sequences.
The calculator enumerates set partitions using canonical class labels and accumulates the disagreement cost as vertices are placed. A partial cost never decreases because every additional pair contributes either zero or one. Branches whose current cost already cannot beat the best complete partition are safely pruned.
One edit resolves the three-vertex path
The default graph contains edges 0–1 and 1–2, with 0–2 absent. It is connected but not complete, so zero edits cannot work. Insert edge 0–2 and the three vertices form a complete triangle, producing a valid single-cluster target.
Deleting either existing edge is also a one-edit solution: the remaining edge forms a two-vertex clique and the separated endpoint forms a singleton clique. The minimum cost is therefore one, although the optimum partition is not unique. The diagram shows the insertion witness, while the result table states the chosen edit explicitly.
Read the partition and edit list together
The partition tells you the intended final classes. The edit list tells you how the original graph changes to realize them. An insertion should connect two vertices in the same returned class; a deletion should separate vertices assigned to different returned classes.
After applying those edits, test each connected component for completeness. A component with s vertices must contain s times s minus one divided by two edges. The calculator's reported edit count equals the length of its explicit edit list, giving a direct consistency check between the scalar answer and the returned construction.
Small exact instances and cutoffs
This implementation supports at most ten vertices and a fixed enumeration cap. The number of set partitions grows faster than an ordinary subset count, so the vertex bound matters even when the edge list is short. Disconnected input is accepted because the objective can still examine all possible cluster assignments.
A resource-cap exception is not a statement that no cluster graph exists: deleting every edge always yields singleton components. It means that the smallest edit cost has not been certified by this run. The page never publishes the current best partition as a proven optimum when the exact search is interrupted.
What an optimal cluster does not establish
A low edit cost means that the entered pairwise relation is close to a union of cliques under the chosen unit penalty. It does not prove that the clusters identify real categories or causal groups. Different evidence weights or treatment of missing observations can change the preferred partition.
Use the edit list to investigate the exceptional pairs rather than automatically accepting every proposed change. A single false positive edge between two otherwise strong clusters can be cheaper to delete than many missing within-cluster links would be to add. The objective exposes that tradeoff, but it does not decide which source observation was mistaken.
A few questions, answered
Why is a clique partition not enough?
Original edges between chosen cliques must also be deleted, otherwise the final graph is not a union of separate complete components.
Do insertions and deletions have equal cost?
Yes. Each changed unordered pair costs one in this unweighted implementation.
Can the optimum be nonunique?
Yes. The three-vertex path has multiple one-edit solutions, and the calculator returns one valid minimum-cost witness.
Are omitted pairs unknown observations?
No. Every omitted pair is a definite nonedge here; uncertain evidence requires a different model.