Advanced maths

Graph planarity calculator with embedding certificate

Test a small simple graph for planarity, returning cyclic neighbor orders and face walks or a verified K5 or K3,3 subdivision.

Your numbers

Labels are 1 through this count. Include isolated vertices.
One edge per row. Use distinct valid endpoints; no repeated unordered pairs. Leave empty for isolates.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A graph is planar when some drawing places its edges without crossings except at shared endpoints. One crossed drawing cannot decide this property. This calculator searches cyclic orders of incident edges around each vertex. Each order system determines directed face walks; a connected component has a spherical embedding when its vertex, edge and face counts satisfy Euler’s relation. Planar input returns those orders and walks. Nonplanar input is reduced to a subdivision of K5 or K3,3 whose branch paths can be checked in the original edge list.

THE FORMULAFor each connected embedding: V − E + F = 2; a Kuratowski subdivision certifies nonplanarity.

A worked example

The complete graph on four vertices has six edges. A valid embedding has four triangular faces, so V−E+F=4−6+4=2. Its usual square drawing has crossing diagonals, but moving one vertex inside a triangle gives a crossing-free drawing. By contrast, K5 has five vertices and ten edges, exceeding the simple planar bound 3V−6=9. The nonplanar certificate retains its ten edges as a K5 obstruction; no choice of drawing coordinates repairs it.

Good to know

Simple undirected graphs with 1–9 vertices and at most 18 edges. Exact rotation enumeration and obstruction extraction share a budget of 200,000 completed systems. Exceeding it gives an explicit resource error, not a false No or partial proof. This implementation is exhaustive small-instance search, not NetworkX’s left-right algorithm. Returned rotations are combinatorial, not drawing coordinates. Isolates and disconnected component face conventions are stated; loops and parallel rows are rejected.

Face walks turn local cyclic orders into a global certificate

An ordinary adjacency list does not specify which edge follows another around a vertex. A rotation system adds that cyclic order. Following an oriented edge to its endpoint and then taking the next neighbor in the declared order traces a face boundary. Every directed edge-side must be consumed once. The two directions of a bridge can belong to the same face, so a face walk may repeat a vertex or traverse one undirected edge twice.

For a connected component, the resulting surface has Euler value V−E+F. A value of two certifies genus zero for the verified orientable rotation system. Disconnected components are checked individually, then their outer faces are merged when reporting the whole-plane face count. An isolate has no edge walk and is assigned one local empty face. These conventions keep the global equation V−E+F=1+c consistent rather than counting a separate outer plane for every component.

K4 has a crossing-free triangle embedding with one interior vertex1234V = 4, E = 6F = 44 − 6 + 4 = 2
Three outer edges and three spokes embed the complete four-vertex graph without crossings. The three inner triangles and outer face give V−E+F=4−6+4=2.

A nonplanar subgraph is stronger evidence than an unattractive layout

When no supported rotation is planar, the calculator removes unnecessary edges while preserving nonplanarity. It then follows degree-two chains between branch vertices. Suppressing those subdivisions must produce either the five-vertex complete graph or the complete bipartite graph with three vertices in each part. The output keeps the original paths, allowing each claimed core edge to be traced back to actual entered edges.

The edge-density bound is useful only in one direction: too many edges can disprove planarity, but staying below the bound does not prove it. K3,3 has six vertices and nine edges, below 3V−6=12, yet is nonplanar. Resource exhaustion is another distinct outcome; an unfinished search provides neither a planar certificate nor a negative proof. The Graph isomorphism calculator for two adjacency matrices addresses relabeling, which preserves planarity but cannot replace an embedding test.

A few questions, answered

Does a crossing in the displayed graph prove nonplanarity?

No. A drawing can contain avoidable crossings. A verified embedding or a Kuratowski subdivision is the relevant certificate.

Are the returned face walks all simple cycles?

Not necessarily. Bridges and cut vertices can make a face boundary revisit vertices or use both directions of an edge. Read the ordered walk and the stated component convention.

Find your calculator

Start typing to explore the library.