This is a slightly modified copy of a sage worksheet that was written by Stefan van der Lugt
Exercise 3
(Graph coloring) A graph is an ordered pair , with a set of vertices, and a set of edges, which are 2-element subsets of . An -coloring of a graph is an assignment of one of colors to each vertex of in such a way that any two vertices connected by an edge have distinct colors. In this exercise we will assume that has finitely many edges, and we will label the vertices by the set .
Let be any field with at least elements, and let be a subset with elements. These elements will represent the colors. An -coloring of is then equivalent to assigning a value for (giving each vertex a color) such that for each edge (making sure adjacent vertices have distinct colors).
Let , and .
() Show: is a polynomial in , and show that giving an -coloring of is equivalent to solving the following system of equations in variables :
() Show that an -coloring for exists if and only if the ideal is proper.
This allows us to use software capable of working with Gr"obner bases to find information about coloring of finite graphs.
() Consider the graph with eight vertices and 14 edges , , , , , , , , , , , , , . Show that, up to permutation of the colors, has a unique -coloring. (Hint: consider with colors . We may without loss of generality assume that vertex 1 will get color 0, and the adjacent vertex 3 will get color 1. Use computer software to compute a (reduced) Gr"obner basis for the ideal generated by the , and and ).
() Use Gröbner bases to show that the graph with nine vertices and 22 edges , , , , , , , , , , , , , , , , , , , , , has precisely four 4-colorings up to permutations of the colors. Show that if the edge is added then cannot be 4-colored.
Exercise 3() of week 12
Consider the graph with eight vertices and 14 edges , , , , , , , , , , , , , . Show that, up to permutation of the colors, has a unique -coloring.
First, we define our field , and our polynomial ring over with 8 variables .
We also fix a monomial ordering on R, the degrevlex/grevlex ordering.
Now, we define the polynomials and .
Now we define the ideal generated by the polynomials for and for .
Now we compute a Gröbner basis for .
Notice that finding a common zero of the polynomials in this Gröbner basis is equivalent to finding a solution to the equations and induced by the first two elements of this basis. The other elements of the Gröbner basis give linear equations for with unique solutions that depend only on and .
Finding a solution to and , that is, choosing a color for vertex 8 and a different color for the adjacent vertex 7, determines a unique 3-coloring for the rest of the graph. This shows that there exist 6 distinct colorings of the graph, and these 6 colorings are in fact the same up to a permutation of the colors.
For example, if we choose color 0 for vertex 8 (that is, adding the polynomial to our ideal), we get the following Gröbner basis.
The only non-linear polynomial in this basis is , which has roots and . Translating this to graph theory: after choosing color 0 for vertex 8, we can choose color 1 or 2 for vertex 7, and this will determine the color of vertices uniquely.
For example, if we now pick color 1 for vertex 7, we find the following Gröbner basis.
The roots of these polynomials, and thus the colors of the other vertices, can be read off easily now. The vertices and have color 0, the vertices , and have color 1, and the vertices , and have color 2.
Instead of picking a color for vertex 8, we could also start by picking a color for vertex 1. Let's try giving vertex 1 color 0.
This already shows that vertex 2 and vertex 6 will also have color 0, and vertex 8 cannot have color 0 anymore.
If we didn't notice this and accidentally try to color vertex 2 a different color, we will get the following Gröbner basis.
Clearly the elements of this Gröbner basis do not have a common zero! This means that there is no possible coloring of such that vertex 1 has color 0 and vertex 2 has color 1.
So instead of deliberately giving vertex 2 the wrong color, let's pick color 1 for vertex 3.
This gives a unique coloring for the rest of the graph: one easily reads off from this basis that , and have color 0, , and have color 1, and and have color 2. This coloring differs from the previously found coloring only by a permutation of the colors.
Let's see what happens if we add an extra edge, say between vertex 5 and vertex 7.
This shows that we can't equip this graph with a 3-coloring anymore. This is as one would expect: in any coloring of the original graph vertices 5 and 7 have the same color.
Exercise 3.(iv)
Use Gröbner bases to show that the graph with nine vertices and 22 edges , , , , , , , , , , , , , , , , , , , , , has precisely four 4-colorings up to permutations of the colors. Show that if the edge is added then cannot be 4-colored.
We will work with the field of 4 elements; this field is obtained from by adjoining a root of the irreducible polynomial . We could of course work with as well.
We have: , and
The graph has nine vertices, so we define .
The ideal is generated by the for and for all .
We want to find the number of colorings of up to permutation of colors, so we might as well give vertex 9 color 0.
The sixth vertex, which is adjacent to vertex 9, can be given any color except for color 0. In the above Gröbner basis this statement corresponds to the equation .
We may therefore assume that vertex 6 gets color 1.
After choosing color 0 for vertex 9 and color 1 for vertex 6 we make the following observation: the colors of vertices 6, 7 and 9 are determined. The color of vertex 5 is or . Choosing a color for vertex 5 uniquely determines the colors of vertices 1, 2, and 4.
By symmetry, we may assume that vertex 5 has color . This removes the final degree of freedom induced by permutations of colors.
We now find:
Vertices 7 and 9 have color 0
Vertex 6 has color 1
Vertices 1, 2, and 5 have color
Vertex 4 has color
, so has color 1 or color
, so has color 1 or color .
In particular: even after fixing a permutation of the colors, we are still able to choose between two colors for both vertex 3 and vertex 8. This shows that has precisely unique 4-colorings up to permutation of colors.
Let's add edge to our graph and see what happens.
This proves that the graph obtained from by adding the edge does not have a 4-coloring.