Source
KColoring/SimpleGraph
Target
Satisfiability
Motivation
This standard CNF encoding gives every registered K-Coloring variant a direct decision-to-decision path to SAT. It is structurally simple but exercises exactly-one constraints, runtime color counts, and solution extraction.
Reference
Garey and Johnson, Computers and Intractability, 1979, GT4 and LO1, provide the Graph K-Colorability and Satisfiability problem definitions; they do not present this reduction direction.
Faber, Jabrayilov, and Mutzel, “SAT Encoding of Partial Ordering Models for Graph Coloring Problems,” SAT 2024, §2.2, equations (8a)–(8b), explicitly give the assignment-based clauses for K-Colorability: one at-least-one-color clause per vertex and one same-color conflict clause per edge and color. The paper also discusses at-most-one encodings; this issue uses the standard pairwise (binomial) encoding. DOI: https://doi.org/10.4230/LIPIcs.SAT.2024.12.
Reduction Algorithm
Given G=(V,E), n=|V|, m=|E|, and k=num_colors:
- Create variable
x[v,c] for every vertex v and color c in {0,...,k-1}.
- For each vertex
v, add (x[v,0] OR ... OR x[v,k-1]).
- For each vertex
v and colors a<b, add (not x[v,a] OR not x[v,b]).
- For each edge
{u,v} and each color c, add (not x[u,c] OR not x[v,c]).
- Extract the unique true color for each vertex.
For the forward direction, a valid coloring satisfies the CNF by setting exactly x[v,color(v)] true for every vertex: the vertex clauses hold, pairwise exclusions hold, and every edge-conflict clause holds because adjacent vertices have different colors. For the backward direction, the clauses from steps 2 and 3 make exactly one x[v,c] true for each vertex; extracting that color gives a coloring, and step 4 forbids equal colors on every edge. The construction is polynomial, with the exact counts below.
The construction also handles the repository domain beyond the standard literature convention of a loop-free graph and positive k. When k=0, a nonempty graph receives an empty at-least-one clause and is infeasible, while the empty graph remains feasible. A self-loop makes every possible color conflict with itself and is therefore infeasible; parallel edges only duplicate conflict clauses; isolated vertices, disconnected graphs, and k>|V| require no special handling. All cases match the source definition.
Size Overhead
| Target metric |
Formula |
num_vars |
num_vertices * num_colors |
num_clauses |
num_vertices + num_vertices * num_colors * (num_colors - 1) / 2 + num_edges * num_colors |
num_literals |
num_vertices * num_colors + num_vertices * num_colors * (num_colors - 1) + 2 * num_edges * num_colors |
Validation Method
- Exhaust all simple graphs through four vertices for
k=2 and k=3.
- Brute-force all colorings and SAT assignments and compare feasibility.
- Check extraction and the
k=0, empty-graph, isolated-vertex, odd-cycle, and complete-graph cases.
Example
- Source instance: the five-cycle
01,12,23,34,40 with k=3.
- Construction: 15 variables. Each vertex receives one 3-literal at-least-one clause and three pairwise exclusion clauses; each of five edges contributes three color-conflict clauses.
- Target witness: colors
[0,1,0,1,2], encoded by true variables x[0,0],x[1,1],x[2,0],x[3,1],x[4,2].
- Round trip: extraction returns the valid coloring. The same graph is not 2-colorable, making the instance sensitive to incorrect color-count handling rather than being a trivial bipartite example.
BibTeX
@book{GareyJohnson1979,
author = {Garey, Michael R. and Johnson, David S.},
title = {Computers and Intractability: A Guide to the Theory of NP-Completeness},
publisher = {W. H. Freeman},
year = {1979}
}
@inproceedings{FaberJabrayilovMutzel2024,
author = {Faber, Daniel and Jabrayilov, Adalat and Mutzel, Petra},
title = {SAT Encoding of Partial Ordering Models for Graph Coloring Problems},
booktitle = {27th International Conference on Theory and Applications of Satisfiability Testing (SAT 2024)},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
volume = {305},
pages = {12:1--12:20},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik},
year = {2024},
doi = {10.4230/LIPIcs.SAT.2024.12}
}
Source
KColoring/SimpleGraph
Target
Satisfiability
Motivation
This standard CNF encoding gives every registered K-Coloring variant a direct decision-to-decision path to SAT. It is structurally simple but exercises exactly-one constraints, runtime color counts, and solution extraction.
Reference
Garey and Johnson, Computers and Intractability, 1979, GT4 and LO1, provide the Graph K-Colorability and Satisfiability problem definitions; they do not present this reduction direction.
Faber, Jabrayilov, and Mutzel, “SAT Encoding of Partial Ordering Models for Graph Coloring Problems,” SAT 2024, §2.2, equations (8a)–(8b), explicitly give the assignment-based clauses for K-Colorability: one at-least-one-color clause per vertex and one same-color conflict clause per edge and color. The paper also discusses at-most-one encodings; this issue uses the standard pairwise (binomial) encoding. DOI: https://doi.org/10.4230/LIPIcs.SAT.2024.12.
Reduction Algorithm
Given
G=(V,E),n=|V|,m=|E|, andk=num_colors:x[v,c]for every vertexvand colorc in {0,...,k-1}.v, add(x[v,0] OR ... OR x[v,k-1]).vand colorsa<b, add(not x[v,a] OR not x[v,b]).{u,v}and each colorc, add(not x[u,c] OR not x[v,c]).For the forward direction, a valid coloring satisfies the CNF by setting exactly
x[v,color(v)]true for every vertex: the vertex clauses hold, pairwise exclusions hold, and every edge-conflict clause holds because adjacent vertices have different colors. For the backward direction, the clauses from steps 2 and 3 make exactly onex[v,c]true for each vertex; extracting that color gives a coloring, and step 4 forbids equal colors on every edge. The construction is polynomial, with the exact counts below.The construction also handles the repository domain beyond the standard literature convention of a loop-free graph and positive
k. Whenk=0, a nonempty graph receives an empty at-least-one clause and is infeasible, while the empty graph remains feasible. A self-loop makes every possible color conflict with itself and is therefore infeasible; parallel edges only duplicate conflict clauses; isolated vertices, disconnected graphs, andk>|V|require no special handling. All cases match the source definition.Size Overhead
num_varsnum_vertices * num_colorsnum_clausesnum_vertices + num_vertices * num_colors * (num_colors - 1) / 2 + num_edges * num_colorsnum_literalsnum_vertices * num_colors + num_vertices * num_colors * (num_colors - 1) + 2 * num_edges * num_colorsValidation Method
k=2andk=3.k=0, empty-graph, isolated-vertex, odd-cycle, and complete-graph cases.Example
01,12,23,34,40withk=3.[0,1,0,1,2], encoded by true variablesx[0,0],x[1,1],x[2,0],x[3,1],x[4,2].BibTeX