Maths › Decision Mathematics 1 › Graphs: order, Eulerian paths and planarity

Graphs: order, Eulerian paths and planarity

Graph theory supplies the vocabulary of nodes, arcs, degree, walks, trees and planarity. For a connected graph with at least one edge, no odd nodes gives an Eulerian circuit and exactly two odd nodes an Eulerian trail. Counting can rule out a plane drawing too, through the relation between the nodes, the edges and the regions a plane drawing leaves on the page. Two further results also come from counting: Ore's condition, which is enough on its own for a Hamiltonian cycle, and the number of flat layers a graph has to be split between.

Builds on Algorithms, sorting and bin packing and The structure of proof.

IN THIS TOPIC

  • Find the order of every node and use it to classify a graph.
  • Recognise complete, planar, isomorphic and Hamiltonian structures.
  • Test a graph against Ore's condition, and name a Hamiltonian graph that fails it.
  • Apply the planarity algorithm to a Hamiltonian graph.
  • Split a non-planar graph into planar layers and give its thickness.
  • Distinguish walk, trail, path and cycle, and say what makes a graph simple.
  • Subdivide an edge and contract one, naming the contracted node in bracket notation.
  • Colour a graph to test whether it is bipartite, and write down a complement.
  • Count the regions of a plane drawing and use Euler's formula and the edge bound it gives.

COMMON MISCONCEPTION

A graph with an even number of odd nodes has an Eulerian circuit.

Every graph has an even number of odd nodes, since the orders total twice the number of edges, so that condition rules nothing out. The test is the count itself, on a connected graph: no odd nodes gives an Eulerian circuit, exactly two gives a semi-Eulerian trail between them, and more than two gives neither. Four odd nodes are an even number and admit no such route.

Counting the odd nodes

The order or degree of a node is the number of edges meeting it. Every edge contributes to two nodes, so the orders always add to twice the number of edges, and the number of odd nodes is therefore always even. Every graph satisfies that condition, so it rules nothing out.

The test is the number of odd nodes, and it applies to a connected graph with at least one edge. Isolated nodes may be ignored, but every edge must lie in one connected part, since no single trail can reach two separate parts.

For such a graph: zero odd nodes and the graph is Eulerian, meaning a closed trail, or Eulerian circuit, exists that uses every edge exactly once. Exactly two odd nodes and it is semi-Eulerian, with an Eulerian trail starting at one odd node and ending at the other. More than two and no such trail exists. Route inspection addresses the case of more than two odd nodes.

The parity count alone is insufficient if the non-isolated part of the graph is disconnected: two separate triangles have no odd nodes and no Eulerian circuit.

The six-node network with the order of each node written beside it. Four nodes have odd order and are marked in coral; a graph needs none for an Eulerian circuit and exactly two for a semi-Eulerian trail.
FIG. 1The unit's network with each node's order, showing four odd nodes and therefore no Eulerian trail.

WORKED EXAMPLE

Classifying a network

In the network shown, the orders are A 3, B 3, C 4, D 3, E 3 and F 2. Classify it.

The orders total 18, which is twice the nine edges, as it must be.

Four nodes are odd: A, B, D and E.

Four is more than two, so the graph is neither Eulerian nor semi-Eulerian: no route can use every edge exactly once.

Loops, multiple edges and simple graphs

Two features not present in the drawings so far carry names of their own. A loop is an edge joining a node to itself, and it adds two to that node's order, since both of its ends meet the same node. Multiple edges are two or more edges joining the same pair of nodes, which is what a model produces as soon as two roads run between the same pair of towns. A graph with neither is simple, and a simple graph that is connected is simply connected, written simple-connected on some papers.

Being simple restricts the orders. With loops and repeats excluded, a node of a simple graph on n nodes can join at most the other n − 1, so no order passes n − 1, and the number of edges rises no higher than n(n − 1)/2, which the complete graph achieves. Connectedness pushes from the other side: each node needs an order of at least 1, and a tree, being connected on as few edges as possible, has at least two nodes of order 1 at the ends of its longest path.

A subgraph is made from some of the nodes and some of the edges of a graph, an edge surviving only when both its ends survive. Deleting a loop and one of a pair of multiple edges leaves a simple subgraph on the same nodes, and a spanning tree is a subgraph too. Dropping a new node of order 2 into the middle of an edge, so that one edge becomes two, is a subdivision, which changes the drawing without changing what is joined to what. That is why the planarity theorem below is stated up to subdivisions.

