University of Auckland · FACULTY OF COMPUTER SCIENCE

COMPSCI320 Chap.5 Greedy Graph Colouring and Interval Partitioning

- one subject, every graph, every model, every mark
6 Chapters4-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 5 of 13 · COMPSCI320

Greedy Graph Colouring and Interval Partitioning

This chapter studies greedy colouring from the fourth tutorial. Each vertex receives the smallest colour not used by a coloured neighbour, which never needs more than the maximum degree plus one colours.

The visiting order changes the result, so the chapter shows two orders on one graph, then proves that sorting intervals by start time makes greedy colouring optimal through a clique lower bound.

A short trace in two orders shows the same graph needing three colours or two, and a lane diagram shows interval partitioning reaching the depth of the intervals.

The chapter ends with the dense subgraph heuristic, a reminder that greedy can be a fast heuristic rather than an exact method.

In this chapter

What this chapter covers

  • 01

    Proper colourings and the chromatic number

  • 02

    The smallest free colour rule

  • 03

    The maximum degree plus one bound

  • 04

    Why the vertex order matters

  • 05

    Interval graphs coloured by start time

  • 06

    Cliques as lower bounds

Worked example · free

Greedy colouring of a six-vertex graph in two orders

Q [4 marks]. A graph has edges ab, ac, bd, be, cd, df and ef. Colour it greedily, giving each vertex the smallest colour unused by its coloured neighbours, first in the order a, f, b, c, d, e and then in alphabetical order. The marks are an AskSia practice weighting, not a university marking scheme.
Greedy colouring of a six-vertex graph in the order a, f, b, c, d, e.Greedy colouring of a six-vertex graph in the order a, f, b, c, d, e. Each label shows the vertex and its colour number; this order uses 3 colours although two colours suffice for this graph.a·1f·1b·2c·2d·3e·3
Greedy colouring of a six-vertex graph in the order a, f, b, c, d, e. Each label shows the vertex and its colour number; this order uses 3 colours although two colours suffice for this graph.
  • 1Order a, f, b, c, d, e: a and f both get 1, then b and c get 2.
  • 1d sees colours 2, 2 and 1 and gets 3; e sees 2 and 1 and gets 3, so three colours are used.
  • 1Alphabetical order: a 1, b 2, c 2, d 1, e 1, f 2, using two colours.
  • 1Any edge needs two colours, so the alphabetical run is optimal and the first run wastes one.
This four-mark allocation is an AskSia practice weighting and not an official university scheme. The same rule uses three colours in the first order and two in alphabetical order; two is optimal because the graph has edges.
Sia tip — Pair every greedy colour count with a clique of the same size; without the clique the count is only an upper bound.
Glossary

Key terms

Proper Colouring
An assignment of colours to vertices so that every edge joins two vertices of different colours.
Chromatic Number
The smallest number of colours that admits a proper colouring of a graph.
Interval Graph
A graph with one vertex per interval and an edge for every pair of intervals that overlap.
Clique
A set of vertices in which every pair is joined by an edge.
Interval Partitioning
Assigning intervals to as few groups as possible so that no group holds two overlapping intervals.
Smallest Free Colour
The lowest colour number not used by any already coloured neighbour of the current vertex.
Maximum Degree
The largest number of edges meeting at any single vertex of a graph.
FAQ

Greedy Graph Colouring and Interval Partitioning FAQ

Why can greedy colouring never need more than maximum degree plus one colours?

When a vertex is coloured, at most d of its neighbours already have colours, where d is the maximum degree. So at most d colours are blocked, and one of the colours from 1 to d + 1 is always free. The rule therefore never reaches colour d + 2, whatever order the vertices are visited in.

Does a better vertex order always reach the chromatic number?

Some order always does, because colouring an optimal colouring's classes one after another reproduces it, but finding that order is as hard as colouring itself. Practical rules such as visiting high-degree vertices first often help without guarantees. For interval graphs, sorting by start time is guaranteed optimal, which is why that special case matters.

How do I prove an interval colouring is optimal?

Find a time point covered by as many intervals as the colouring uses. Those intervals overlap pairwise, forming a clique, and every colouring needs a different colour for each member. In the start-order greedy argument, an interval receiving colour k was blocked by k − 1 intervals still open at its start, which supplies exactly such a point.

Why is colouring interval graphs easier than colouring general graphs?

Intervals have a natural order by start time, and in that order every coloured neighbour of a new interval is still running when it starts. The blocked colours therefore all come from intervals sharing one point, which form a clique. That clique proves the greedy count optimal, while general graphs have no such order and colouring them is NP-hard.

Study strategy

Exam move

Colour one small graph under two different orders and record the counts, then compute the maximum degree bound and compare. For interval sets, sweep the start times to find the maximum depth before colouring, so you know the target in advance. Write the clique argument once in full so that you can reproduce it quickly in an exam.

As a final check, colour one interval set by finish time instead of start time and see whether the clique argument still holds, which shows why the start order matters. Finish by explaining in one sentence why the heuristic for dense subgraphs carries no optimality guarantee.

Working through Greedy Graph Colouring and Interval Partitioning in COMPSCI320? Sia is AskSia’s AI Computer Science tutor — ask any COMPSCI320 Greedy Graph Colouring and Interval Partitioning question and get a clear, step-by-step explanation grounded in how COMPSCI320 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 34 of your University of Auckland subjects - and 1,000+ Bibles across every Australian university.
Sia - your COMPSCI320 tutor, unlimited, worked the way the exam marks it
The full 4-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works