How this calculation works
Partition every vertex into the fewest pairwise adjacent classes and return the complete partition.
p(∅)=0; p(S)=1+min{p(S\C): C is a clique containing the first vertex of S}.A worked example
Vertices 0,1,2 form a triangle and vertices 3,4 form an edge. Those two classes partition the default graph, so the minimum is two.
Good to know
Simple undirected graphs on 1–12 vertices; exact subset dynamic programming. No loops, duplicate pairs, weights or overlapping classes. One optimum is returned.
Cover every vertex exactly once
A clique partition divides the declared vertex set into disjoint classes, each of which induces a complete graph. Every two different vertices within a class must share an edge. The objective counts classes, including singleton classes, rather than counting edges or maximizing the size of one group.
The partition requirement matters whenever a graph contains a large clique and several awkward leftover vertices. Finding that large clique alone does not finish the problem. Every leftover vertex needs a compatible class, and a locally attractive first choice can prevent the smallest possible complete partition.
Compare this with the Maximal clique calculator from graph edge list. Partition all vertices into the fewest complete induced classes;finding one large clique does not partition the entire graph.
Describe the graph without losing isolates
Declare the number of vertices and enter one undirected edge per row. Labels run from zero to one below the count. Missing rows mean missing adjacency; an absent label still denotes an isolated vertex. Such a vertex can only occupy its own singleton clique class.
Two endpoints are required for every row. Commas and spaces are accepted separators. Reverse duplicates describe the same undirected pair and are rejected, as are self loops, fractional labels and endpoints outside the declared range. Correcting an input rebuilds the partition search from the complete corrected graph.
Check the triangle and tail example
The default graph contains the triangle on vertices zero, one and two, followed by edges from two to three and three to four. One valid partition groups the triangle together and groups three with four. Both classes are complete and their union includes all five declared vertices.
A single class would require all five vertices to be mutually adjacent. The missing edge between zero and four immediately rules that out. Therefore the displayed two-class witness meets a matching lower bound. It demonstrates optimality without relying on the program’s search-state count or a drawing convention.
Why subset dynamic programming proves a minimum
For any remaining vertex subset, consider the class containing its first vertex. Enumerating every clique containing that vertex covers every possible first class in a partition. Once that class is removed, the rest of the task is the same problem on a strictly smaller vertex subset.
The empty subset needs zero classes. A table stores the best value for every subset and records which clique attained it. This avoids solving identical residual subsets repeatedly. Reconstructing those saved choices produces a partition whose class count agrees with the optimum table entry for the full graph.
Inspect the returned classes
Read each inner list as one clique class, not a path or an ordering around a cycle. To verify a witness, check that no label occurs twice, that every declared label occurs somewhere, and that all pairs within each list appear in the original edge set.
The number of lists must equal the reported minimum. Class labels and their display order have no mathematical significance. Several different partitions can tie for the same value; vertex relabeling or input ordering can change which witness is selected while leaving the optimum class count unchanged.
Compare partitioning with coloring
A clique in the original graph is an independent set in its complement. Consequently, a minimum clique partition has the same value as a minimum proper coloring of the complement. This equivalence gives another interpretation and a useful way to check small examples by hand.
Do not confuse the answer with the largest clique size in the original graph. A complete graph has a clique partition of one class, whereas an edgeless graph needs one class per vertex. Those opposite extremes make useful sanity checks before applying the calculator to a less obvious example.
Use the bounded answer appropriately
Twelve vertices permit an exact enumeration of clique subsets without suggesting that general clique partition is easy. Runtime depends on the declared vertex count and the number of candidate subcliques. The calculator accepts a deliberately small graph so its final answer can include a complete, independently inspectable partition.
A weighted clustering objective, overlapping community model or requirement that every class have equal size would define a different optimization problem. This tool assigns no cost to putting an allowed pair together. Its sole preference is fewer complete classes while preserving disjointness and complete coverage of the entered vertex set.
A few questions, answered
Does the largest clique give the partition number?
No. The objective partitions every vertex into disjoint cliques, including any leftovers.
Can classes overlap?
No. Every declared vertex must occur in exactly one class.
How are isolated vertices handled?
Each isolated vertex requires a singleton class.
Why can two returned partitions differ?
Several partitions can attain the same minimum; one witness is returned.