The operation that runs the other way is contraction. To contract the edge AB, squeeze its two ends together into a single node, written (AB), and let every edge that met A or met B meet (AB) instead. The edge AB itself vanishes into the new node, so the node count falls by one and the edge count falls by one with it, and the order of (AB) is the orders of A and B added and then reduced by two. Where the two nodes being merged are not joined there is no edge to lose, and the order of (AB) is then the two orders added. Contracting several times in turn is allowed and the brackets nest, so contracting (AB) with C next gives (ABC).

Contraction can cost a graph its simplicity, which is the part a question tests. If A and B had a neighbour in common, its two edges both survive and now join the same pair of nodes, so a multiple edge appears; if A and B were joined by two edges, the second becomes a loop at (AB).

Contracting the edge AB: the edge goes, its two ends become the single node (AB) of order 4, and C ends up joined to it twice
Describe the drawing

The unit's six-node network on the left with the edge AB picked out in amber, and on the right the same network after that edge has been contracted. A and B have become a single node written (AB), the edge between them has vanished, and every edge that ran to A or to B now runs to (AB). Four such edges survive, so (AB) has order 4, and because C was joined to both A and B it is now joined to (AB) by two separate edges, drawn in coral as a pair of arcs. Five nodes and eight edges remain, and the doubled pair means the contracted graph is no longer simple.

FIG. 2The unit's network before and after contracting AB, with the pair of edges C ends up with.

WORKED EXAMPLE

Contracting an edge

The unit's network has nodes A to F and nine edges: AB, AC, AD, BC, BE, CD, CE, DF and EF. Contract AB and describe what results.

A has order 3 and B has order 3, so the new node (AB) has order 3 + 3 − 2 = 4.

A brought AC and AD across, and B brought BC and BE, so the edges are (AB)C twice, (AB)D, (AB)E, CD, CE, DF and EF.

The counts check out: five nodes and eight edges, one fewer of each than before.

C was a neighbour of both A and B, so its two edges are now a multiple edge between C and (AB), and the contracted graph is therefore not simple even though the original was.

Walks, trails, paths and cycles

Four words describe travel through a graph, and they differ only in what may be repeated. A walk is a sequence of edges with each one starting where the last finished. A trail is a walk with no edge used twice. A path is a trail with no node visited twice. A cycle is a closed path, finishing at the node it set out from. Route is the loose word for any of these, open or closed.

TermWhat may be repeated
Walknodes and edges both
Trailnodes, but no edge twice
Pathneither, so no node and no edge twice
Cyclea path that closes, so its first node is also its last

So an Eulerian trail uses each edge once and may pass a node several times, while a Hamiltonian cycle visits each node once and may leave edges unused.

Putting arrows on the edges turns a graph into a digraph, or directed graph, whose edges are arcs with one permitted direction each. A node then has an indegree, the number of arcs arriving, and an outdegree, the number leaving, and the two totals over the whole digraph agree, since both count the arcs once each. A walk in a digraph follows the arrows. Activity networks and flow networks later in this unit are digraphs, which is why an arc there offers one direction of travel rather than two.

WORKED EXAMPLE

Reading a small graph

A graph has nodes A, B, C and D, with two edges joining A and B, single edges BC, CD and DB, and a loop at C. Give the orders, say whether it is simple, and classify the sequences A B C D B and B C D B.

The orders are A 2, B 4, C 4 and D 2, the loop contributing two to C. They total 12, which is twice the six edges.

It is not simple, on two counts: the loop at C, and the pair of edges joining A and B.

A B C D B uses AB, BC, CD and DB, no edge twice, so it is a trail. B occurs twice in it, so it is not a path.

B C D B is a closed path through three nodes, so it is a cycle.

Deleting the loop and one of the two AB edges leaves a simple connected subgraph on the same four nodes.

Hamiltonian cycles and Ore's theorem

A Hamiltonian path visits each node of a graph once and once only. A Hamiltonian cycle is such a path that closes, finishing at the node it set out from, and a graph carrying one is a Hamiltonian graph. Edges may be left unused, which is what separates this from the Eulerian question, where the edges are the things being used up and a node may be passed several times.

The Eulerian question was settled by counting odd nodes. Nothing that cheap is known for this one: deciding whether a Hamiltonian cycle is there is one of the problems for which no quick method has been found, so a question either exhibits a cycle or argues that none exists.

Ore's theorem is a condition that settles the question one way without anybody finding a cycle. Take a simple graph on n nodes with n ≥ 3, and look only at the pairs of nodes with no edge between them. If deg v + deg w ≥ n for every such pair v, w, the graph is Hamiltonian. A graph with a good many edges has few pairs to check, since a joined pair is not part of the test, and the test itself is arithmetic on the orders.

