Chromatic number #
ChromaticNumber is Karp's problem CHROMATIC NUMBER [Kar72]: given a graph G and a number
k, the declared vertices of G can be colored with k colors so that adjacent vertices get
different colors. It is KColoring k with the number of colors moved into the instance
(Cslib.Complexity.ChromaticNumberInstance, encoded by Cslib.Complexity.encChromaticNumber). The
graph of the declared vertices has chromatic number at most k in the sense of
SimpleGraph.chromaticNumber (Cslib.Complexity.mem_ChromaticNumber_iff_chromaticNumber_le).
Equivalently, by Mathlib's SimpleGraph.partitionable_iff_colorable, that graph is partitioned
into at most k independent sets (SimpleGraph.Partitionable).
NP membership uses a list of colors as the witness, the color of a vertex being the entry at its
first occurrence among the declared vertices (Cslib.Complexity.colorOf). Since k is written in
binary, a coloring of a member is first replaced by one with colors below the number of declared
vertices, so that witnesses have length polynomial in the instance: when k exceeds the number of
declared vertices, every vertex is colored by its position.
Karp proves hardness by a reduction from SATISFIABILITY WITH AT MOST 3 LITERALS PER CLAUSE. Here
ChromaticNumber is NP-hard because the NP-hard ThreeColoring is the instances with three
colors (Cslib.Complexity.polyTimeReducible_KColoring_ChromaticNumber).
Main definitions #
Cslib.Complexity.ChromaticNumberInstance: instance(graph, colors)of Chromatic Number.Cslib.Complexity.encChromaticNumber: polynomial-time encoding ofChromaticNumberInstance.Cslib.Complexity.ChromaticNumber: graphs with a number of colors that suffices.
Main results #
Cslib.Complexity.mem_ChromaticNumber_iff_chromaticNumber_le: membership bounds the chromatic number of the graph of the declared vertices.Cslib.Complexity.ChromaticNumber.mem_NP:ChromaticNumber ∈ NP encChromaticNumber.Cslib.Complexity.polyTimeReducible_KColoring_ChromaticNumber,Cslib.Complexity.ChromaticNumber_npHard,Cslib.Complexity.ChromaticNumber_npComplete:ChromaticNumberisNP-complete.
References #
An instance (graph, colors) of Chromatic Number.
Instances For
Instances For
Instances For
Encoding of ChromaticNumberInstance as a pair (graph, colors).
Instances For
Chromatic number [Kar72]: the graphs whose declared vertices can be colored with the
given number of colors so that adjacent vertices get different colors. Unlike KColoring k, the
number of colors is part of the instance.
Instances For
Membership in ChromaticNumber is membership in KColoring with the given number of
colors.
Membership in ChromaticNumber bounds the chromatic number of the graph induced on the
declared vertices (SimpleGraph.chromaticNumber).
ChromaticNumber belongs to NP, with a list of colors as the witness. Colors are taken
below the number of declared vertices, so witnesses stay polynomial although the number of colors
is written in binary.
KColoring k reduces to ChromaticNumber in polynomial time, by attaching the number of
colors k to the graph.
ChromaticNumber is NP-hard, already for three colors.
Chromatic number is NP-complete, with the number of colors in binary [Kar72].