Colouring a Graph
Posted by Tom Leinster
It had always seemed to me that category theory provided no useful perspective on graph theory. But yesterday I learned a small fact that caused me to slightly revise that opinion. It’s that colourings of graphs — which seem to be a major source of questions in graph theory — are simply homomorphisms into a complete graph.
I’ll explain this, and I’ll describe a conjecture that Tom Hirschowitz told me about yesterday: for graphs and ,
The chromatic number of is the minimum of the chromatic numbers of and .
It’s amazing that something so basic is unknown!
For this post, a graph is a finite set equipped with a symmetric, irreflexive binary relation. The elements of the finite set are called the “vertices”, the relation is usually called , and rather than saying that two vertices are related, we say that there is an “edge” between them. Concretely, then, “graph” means a finite undirected graph without loops (that being the “irreflexive” part) or multiple edges.
For instance, for each natural number , the complete graph has vertex-set and an edge between and whenever .
A homomorphism of graphs is what you’d imagine. That is, given graphs and , a homomorphism is a map of sets such that for ,
This gives us a category of graphs.
Graph theorists know a lot about colourings. By definition, a colouring of a graph by colours, or an -colouring of for short, is a way of painting each vertex one of colours in such a way that no two vertices of the same colour have an edge between them.
Here’s the small fact I learned yesterday (from Wikipedia):
A -colouring of a graph is the same thing as a homomorphism .
Why? Well, writing , a homomorphism is a map of sets such that if have an edge between them then the vertices and of have an edge between them. But every pair of vertices of is joined by an edge except when . So a homomorphism is a map of sets such that if and are joined by an edge then . That’s exactly an -colouring.
This fact makes it obvious that colouring is functorial: given a homomorphism , every -colouring of gives rise to an -colouring of . (Simply compose the maps .) Concretely, we paint each vertex of the same colour as .
Every graph can be -coloured for sufficiently large : just paint all the vertices different colours. The chromatic number of is the smallest for which there exists an -colouring of .
The functoriality of colouring means that whenever there is a homomorphism . Categorically put, is a functor
Here is the poset regarded as a category: it has one object for each natural number, there is one map when , and there are no maps when .
The very famous four-colour theorem states that the chromatic number of a planar graph is at most four. For a long time it was only a conjecture. But there’s another fundamental conjecture about chromatic numbers — perhaps even more fundamental, as it doesn’t refer to the geometric notion of planarity. Tom Hirschowitz mentioned it to me by email yesterday; he’d just heard it from Stéphan Thomassé. Here goes.
The category of graphs has binary products, defined in the expected way: given graphs and , the vertex-set of is , and there’s an edge between and if and only if there are an edge between and and an edge between and . The projections and are what you’d expect.
Now, the fact that there are any homomorphisms implies that . The same goes for . So:
for all graphs and .
The conjecture is that this is an equality:
Conjecture (Hedetniemi, 1966) for all graphs and .
It’s known to be true for various classes of s and s, and I guess people have had their computers check it in millions of special cases. As I only learned about it yesterday, I know almost nothing more — only what I’ve read on Wikipedia and this page by Stéphan Thomassé. But presumably a question this basic, open since 1966, has attracted a lot of attention.
Intuitively (as Wikipedia says) the meaning of the conjecture is that has no sneakily economical colourings. In other words, if your aim is to colour with as few colourings as possible, you can’t improve on the following strategy: either colour minimally and then declare the colour of to be the colour of , or do the same with the roles of and reversed.
Categorically, the conjecture can be expressed as follows:
Conjecture (Hedetniemi) The functor preserves binary products.
That’s just because binary products in the category are minima.
Postscript: Perturbing the definition
In what I wrote above, I tried to stick closely to what I understand to be graph theorists’ conventions, except of course that some things are phrased in categorical language. I don’t know nearly enough graph theory to challenge the wisdom of those conventions.
However, I can’t help wondering whether things would become cleaner if we allowed our graphs to have loops. Formally, a graph-with-loops is a finite set equipped with a symmetric binary relation. Thus, what we’re calling a “graph” is a special sort of graph-with-loops: it’s a graph-with-loops with no loops! Formally, it’s a graph-with-loops in which the relation is irreflexive.
Homomorphisms of graphs-with-loops are defined just as for ordinary graphs, and products are described in the same way too. Thus, is a full subcategory of , the category of graphs-with-loops, and the inclusion preserves binary products.
Why allow loops? The reasons are aesthetic.
First, the irreflexivity condition tastes strange on a category theorist’s tongue. We’re suspicious of negatives.
Second, the category of graphs has the strange feature of possessing binary products but not a terminal object. This is “fixed” (if you think it’s a problem) by passing to the category of graphs-with-loops, in which the terminal object is the graph consisting of a vertex and a single loop on it.
Third, there’s a general rule, discussed at the Café before (though I can’t find it now) and possibly due to Grothendieck:
A good category containing some bad objects is preferable to a bad category containing only good objects.
I’m not keen on the words “good” and “bad” in mathematics, but I understand the intent. For instance, the rule tells us to work with the category of schemes rather than the category of varieties. The category of varieties is “bad” in lacking certain colimits, for example; but from the traditional point of view, some schemes are “bad”. Similarly, it suggests that categories of smooth spaces are preferable to categories of manifolds.
In our present situation, the presence of loops might be thought to make a graph “bad”, but allowing such graphs makes the category good.
One way in which a graph containing loops is “bad” is that it has no colourings at all. If a vertex has a loop on it, then there’s an edge between and , so there’s no colour you can give it. Thus, the chromatic number of a graph containing one or more loops should be taken to be . Chromatic number therefore defines a functor
The category is also “better” than : unlike , it has a terminal object (greatest element), . Since , the terminal graph-with-loops, contains a loop, we have . That is, preserves terminal objects. So it preserves binary products if and only if it preserves all finite products.
Actually, there’s something funny going on. A loop in a graph is a homomorphism . In categories of spaces, a map from the terminal object to a space is often called a point of . So, loops are points. This means that the graphs without loops — the “good” graphs — are exactly the graphs without points! What’s funny is that in some categories of spaces, such as the category of locales, the nontrivial spaces with no points at all tend to be seen as rather exotic. (For example, there’s the locale of surjections , which is nontrivial but has no points.)
Hedetniemi’s conjecture is straightforward when or contains a loop. For if contains a loop then we have a homomorphism , which induces another homomorphism
So . (Concretely, if contains a loop on a vertex then is an isomorphic copy of contained in .) But we also know that ; so . Since , this is exactly what Hedetniemi’s conjecture predicts.
So the conjecture can equivalently be reformulated as:
Conjecture (Hedetniemi) The functor preserves finite products.
At first glance this looks harder than the previous versions, since is a larger category and we’re asking for the preservation of terminal objects as well as binary products. But the observations above show that it’s actually equivalent.
Here’s a final question. The chromatic number functor is defined in terms of the complete graphs . But what’s so special about the s? What is their place within the category of graphs? I see no nice universal property that complete graphs satisfy. They look “indiscrete”, so at first I looked for some universal property similar to that satisfied by indiscrete topological spaces or indiscrete categories. But no — you have to be careful about the lack of loops. Perhaps the interplay of perspectives between and is somehow helpful here.
Re: Colouring a Graph
I too find it a little perplexing that there has been little interaction between graph theory and category theory, so this is a welcome post.
Regarding “the” category of graphs: something that’s a little bit amusing is that if you forget about morphisms for a moment, then graphs as you defined them at the beginning (sets equipped with irreflexive symmetric relations) are sort of “the same thing” as sets with reflexive symmetric relations, in the sense that there is a canonical bijection between such structures (they are in fact isomorphic as Joyal species). But they are very different of course from the viewpoint of structure-preserving functions! One thing that reflexive symmetric relations support and irreflexive symmetric relations do not is the process of contracting an edge to a point, which seems to be a prominent operation in at least some aspects of Graph Theory.
I believe it is true that both the category of sets equipped with a symmetric relation, and the category of sets equipped with a reflexive symmetric relation, are quasitoposes (I’d have to double-check that). But the category of sets equipped with an irreflexive symmetric relation is not. This would sort of confirm the intuition that there’s something categorically “fishy” or not-good-smelling about the negative condition of irreflexivity.