In particular, if no node has order below n/2, any two orders total at least n, so the condition holds without a pair being looked at.

WORKED EXAMPLE

Using Ore's theorem

A graph has nodes A to F and twelve edges: AB, AC, BC, BD, BE, BF, CD, CE, CF, DE, DF and EF. Test Ore's condition, and find a Hamiltonian cycle.

The orders are A 2, B 5, C 5, D 4, E 4 and F 4, totalling 24, which is twice the twelve edges.

Six nodes make 6 × 5/2 = 15 pairs, and twelve of those pairs are joined, so three are not: A with D, A with E and A with F.

Each of the three totals 2 + 4 = 6, and n = 6, so the condition holds at every unjoined pair and the graph is Hamiltonian.

Now find the cycle. A has order 2, so a cycle through A uses both of A's edges, and B A C sits inside it. That leaves D, E and F to be strung between B and C, and B D E F C does it.

The cycle is A B D E F C A. Checking it against the list: AB, BD, DE, EF, CF and AC are all there, and the six nodes appear once each.

The theorem guaranteed a cycle before any of that searching, but it does not say which one.

The condition is sufficient and not necessary: meeting it settles the question, and failing it settles nothing at all. The five-node cycle A B C D E A is the extreme case. It is a Hamiltonian cycle itself, so the graph is Hamiltonian beyond argument, yet each node has order 2 and an unjoined pair totals 4, well under n = 5.

The unit's own network makes the same point in exam shape. Its orders are A 3, B 3, C 4, D 3, E 3 and F 2, and A and F are not joined, with orders totalling 5 against n = 6, so Ore's condition fails there. All the same, A B E F D C A uses AB, BE, EF, FD, CD and AC and visits each of the six nodes once, so the network is Hamiltonian.

Complete, planar and isomorphic

A complete graph Kn joins every pair of nodes, so it has n(n − 1)/2 edges. A graph is planar if it can be drawn with no edges crossing. Two graphs are isomorphic if one can be relabelled into the other, which needs matching numbers of nodes, edges and orders, though matching those does not by itself prove it. Give the correspondence.

The planarity algorithm works on a graph that contains a Hamiltonian cycle, so find one first. Redraw that cycle as a circle with the remaining edges as chords, then place each chord inside or outside. Two chords clash when they would cross on the same side. If the chords can be split into an inside group and an outside group with no clash in either, the graph is planar; if they cannot, it is not. K5 and K3,3 always fail, and Kuratowski's theorem says a graph is non-planar precisely when it contains a subdivision of one of them.

Kuratowski's two minimal obstructions: a graph is planar unless it contains a subdivision of K5 or K3,3
Describe the drawing

On the left, five nodes each joined to all the others, drawn as a pentagon with its diagonals. On the right, two rows of three nodes with every node in one row joined to every node in the other. Neither can be redrawn without lines crossing, and Kuratowski's theorem says a graph is non-planar precisely when it contains a subdivision of one of these two.

FIG. 3K5 and K3,3, the two minimal obstructions to planarity: neither can be drawn without crossings, and every non-planar graph contains a subdivision of one of them.

GUIDED PRACTICE

Testing a graph for planarity

Explain how you would test whether a graph containing a Hamiltonian cycle is planar, and why K5 fails.

Show the working

Redraw the Hamiltonian cycle as a circle with the remaining edges as chords.

Work through the chords, placing each inside or outside, and record which pairs would cross if they shared a side.

If every chord can be placed the graph is planar; if some chord clashes with whatever is on both sides, it is not.

Take K5 with the cycle ABCDEA. That uses five of the ten edges, leaving the chords AC, AD, BD, BE and CE.

Each chord clashes with exactly two of the others: AC with BD and BE, BD with CE, CE with AD, and AD with BE. Those clashes chain into a loop of five, and a loop of odd length cannot be split into two clash-free groups, so one chord always has nowhere to go.

Bipartite graphs and complements

A graph is bipartite when its nodes can be split into two groups with each edge running between the groups and none inside either. The complete bipartite graph Km,n joins each of m nodes to each of n nodes, so it has mn edges, and the K3,3 of the last section is the case m = n = 3 with its nine edges.

To test a graph, colour any node, colour its neighbours in the second colour, and carry on. A conflict, two nodes of one colour joined by an edge, shows that no split exists; a colouring that reaches the last node is the split, one colour on each side. What breaks the test is a cycle of odd length, since going round such a cycle returns to the starting node on the wrong colour, and a graph free of odd cycles passes it.

