GenerateRandomSearch

Planar Graph Generator

Most random graphs cannot be drawn flat: somewhere two edges have to cross. A planar one can, and this gives you both the graph and the drawing that proves it, with every corner on a whole-number position so the answer is a yes or a no rather than a close-enough. Start from a full triangulation — the most edges any flat drawing of that many corners can hold — and thin it out as far as you like.

What this generator does

Starts with one triangle and repeatedly drops a new corner strictly inside an existing triangle, joining it to that triangle’s three corners. Those three new edges run from a point inside a triangle out to its own corners, so they cannot cross anything. Repeating it gives a full triangulation, which is then thinned to the density you asked for.

How to use this tool

  1. Choose how many corners you want, from three to forty.
  2. Set how many of the possible edges to keep, and whether the drawing must stay in one piece.
  3. Draw it, and read the corner and edge counts underneath.
  4. Copy the corners and edges as a list, or the drawing itself.

Understanding the controls

Corners
Three to forty. A full drawing on that many corners has exactly three times the corners, less six, edges.
Edges to keep
A percentage of that ceiling. Taking edges away can never create a crossing, so the drawing stays flat however far it is thinned.
Keep it in one piece
Stops an edge being removed if losing it would break the drawing into separate pieces. With it on, the count of corners, edges and faces always balances.
Repeat word
The word this drawing was built from. It goes into the address bar, so the link gives back this exact graph — which is what a handout needs, and what a colleague needs when you are talking about the same picture.

Common use cases

  • Making examples for a class on graph drawing or Euler’s formula
  • Producing test cases for a program that colours or lays out flat graphs
  • Illustrating why the number of edges in a flat drawing has a ceiling
  • Giving students a map to four-colour that is guaranteed to have one
  • Making a figure for notes or a worksheet without drawing it by hand

How this generator works

Every pair of edges that does not share a corner is tested against every other, and the drawing is only shown once none of them crosses. Two further things are checked from the coordinates: that no three corners sit on a line, which is what keeps every crossing question a yes or a no; and that the edge count is inside the limit no flat drawing can exceed. Where the drawing is in one piece, the corners, edges and faces are added up and must come to two.

Randomness and fairness

Every drawing is built from a repeat word taken from your browser’s secure generator unless you type one of your own, and that word goes into the address bar, so the link gives back the same drawing. A repeat word exists to make a drawing reproducible; it is not a security measure, and nothing here is suitable for anything that has to stay secret.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Corners land on a grid of whole numbers, which is what keeps the geometry exact. Some drawings will have corners closer together than others.
  • Three to forty corners.
  • It draws a planar graph; it does not test whether some graph you already have is planar.
  • The thinned drawings keep the same corner positions as the full one, so a sparse graph may still look like a triangulation with pieces missing.

Privacy and your data

The drawing is made in your browser. Nothing about it is transmitted or stored.