Skip to main content

Edge Colouring and Chromatic Polynomials

Edge colouring assigns colours to edges so that adjacent edges receive different colours. It is the natural model for scheduling pairwise interactions: games sharing a team, jobs sharing a machine, or communication links sharing a port cannot happen in the same time slot. Unlike vertex colouring, edge colouring is controlled closely by the maximum degree, but the exact answer still contains subtle structure.

Chromatic polynomials count proper vertex colourings as a function of the number of available colours. They refine the yes/no question "is this graph kk-colourable?" into "how many kk-colourings does it have?" This gives a bridge from graph theory to algebra and combinatorics.

Definitions

A proper edge colouring of a graph GG assigns colours to edges so that any two edges sharing an endpoint have different colours. The chromatic index χ(G)\chi'(G) is the least number of colours needed.

The line graph L(G)L(G) has one vertex for each edge of GG, with two vertices adjacent in L(G)L(G) exactly when the corresponding edges of GG share an endpoint. Edge colouring GG is the same as vertex colouring L(G)L(G), so

χ(G)=χ(L(G)).\chi'(G)=\chi(L(G)).

The chromatic polynomial PG(k)P_G(k) counts the number of proper vertex colourings of GG using colours from a set of size kk. It is a polynomial in kk for every finite graph.

For an edge ee that is not a loop, GeG-e denotes deletion of ee, and G/eG/e denotes contraction of ee.

Key results

Lower bound for edge colouring.

χ(G)Δ(G),\chi'(G)\ge \Delta(G),

because all edges incident with a vertex of maximum degree need distinct colours.

Vizing's theorem. For every simple graph,

Δ(G)χ(G)Δ(G)+1.\Delta(G)\le \chi'(G)\le \Delta(G)+1.

Graphs with χ(G)=Δ(G)\chi'(G)=\Delta(G) are called Class 1; graphs with χ(G)=Δ(G)+1\chi'(G)=\Delta(G)+1 are Class 2.

Konig's line-colouring theorem. If GG is bipartite, then

χ(G)=Δ(G).\chi'(G)=\Delta(G).

Deletion-contraction for chromatic polynomials. If ee is not a loop, then

PG(k)=PGe(k)PG/e(k).P_G(k)=P_{G-e}(k)-P_{G/e}(k).

Reason: colourings of GeG-e either give different colours to the endpoints of ee, in which case they are colourings of GG, or give the same colour to the endpoints, in which case they correspond to colourings of G/eG/e.

Special values of chromatic polynomials. If GG has at least one vertex, then PG(0)=0P_G(0)=0 because there are no colours available. If GG has at least one edge, then PG(1)=0P_G(1)=0 because adjacent vertices cannot share the only colour. The value PG(2)P_G(2) detects bipartiteness for connected graphs: it is 22 when GG is connected and bipartite, and 00 when GG has an odd cycle.

Leading terms. For a graph with nn vertices and mm edges,

PG(k)=knmkn1+lower-degree terms.P_G(k)=k^n-mk^{n-1}+\text{lower-degree terms}.

The leading term counts all colour assignments. The next term subtracts assignments that violate one specified edge, and the lower-order terms correct overlaps among violations. This gives a quick check on small polynomial computations.

Edge colouring through line graphs. Because χ(G)=χ(L(G))\chi'(G)=\chi(L(G)), every theorem about vertex colouring can be applied to edge colouring after forming the line graph. The translation is powerful but can obscure the original graph. For example, a clique in L(G)L(G) may come from all edges incident with one high-degree vertex, or from the three edges of a triangle in GG.

Planar connection. Edge colouring also interacts with map colouring. For a plane cubic graph, face colouring of the dual and edge colouring of the original graph are closely related. Historically, several equivalent formulations of the four-colour problem passed through edge-colouring statements about cubic planar graphs. This is one reason Wilson treats vertex colouring, map colouring, edge colouring, and chromatic polynomials in the same chapter.

Chromatic roots. The values of kk for which PG(k)=0P_G(k)=0 are called chromatic roots. The integers 0,1,,χ(G)10,1,\dots,\chi(G)-1 are always roots in the sense that no proper colouring exists with that many colours. Noninteger chromatic roots are a deeper topic, but even at an introductory level they remind us that PG(k)P_G(k) is both a counting function and an algebraic object.

Disjoint unions. If GG is the disjoint union of G1G_1 and G2G_2, then

PG(k)=PG1(k)PG2(k).P_G(k)=P_{G_1}(k)P_{G_2}(k).

Colour choices on different components are independent.

Visual

The triangle needs three edge colours because every pair of edges is adjacent.

Graph GGΔ(G)\Delta(G)χ(G)\chi'(G)Chromatic polynomial
Path PnP_n with n2n\ge 22 or 12 or 1k(k1)n1k(k-1)^{n-1}
Cycle C2rC_{2r}22(k1)2r+(k1)(k-1)^{2r}+(k-1)
Cycle C2r+1C_{2r+1}23(k1)2r+1(k1)(k-1)^{2r+1}-(k-1)
Complete graph K3K_323k(k1)(k2)k(k-1)(k-2)
Complete bipartite Kr,sK_{r,s}max(r,s)\max(r,s)max(r,s)\max(r,s)no single short form