The complement of a graph on n nodes has the same nodes and the edges the graph lacks: draw Kn and rub out whatever the graph already carries. The two edge counts therefore add to n(n − 1)/2, and a node of order d in one has order n − 1 − d in the other. A question about the pairs of towns with no road between them is a question about the complement.

WORKED EXAMPLE

Colouring, and a complement

Test the five-node cycle A B C D E A and the four-node cycle A B C D A for bipartiteness, then find the complement of the five-node cycle.

Colour A red. Then B is blue, C red, D blue, and E has to be red; but E joins A, which is also red, so the colouring fails and the five-cycle is not bipartite. Its length, five, is odd, which is the reason.

For the four-cycle: A red, B blue, C red, D blue, and D joins A in the opposite colour, so it works. The split is {A, C} against {B, D}, and the four-cycle is K2,2.

K5 has 10 edges and the cycle uses 5, so the complement has 5 edges, and each node has order 4 − 2 = 2.

Those edges are AC, AD, BD, BE and CE, and following them round gives A C E B D A: the complement of a five-cycle is another five-cycle, drawn as the star.

Counting the regions

A planar drawing cuts the page into regions, also called faces, and the unbounded region outside the drawing counts as one of them. Count the nodes V, the edges E and the regions R of a connected planar drawing and V − E + R = 2 comes out, whichever drawing was made. That is Euler's formula, and redrawing the graph shuffles the regions about without changing how many there are, so the count belongs to the graph and not to the picture.

Here is why. Start from a spanning tree, which has V nodes, V − 1 edges and one region, so the count reads V − (V − 1) + 1 = 2. Putting back any other edge closes a cycle and so divides one region in two, raising E by one and R by one and leaving V − E + R where it was. Restore the edges one at a time and the whole graph is reached with the count untouched.

The formula bounds how many edges a planar graph can carry. In a simple graph each region is bounded by three edges or more, and counting each edge once for each of its two sides gives 2E ≥ 3R. Substituting R = 2 − V + E and tidying leaves E ≤ 3V − 6 for a simple connected planar graph on three or more nodes. A bipartite graph has no triangle, so its regions need four edges or more, 2E ≥ 4R, and the bound tightens to E ≤ 2V − 4.

That settles both obstructions without drawing a single chord. K5 has V = 5 and E = 10, against a bound of 3V − 6 = 9, so it fails and no plane drawing of it exists. K3,3 has V = 6 and E = 9 and is bipartite, so the tighter bound applies: 2V − 4 = 8, and nine edges is one too many. The reasoning runs one way only, since a graph that passes the bound may still be non-planar, and that is what Kuratowski's theorem is for.

WORKED EXAMPLE

Counting on a planar drawing

The network of this unit has nodes A to F and nine edges: AB, AC, AD, BC, BE, CD, CE, DF and EF. Draw it in the plane and count the regions.

Take the cycle A, B, E, F, D, A, which uses AB, BE, EF, FD and DA, and draw it as a pentagon.

The four edges left over, AC, BC, CD and CE, all meet at C, so put C inside the pentagon and run them out to A, B, D and E with no two crossing.

Those four edges divide the inside into four regions, and the page outside the pentagon is the fifth. So V = 6, E = 9, R = 5 and 6 − 9 + 5 = 2.

The bound had already said the attempt was worth making: 3V − 6 = 12, and nine edges sits under it.

Splitting a graph into planar layers

A graph that admits no plane drawing can still be drawn in layers. The thickness of a graph is the least number of planar subgraphs its edges can be split between, each edge going into one layer and each layer drawn without a crossing. Thickness 1 is planarity itself. Thickness 2 says the edges can be shared out between two sheets, each of them flat, which is the question a circuit board with conducting material on both faces asks.

Euler's bound says how few layers might do. A layer is a simple graph on the same V nodes, so it carries at most 3V − 6 edges, and t layers between them carry at most t(3V − 6). A graph with E edges therefore needs at least E/(3V − 6) layers, rounded up. Where the graph is bipartite the tighter bound 2V − 4 governs each layer instead, since a subgraph of a bipartite graph is bipartite.

That bound is a floor and a split of the edges is a ceiling, and where the two meet the thickness is settled. Questions at this level stop at two: decide whether one layer will do, and where it will not, produce the two layers. Finding a thickness above two is another matter and is not asked for.

WORKED EXAMPLE

The thickness of K5 and of K6

Find the thickness of K5 and of K6.

K5 has V = 5 and E = 10, and 3V − 6 = 9, so 10/9 rounds up to 2. One layer will not hold it, which is the calculation that showed it non-planar in the first place.

