Skip to content
OneKitly

A Four-Node Graph Can Need Four Colours and a Hundred-Node One Only Two

Published 12/1/2026 · 3 min read · Developer tools

Daniel Okonkwo

Daniel Okonkwo — Front-end developer and tech writer at OneKitly

Web performance · File formats

Checked against 2 sources

View profile →
In short

Colouring a graph means giving every node a colour so that no edge joins two of the same. Four nodes each connected to the other three leave no choice: every node sees every other, so each needs its own colour, and the answer is four. A cycle of a hundred nodes, where each is joined only to its two neighbours, alternates between two colours all the way round. Add one node to make the cycle odd and the alternation fails at the join, so three colours are needed — a hundred and one nodes, one more colour than a hundred.

Advertisement

The chromatic number counts structure, not size. Four mutually connected nodes need four colours; a hundred-node even cycle needs two.

What the colours stand for outside mathematics

A colour is any resource that two conflicting things cannot share: a radio frequency for transmitters within range of each other, an exam slot for courses with common students, a register for variables alive at the same moment in a compiler, a table for guests who must not sit together. In every case the edges are the conflicts and the chromatic number is the smallest number of resources that works. The problem is worth solving because one fewer colour is one fewer frequency licence, exam day or register.

Greedy colouring depends on the order it visits

Walking the nodes and giving each the lowest colour not already used by a neighbour is fast and often wrong: on some graphs an unlucky order uses twice as many colours as necessary. DSATUR fixes most of that by always colouring next the node with the most differently-coloured neighbours, which is why the tool offers both and why they can disagree on the same input. Neither is guaranteed optimal — finding the true chromatic number is NP-hard, and for anything past a few dozen nodes a good answer arrives long before a proved one.

Colours
Nodes, structure and colours needed
GraphNodesColours
All connected to all44
Even cycle1002
Odd cycle1013
A pathany number2
Graph coloring calculatorColor a graph so that no two adjacent vertices share a color. Enter an edge list and the DSATUR (or greedy) heuristic assigns a color to every vertex, shows the color classes, and reports an upper bound on the chromatic number χ. K4 needs 4 colors, an even cycle 2, an odd cycle 3 — see it instantly.Try the tool →
Advertisement

Frequently asked questions

Is four colours enough for a map?
For any map drawn on a flat surface with connected regions, yes — that is the four colour theorem, proved in 1976 with substantial computer assistance and the first major theorem to be settled that way. It does not extend to arbitrary graphs: the theorem applies to graphs that can be drawn without crossing edges, and a graph of five mutually connected nodes cannot be drawn that way and needs five colours.
Can I tell in advance that two colours will do?
Yes, and it is the one easy case: two colours suffice exactly when the graph contains no cycle of odd length. Checking that takes a single pass — walk the graph assigning alternating colours and see whether a contradiction appears — so the two-colour question is answered in time proportional to the size of the graph while the general question is intractable. Almost every fast result in graph theory comes from a special structure like this one.

Articles you may find interesting

All guides →

Related tools

Sources

Spotted a mistake in this article?