Decision Mathematics 1 (Paper 3D or 4D), topic 1 (Algorithms and graph theory), spec point 1.4
The idea
A graph is planar if it can be drawn with no edges crossing. The planarity algorithm tests this when the graph has a Hamiltonian cycle.
The algorithm
- Find a Hamiltonian cycle. Draw it as a polygon, with the vertices in cycle order.
- List the edges not in the cycle.
- Choose one of these edges and label it I (drawn inside the polygon).
- Any unlabelled edge that would cross an I edge must go outside: label it O. Any that would cross an O edge must go inside: label it I.
- Repeat step 4 until no more labels can be forced. If there are unlabelled edges left, choose one, label it I, and continue.
- If an edge would have to be both I and O, the graph is not planar. If every edge gets a label with no conflict, it is planar.
When do two edges cross?
Two edges drawn on the same side of the polygon cross if their end vertices alternate round the cycle. With cycle ABCDEF, the edges AD and BE cross (A, B, D, E alternate), but AC and AD do not (they share A).
Worked example 1: planar
Cycle ABCDEFA, with extra edges AC, AD, AE and BD.
- AC: label I.
- BD crosses AC, so BD: label O.
- AD and AE cross neither AC nor BD (each pair shares a vertex or does not alternate), so put them inside: I.
Every edge is labelled with no conflict, so the graph is planar.
Worked example 2: not planar
Cycle ABCDEFA, with extra edges AD, BE and CF. Each pair of these crosses.
- AD: I. Then BE crosses AD, so BE: O. CF crosses AD, so CF: O.
- But CF also crosses BE, which is O, so CF must be I. Conflict, so the graph is not planar.
This graph is , the classic non-planar graph.
Common mistake: starting without a Hamiltonian cycle, or drawing the polygon with the vertices in the wrong order. The polygon must follow the cycle.
Exam tip: list the edges not in the cycle, then write each step: "XY crosses AB (I), so XY is O". End with a clear conclusion.
Check yourself
What must a graph have before you can use the planarity algorithm?
A Hamiltonian cycle.
With cycle ABCDEF, do edges BD and CE cross if both are inside?
Yes: B, C, D, E alternate.
What does a conflict in the labels show?
The graph is not planar.