Worked example 1: Edge-colour an odd cycle

Problem. Find χ(C5)\chi'(C_5).

Method.

  1. The graph C5C_5 has maximum degree
Δ(C5)=2.\Delta(C_5)=2.
  1. Therefore χ(C5)2\chi'(C_5)\ge 2.
  2. Suppose two edge colours were enough. Around the cycle, adjacent edges must alternate colours:
1,2,1,2,1.1,2,1,2,1.
  1. The first and last edges of the cycle are adjacent, but both would have colour 11. This is impossible.
  2. So χ(C5)3\chi'(C_5)\ge 3.
  3. Three colours suffice: colour the first four edges 1,2,1,21,2,1,2 and the last edge 33.

Checked answer.

χ(C5)=3.\chi'(C_5)=3.

This agrees with the general rule that odd cycles are Class 2.

Worked example 2: Compute a chromatic polynomial by deletion-contraction

Problem. Compute PP3(k)P_{P_3}(k) for the path abca-b-c using deletion-contraction on edge bcbc.

Method.

Let G=P3G=P_3 and e=bce=bc.

  1. Delete ee. The graph GeG-e has one edge abab and an isolated vertex cc.
  2. The edge abab can be coloured in k(k1)k(k-1) ways, and cc can be coloured independently in kk ways. Therefore
PGe(k)=k2(k1).P_{G-e}(k)=k^2(k-1).
  1. Contract e=bce=bc. The vertices bb and cc merge, and the result is a single edge between aa and the merged vertex. Hence
PG/e(k)=k(k1).P_{G/e}(k)=k(k-1).
  1. Apply deletion-contraction:
PG(k)=PGe(k)PG/e(k).P_G(k)=P_{G-e}(k)-P_{G/e}(k).
  1. Substitute:
PG(k)=k2(k1)k(k1)=k(k1)(k1)=k(k1)2.\begin{aligned} P_G(k) &= k^2(k-1)-k(k-1)\\ &= k(k-1)(k-1)\\ &= k(k-1)^2. \end{aligned}

Check. Directly, colour aa in kk ways, then bb in k1k-1 ways, then cc in k1k-1 ways because it only needs to differ from bb. The answer matches.

The leading-term check also works:

k(k1)2=k32k2+k.k(k-1)^2=k^3-2k^2+k.

The path has 33 vertices and 22 edges, so the first two terms should be k32k2k^3-2k^2, exactly as computed.

Code

This exact chromatic-polynomial routine uses deletion-contraction symbolically through SymPy. It is meant for small simple graphs.

from functools import lru_cache
import sympy as sp

k = sp.symbols("k")

def normalize(vertices, edges):
vertices = tuple(sorted(vertices))
edges = tuple(sorted(tuple(sorted(e)) for e in edges if e[0] != e[1]))
return vertices, tuple(sorted(set(edges)))

@lru_cache(None)
def chrom_poly(vertices, edges):
vertices, edges = normalize(vertices, edges)
if not edges:
return k ** len(vertices)
u, v = edges[0]
deleted = tuple(e for e in edges if e != (u, v))
merged_vertices = tuple(x for x in vertices if x != v)
contracted_edges = []
for a, b in deleted:
a = u if a == v else a
b = u if b == v else b
if a != b:
contracted_edges.append(tuple(sorted((a, b))))
return sp.expand(chrom_poly(vertices, deleted) - chrom_poly(merged_vertices, tuple(contracted_edges)))

print(chrom_poly(("a", "b", "c"), (("a", "b"), ("b", "c"))))

The recursive code recomputes many isomorphic subproblems unless caching catches the exact normalized edge set. Serious implementations use canonical graph forms or specialized deletion-contraction strategies. For small examples, however, the code mirrors the theorem closely enough to be useful as a checking tool.

As a quick sanity check, evaluate a computed chromatic polynomial at small integers. For a graph with an edge, PG(1)P_G(1) should be 00. For a connected bipartite graph, PG(2)P_G(2) should be 22; for a graph containing an odd cycle, it should be 00.

For edge-colouring, do the analogous check at a maximum-degree vertex. If a vertex has degree Δ\Delta, then its incident edges already require Δ\Delta distinct colours. Any proposed colouring with fewer is impossible before the rest of the graph is considered.

For chromatic polynomial computations, keep the graph operation visible beside the algebra. Deleting an edge and contracting an edge produce different graphs, and the subtraction order matters. For edge-colouring, sketch the line graph only when it clarifies adjacency among edges; otherwise, checking edge conflicts directly in the original graph is often cleaner.

Common pitfalls

  • Confusing vertex colouring with edge colouring. Adjacent edges share an endpoint; adjacent vertices share an edge.
  • Assuming every graph satisfies χ(G)=Δ(G)\chi'(G)=\Delta(G). Odd cycles and many complete graphs require Δ+1\Delta+1 colours.
  • Applying Konig's line-colouring theorem to non-bipartite graphs.
  • Forgetting that a loop makes proper vertex colouring impossible and also disrupts ordinary edge-colouring assumptions.
  • Counting colourings "up to renaming colours" when computing PG(k)P_G(k). The chromatic polynomial counts actual assignments from a fixed colour set.
  • Using deletion-contraction with the signs reversed.

Connections