A pancake graph has one vertex for every way to stack
distinct pancakes: one vertex
per permutation. Two stacks are adjacent when a single flip turns one
into the other, where a flip means sliding a spatula under the top
pancakes and
turning that block over.
Formally, let
be the symmetric group on
symbols. For
, the
prefix reversal
flips the first
entries:
![]()
The pancake graph is the Cayley graph
![]()
So
has
vertices, and each vertex has
one neighbor per available flip: degree
for
.
| Stack size | Vertices | Degree | Shape |
|---|---|---|---|
| A single vertex | |||
| A single edge | |||
| A 6-cycle | |||
| A 3-regular graph |
In
, the identity stack
has three neighbors, one
per flip:
![]()
The labels record which flip was used; the graph itself has just one undirected edge between each such pair.
For two pancakes there are two stacks,
and
, and one flip,
. So
is a single edge.
For three pancakes the only flips are
and
, so every vertex has degree
two, and a connected 2-regular graph is a cycle. The six stacks form a
hexagon, with the two flips alternating around it:
![]()
This is the best small example to keep in your head.
has
vertices. Three
flips are available (
,
,
), so the graph is
3-regular, with
![]()
edges. Here is all of it. Gray edges are
and
flips; blue edges are
flips. The four hexagons
are not an accident of the layout — the next section explains them.
Group the stacks by the pancake on the bottom:
![]()
The flips
never touch the bottom pancake, so inside each
they build a copy of
. Only the full flip
moves the bottom pancake.
It pairs each stack with its complete reversal, so the
edges form a perfect
matching on
, and every matching edge
joins two different copies (a stack’s top and bottom pancakes
differ).
In short:
is
copies of
, glued together by
a perfect matching.
This is exactly what the
drawing above shows. The
four hexagons are the copies of
— the stacks sharing a
bottom pancake — and the blue matching glues them together.
The glue also spreads out evenly. An
edge joins
to
exactly when a stack has
on the bottom and
on top, and there are
ways to fill in the
middle. So every pair of copies is joined by exactly
matching edges, and
collapsing each copy to a single node turns
into the complete graph
.
For
: four copies of
, with
matching edges
behind each dashed line.
For
: five copies of
, with
matching edges
per pair.
For
: six copies of
, with
matching edges
per pair.
This decomposition is the main reason pancake graphs are pleasant to
prove things about: a question about
usually reduces to the same
question inside copies of
, plus a controlled
accounting of the matching edges. The companion note on Berge-Tutte obstructions and
recursive cost shows that accounting in action.