Documentation

Mathlib.Combinatorics.SimpleGraph.Coloring

Graph Coloring #

This module defines colorings of simple graphs (also known as proper colorings in the literature). A graph coloring is the attribution of "colors" to all of its vertices such that adjacent vertices have different colors. A coloring can be represented as a homomorphism into a complete graph, whose vertices represent the colors.

Main definitions #

Todo: #

@[inline, reducible]
abbrev SimpleGraph.Coloring {V : Type u} (G : SimpleGraph V) (α : Type v) :
Type (max u v)

An α-coloring of a simple graph G is a homomorphism of G into the complete graph on α. This is also known as a proper coloring.

Equations
Instances For
    theorem SimpleGraph.Coloring.valid {V : Type u} {G : SimpleGraph V} {α : Type v} (C : SimpleGraph.Coloring G α) {v : V} {w : V} (h : G.Adj v w) :
    C v C w
    @[match_pattern]
    def SimpleGraph.Coloring.mk {V : Type u} {G : SimpleGraph V} {α : Type v} (color : Vα) (valid : ∀ {v w : V}, G.Adj v wcolor v color w) :

    Construct a term of SimpleGraph.Coloring using a function that assigns vertices to colors and a proof that it is as proper coloring.

    (Note: this is a definitionally the constructor for SimpleGraph.Hom, but with a syntactically better proper coloring hypothesis.)

    Equations
    Instances For
      def SimpleGraph.Coloring.colorClass {V : Type u} {G : SimpleGraph V} {α : Type v} (C : SimpleGraph.Coloring G α) (c : α) :
      Set V

      The color class of a given color.

      Equations
      Instances For

        The set containing all color classes.

        Equations
        Instances For
          theorem SimpleGraph.Coloring.not_adj_of_mem_colorClass {V : Type u} {G : SimpleGraph V} {α : Type v} (C : SimpleGraph.Coloring G α) {c : α} {v : V} {w : V} (hv : v SimpleGraph.Coloring.colorClass C c) (hw : w SimpleGraph.Coloring.colorClass C c) :
          ¬G.Adj v w
          noncomputable instance SimpleGraph.instFintypeColoring {V : Type u} {G : SimpleGraph V} {α : Type v} [Fintype V] [Fintype α] :
          Equations
          def SimpleGraph.Colorable {V : Type u} (G : SimpleGraph V) (n : ) :

          Whether a graph can be colored by at most n colors.

          Equations
          Instances For

            The coloring of an empty graph.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The "tautological" coloring of a graph, using the vertices of the graph as colors.

              Equations
              Instances For
                noncomputable def SimpleGraph.chromaticNumber {V : Type u} (G : SimpleGraph V) :

                The chromatic number of a graph is the minimal number of colors needed to color it. This is (infinity) iff G isn't colorable with finitely many colors.

                If G is colorable, then ENat.toNat G.chromaticNumber is the -valued chromatic number.

                Equations
                Instances For
                  def SimpleGraph.recolorOfEmbedding {V : Type u} (G : SimpleGraph V) {α : Type u_1} {β : Type u_2} (f : α β) :

                  Given an embedding, there is an induced embedding of colorings.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def SimpleGraph.recolorOfEquiv {V : Type u} (G : SimpleGraph V) {α : Type u_1} {β : Type u_2} (f : α β) :

                    Given an equivalence, there is an induced equivalence between colorings.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      noncomputable def SimpleGraph.recolorOfCardLE {V : Type u} (G : SimpleGraph V) {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (hn : Fintype.card α Fintype.card β) :

                      There is a noncomputable embedding of α-colorings to β-colorings if β has at least as large a cardinality as α.

                      Equations
                      Instances For
                        theorem SimpleGraph.Colorable.mono {V : Type u} {G : SimpleGraph V} {n : } {m : } (h : n m) (hc : SimpleGraph.Colorable G n) :
                        noncomputable def SimpleGraph.Colorable.toColoring {V : Type u} {G : SimpleGraph V} {α : Type v} [Fintype α] {n : } (hc : SimpleGraph.Colorable G n) (hn : n Fintype.card α) :

                        Noncomputably get a coloring from colorability.

                        Equations
                        Instances For
                          theorem SimpleGraph.Colorable.of_embedding {V : Type u} {G : SimpleGraph V} {V' : Type u_1} {G' : SimpleGraph V'} (f : G ↪g G') {n : } (h : SimpleGraph.Colorable G' n) :
                          theorem SimpleGraph.Colorable.mono_left {V : Type u} {G : SimpleGraph V} {G' : SimpleGraph V} (h : G G') {n : } (hc : SimpleGraph.Colorable G' n) :

                          The bicoloring of a complete bipartite graph using whether a vertex is on the left or on the right.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Cliques #

                            theorem SimpleGraph.IsClique.card_le_of_coloring {V : Type u} {G : SimpleGraph V} {α : Type v} {s : Finset V} (h : SimpleGraph.IsClique G s) [Fintype α] (C : SimpleGraph.Coloring G α) :
                            s.card Fintype.card α
                            theorem SimpleGraph.IsClique.card_le_of_colorable {V : Type u} {G : SimpleGraph V} {s : Finset V} (h : SimpleGraph.IsClique G s) {n : } (hc : SimpleGraph.Colorable G n) :
                            s.card n
                            theorem SimpleGraph.Colorable.cliqueFree {V : Type u} {G : SimpleGraph V} {n : } {m : } (hc : SimpleGraph.Colorable G n) (hm : n < m) :