Planar Graphs
A graph is planar if it can be drawn in a plane with no edge crossings. BGL provides a complete pipeline for planarity testing, embedding, and drawing.
Quick decision
| I want to… | Use |
|---|---|
Test if a graph is planar |
|
Get a proof of non-planarity |
|
Draw a planar graph with no crossings |
Full pipeline (see below) |
Traverse the faces of an embedded graph |
The drawing pipeline
To produce a straight-line drawing (no edge crossings, all edges are line segments), the input must be a maximal planar graph with a planar embedding. BGL provides functions to build up to that step by step:
-
make_connected — add edges to make the graph connected
-
make_biconnected_planar — add edges to make it biconnected (preserving planarity)
-
make_maximal_planar — add edges to make it maximal planar (triangulated)
-
planar_canonical_ordering — produce a vertex ordering for drawing
-
chrobak_payne_straight_line_drawing — compute integer coordinates on a (2n-4) x (n-2) grid
-
is_straight_line_drawing — verify no edges cross
Each step requires a planar embedding, which is produced by the Boyer-Myrvold planarity test.
Key facts
-
A graph with no self-loops or parallel edges is planar iff it has no subgraph that is an expansion of K5 or K3,3 (Kuratowski’s theorem).
-
A planar graph on n vertices has at most 3n-6 edges and 2n-4 faces (Euler’s formula: n + f = e + c + 1).
-
All algorithms in this section run in O(n) time on planar graphs.
Planar embedding
A planar embedding specifies, for each vertex, the clockwise (or counter-clockwise) order of incident edges. It is the central data structure connecting the planarity test to all downstream algorithms. In BGL it is a property map from vertices to sequences of edge descriptors. See PlanarEmbedding concept.
All algorithms
| Algorithm | What it does |
|---|---|
Planarity test. Produces embedding or Kuratowski subgraph. |
|
Visit all faces of an embedded planar graph. |
|
Vertex ordering for straight-line drawing. |
|
Compute integer coordinates with no crossings. |
|
Verify a drawing has no crossings. |
|
Verify a non-planarity certificate. |
|
Add minimal edges to connect the graph. |
|
Add edges to make biconnected while preserving planarity. |
|
Add edges to triangulate while preserving planarity. |