Two layers do hold it. Put the five-cycle A B C D E A in one, which leaves AC, CE, EB, BD and DA for the other, and those are the complement worked out above, which is the five-cycle A C E B D A. A cycle draws as a polygon with nothing crossing, so both layers are planar and the thickness of K5 is 2.

K6 has V = 6 and E = 15, and 3V − 6 = 12, so 15/12 rounds up to 2 again.

Take out the three edges AD, BE and CF. No two of them share a node, so they make a layer with nothing to cross.

The twelve edges left give each node order 4. Draw the triangle ABC, and inside it a triangle DEF placed so that F sits under the side AB, D under BC and E under CA, then join each inner node to the two outer nodes of the side it sits under. That is AB, BC, CA, DE, EF, FD, FA, FB, DB, DC, EC and EA, drawn with no crossing, so the thickness of K6 is 2.

Euler's formula audits that drawing: V = 6 and E = 12 give R = 2 − 6 + 12 = 8, and the picture does divide the page into eight triangles, seven inside the outer triangle and the region outside it.

K3,3 is settled as easily, using the bipartite bound. It has V = 6 and E = 9, and no layer of it carries more than 2V − 4 = 8 edges, so one layer is short by an edge and its thickness is above 1. With its sides labelled A, B, C and X, Y, Z, take out any single edge, say CZ, and what is left is planar: A and B joined to each of X, Y and Z gives three paths from A to B drawn side by side, and C, which now meets X and Y only, sits in the region between two of those paths. So the thickness of K3,3 is 2 as well: neither of Kuratowski's two obstructions fits on one sheet, and both fit on two.

ASSESSMENT FOCUS

  • Check that the graph is connected, then list the orders of all the nodes, before saying anything about Eulerian trails.
  • Testing Ore's condition, list the pairs of nodes with no edge between them and add their orders. A joined pair is not part of the test.
  • Ore's condition failing is not evidence that a graph has no Hamiltonian cycle. Say so, and go looking for one.
  • For thickness, take the floor from E over 3V − 6 rounded up, then split the edges into that many layers and draw each layer.
  • Check the orders total twice the number of edges. It catches a miscount immediately.
  • For isomorphism, match the orders and then give the correspondence explicitly.
  • For planarity, name the Hamiltonian cycle you are using and set the working out as a table of chords.
  • A loop adds two to an order, and a loop or a repeated edge stops a graph being simple. Name the fault you found rather than just saying 'not simple'.
  • Contracting AB, call the new node (AB) and check its order against the two old orders added and reduced by two.
  • Asked for a trail or a path, say which repetition you checked for: edges for a trail, nodes as well for a path.
  • Counting regions for Euler's formula, include the infinite region outside the drawing; omitting it makes the count one short and Euler's formula fail.
  • To show a graph is bipartite, give the two groups; to show it is not, name an odd cycle in it.

CHECK YOURSELF

A connected graph has nodes of order 2, 3, 3, 4 and 4. Is it Eulerian, semi-Eulerian or neither?

Show a hint

Count the odd nodes.

Show the answer

Two nodes are odd, so it is semi-Eulerian: a trail using every edge once exists, starting at one odd node and finishing at the other.

The orders always total twice the number of edges, so the number of odd nodes is always even.

For a connected graph, no odd nodes means Eulerian, exactly two means semi-Eulerian, and more than two means neither.

The planarity algorithm needs a Hamiltonian cycle: draw it as a circle and try to split the chords between inside and outside.

For a connected plane drawing, nodes − edges + regions = 2 with the region outside counted, so a simple planar graph holds at most 3V − 6 edges.

WORKBOOK

Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.

15 questions on this topicAnswer them one at a time and mark yourself against the worked answer.Practise this topic

Or read them with their worked answers on the graphs: order, Eulerian paths and planarity questions page.

CHECK YOUR PROGRESS

Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device, unless you sign in.

  • Find the order of every node and use it to classify a graph.
  • Recognise complete, planar, isomorphic and Hamiltonian structures.
  • Test a graph against Ore's condition, and name a Hamiltonian graph that fails it.
  • Apply the planarity algorithm to a Hamiltonian graph.
  • Split a non-planar graph into planar layers and give its thickness.
  • Distinguish walk, trail, path and cycle, and say what makes a graph simple.
  • Subdivide an edge and contract one, naming the contracted node in bracket notation.
  • Colour a graph to test whether it is bipartite, and write down a complement.
  • Count the regions of a plane drawing and use Euler's formula and the edge bound it gives.

Open the full revision checklist to see every objective in the course in one place.