How this calculation works
An ordinary coloring separates adjacent vertices into distinct classes. A circular coloring adds a distance condition: colors are residues around a ring of p positions, and adjacent vertices must lie at least q positions apart in either direction. Its scale is the rational ratio p/q.
Use a sharp finite rational candidate theorem: for a finite n-vertex nonempty graph, chi_c=p/q in lowest terms with p≤n (and hence q≤n); plan p≤n² is safe but wasteful. Verify theorem/convention before production. Enumerate candidate reduced p/q≥2 in ascending numerical order, solve c:V→{0,…,p−1} requiring q≤|c(u)−c(v)|≤p−q on edges. Fix one vertex color0 to remove rotation. Edgeless nonempty convention chi_c=1. Return full p/q and integer colors. Cap before all smaller candidates exhausted leaves only bounds.A worked example
With the prefilled inputs, value = 2.5.
Good to know
Finite simple-graph circular chromatic optimum has a reduced numerator at most n; all smaller candidate ratios exhausted. Not a fixed-circle drawing.
Reference: Primary method reference or author-maintained documentation (opens in a new tab) ↗
Circular coloring places colors on a finite ring
An ordinary coloring separates adjacent vertices into distinct classes. A circular coloring adds a distance condition: colors are residues around a ring of p positions, and adjacent vertices must lie at least q positions apart in either direction. Its scale is the rational ratio p/q.
The circular chromatic number is the smallest feasible ratio under this discrete definition. The numerator and denominator are part of the certificate, not merely a decimal approximation. Keeping them exact avoids rounding a nearby feasible ratio into a false optimum.
Compare with the Chromatic polynomial calculator from a graph edge list. Compute cyclic p/q separation constraints and circular chromatic number, a rational invariant finer than integer proper coloring.
Read the two-sided distance constraint
Use the prefilled input structure and preserve the declared column or index order. For an edge whose assigned residues differ by d between zero and p−1, feasibility requires q≤d≤p−q after taking the ordinary nonnegative difference. Equivalently, both arcs around the color ring must have length at least q. Adjacent equal residues can never satisfy a positive q.
Declare every graph vertex, including isolated ones, and submit distinct unordered edges without loops. A loop makes the usual circular coloring impossible because the same vertex would need a positive circular distance from itself. The input domain excludes loops rather than hiding this contradiction.
Search rational candidates in exact order
For a finite loopless graph whose reduced circular chromatic number is p/q, the numerator p is at most the number of vertices n. The engine therefore enumerates all distinct candidate ratios with p≤n, q≥1 and p≥2q, ordered by exact cross-products. This theorem-backed finite domain is complete for nonempty-edge inputs; it is not an arbitrary denominator cutoff.
For each ratio, a constraint search assigns integer residues and checks every edge. Rotating all colors preserves feasibility, so fixing one vertex to residue zero removes equivalent assignments. A found coloring proves feasibility; excluding every smaller candidate establishes the minimum.
Color the five-cycle with ratio five over two
For consecutive vertices zero through four on a five-cycle, assign residues zero, two, four, one and three modulo five. Every edge has circular separation two in its shorter direction. Thus the graph admits a five-over-two coloring, smaller than its ordinary three-color requirement.
A triangle would require three mutually separated colors and has circular chromatic number three. The five-cycle's ratio of two and a half illustrates why the circular parameter contains information beyond simply taking the ordinary chromatic number and displaying it with a decimal point.
Show residues and gaps on the color ring
A static ring diagram should label the p residue positions, show the q separation threshold and connect each graph vertex to its assigned residue. A separate table can list the two directed residue gaps for every graph edge, making the distance constraints directly checkable.
The graph's geometric drawing and its color circle play different roles. Vertex positions in the original graph do not enter the computation. The color ring represents modular arithmetic, so its cyclic labels and wraparound gap must be visible even when the original graph is drawn as a path.
Relate the circular answer to ordinary coloring
For the standard nonempty loopless graph convention, the ordinary chromatic number is the ceiling of the circular chromatic number. This relation is a consistency check on a completed exact result. It does not determine the rational value between consecutive integers.
Bipartite graphs with an edge admit a two-over-one coloring. Nonempty edgeless graphs use the stated value one. Separating these cases prevents a no-edge input from being forced through a search that starts at ratio two and would otherwise return the wrong boundary convention.
A denominator cutoff alone cannot certify the minimum
Stopping at a convenient set of denominators without a mathematical completeness argument supplies only a restricted search result. The proposed engine must verify and implement a finite theorem bound before labeling the value exact for every accepted graph.
When the work budget interrupts a candidate coloring search, the implementation raises an unresolved error and returns no completed rational optimum. It does not currently display a best-feasible upper ratio or an exclusion interval. Complete graphs, even cycles and odd cycles provide independent exact-value regression cases. The public prefill is the five-cycle shown here. The successful output retains exact numerator, denominator and per-vertex integer residues alongside the decimal ratio. For an edgeless nonempty graph, the special result is one with every color zero; the candidate enumeration for graphs with edges begins at ratio two instead. Finite simple-graph circular chromatic optimum has a reduced numerator at most n; all smaller candidate ratios exhausted. Not a fixed-circle drawing.
A few questions, answered
Why is the answer a fraction instead of an integer?
The ratio p/q measures color-ring size relative to the required spacing, allowing finer distinctions than ordinary integer coloring.
Can adjacent vertices use neighboring residues?
Only if their circular gaps meet q. For q greater than one, neighboring residue positions violate the required separation.
Is a five-over-two coloring the same as five colors?
It uses five residue positions with spacing two. Its ratio is two and a half, which is the parameter being minimized.
Does checking denominators up to ten prove an exact result?
Only if a theorem guarantees completeness for the accepted graph size. A convenient cutoff without that argument does not prove optimality.