4 1 Introduction to Graph Colouring
is friends with D, but can be assigned to the second. Continuing this process for all
eight students gives us the solution shown in Figure 1.3(b). This solution uses four
groups, and also involves student F being assigned to a group by himself.
Can we do any better than this? By inspecting the graph in Figure 1.3(a), we
can see that there are three separate cases where three students are all friends with
one another. Specifically, these are students A, B, and C; students B, E, and F; and
students D, E, and F. The edges between these triplets of students form triangles
in the graph. Because of these mutual friendships, in each case these collections of
three students will need to be assigned to different groups, implying that at least
three groups will be needed in any valid solution. However, by visually inspecting
the graph we can see that there is no occurrence of four students all being friends
with one another. This hints that we may not necessarily need to use four groups in
a solution.
In fact, a solution using three groups is actually possible in this case as Fig-
ure 1.3(c) demonstrates. This solution has been achieved using the same assignment
process as before but using a different ordering of the students, as indicated. Since
we have already deduced that at least three groups are required for this particular
problem, we can conclude that this solution is optimal.
The process we have used to form the solutions shown Figures 1.3(b) and (c) is
generally known as the G
REEDY algorithm for graph colouring, and we have seen
that the ordering of the vertices (students in this case) can influence the number of
colours (groups) that are ultimately used in the solution it produces. The G
REEDY
algorithm and its extensions are a fundamental part of the field of graph colouring
and will be considered further in later chapters. Among other things, we will demon-
strate that there will always be at least one ordering of the vertices that, when used
with the G
REEDY algorithm, will result in an optimal solution.
1.1.2 Constructing Timetables
A second important application of graph colouring arises in the production of
timetables at colleges and universities. In these problems we are given a set of
“events”, such as lectures, exams, classroom sessions, together with a set of “times-
lots” (e.g., Monday 09:00–10:00, Monday 10:00–11:00 and so on). Our task is to
then assign the events to the timeslots in accordance with a set of constraints. One of
the most important of these constraints is what is often known as the “event-clash”
constraint. This specifies that if a person (or some other resource of which there
is only one) is required to be present in a pair of events, then these events must
not be assigned to the same timeslot since such an assignment will result in this
person/resource having to be in two places at once.
Timetabling problems can be easily converted into an equivalent graph colouring
problem by considering each event as a vertex, and then adding edges between any
vertex pairs that are subject to an event clash constraint. Each timeslot available in