# Pancake graph

In the mathematical field of graph theory, the pancake graph P$_n$ or n-pancake graph is a graph whose vertices are the permutations of n symbols from 1 to n and its edges are given between permutations transitive by prefix reversals.
Pancake sorting is the colloquial term for the mathematical problem of sorting a disordered stack of pancakes in order of size when a spatula can be inserted at any point in the stack and used to flip all pancakes above it. A pancake number is the minimum number of flips required for a given number of pancakes. Obtaining the pancake number is equivalent to the problem of obtaining the diameter of the pancake graph.
The pancake graph of dimension n, P$_n$, is a regular graph with $n!$ vertices. Its degree is n − 1, hence, according to the handshaking lemma, it has ${\dfrac {1}{2}}~n!\left(n-1\right)$ edges. P$_n$ can be constructed recursively from n copies of P$_{n−1}$, by assigning a different element from the set {1, 2, …, n} as a suffix to each copy.

## Results

P$_n$ (n ≥ 4) is super-connected and hyper-connected.
Their girth is
    $g(P_{n})=6,{\text{ if }}n>2.$
The γ(P$_n$) genus of P$_n$ is bounded below and above by:
    $n!\left({\frac {n-4}{6}}\right)+1\leq \gamma (P_{n})\leq n!\left({\frac {3n-10}{12}}\right)+1.$

### Chromatic properties

There are some known graph coloring properties of pancake graphs.
A P$_n$ (n ≥ 3) pancake graph has total chromatic number $\chi _{t}(P_{n})=n$, chromatic index $\chi _{e}(P_{n})=n-1$.
There are effective algorithms for the proper (n−1)-coloring and total n-coloring of pancake graphs.
For the $\chi (P_{n})$ chromatic number the following limits are known:
If $4\leq n\leq 8$, then
    $\chi (P_{n})\leq {\begin{cases}n-k,&{\text{if }}n\equiv k{\pmod {4}},k=1,3;\\n-2,&{\text{if }}n\equiv k{\pmod {4}},k=0,2;\end{cases}}$
if $9\leq n\leq 16$, then
    $\chi (P_{n})\leq {\begin{cases}n-(k+2),&{\text{if }}n\equiv k{\pmod {4}},k=1,3;\\n-4,&{\text{if }}n\equiv k{\pmod {4}},k=0,2;\end{cases}}$
if $n\geq 17$, then
    $\chi (P_{n})\leq {\begin{cases}n-(k+4),&{\text{if }}n\equiv k{\pmod {4}},k=1,2,3;\\n-8,&{\text{if }}n\equiv k{\pmod {4}},k=0.\end{cases}}$
The following table discusses specific chromatic number values for some small n.
Specific, or probable values of the chromatic number :
| $n$ | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| $\chi (P_{n})$ | 2 | 3 | 3 | 4 | 4 | 4? | 4? | 4? | 4? | 4? | 4? | 4? | 4? | 4? |

### Cycle enumeration

In a P$_n$ (n ≥ 3) pancake graph there is always at least one cycle of length ℓ, when $6\leq \ell \leq n!$ (but there are no cycles of length 3, 4 or 5). It implies that the graph is Hamiltonian and any two vertices can be joined by a Hamiltonian path.
About the 6-cycles of the P$_n$ (n ≥ 4) pancake graph: every vertex belongs to exactly one 6-cycle. The graph contains ${\frac {n!}{6}}$ independent (vertex-disjoint) 6-cycles.
About the 7-cycles of the P$_n$ (n ≥ 4) pancake graph: every vertex belongs to $7\cdot (n-3)$ 7-cycles. The graph contains $n!\cdot (n-3)$ different 7-cycles.
About the 8-cycles of the P$_n$ (n ≥ 4) pancake graph: the graph contains ${\frac {n!(n^{3}+12n^{2}-103n+176)}{16}}$ different 8-cycles; a maximal set of independent 8-cycles contains ${\frac {n!}{8}}$ of those.

### Diameter

The pancake sorting problem (obtaining the pancake number) and obtaining the diameter of the pancake graph are equivalents. One of the main difficulties in solving this problem is the complicated cycle structure of the pancake graph.
Pancake numbers (sequence A058986 in the OEIS) :
| $n$ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| $P_{n}$ | 0 | 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
The pancake number, which is the minimum number of flips required to sort any stack of n pancakes has been shown to lie between ⁠15/14⁠n and ⁠18/11⁠n (approximately 1.07n and 1.64n,) but the exact value remains an open problem.
In 1979, Bill Gates and Christos Papadimitriou gave an upper bound of ⁠5/3⁠n. This was improved, thirty years later, to ⁠18/11⁠n by a team of researchers at the University of Texas at Dallas, led by Founders Professor Hal Sudborough (Chitturi et al., 2009).
In 2011, Laurent Bulteau, Guillaume Fertin, and Irena Rusu proved that the problem of finding the shortest sequence of flips for a given stack of pancakes is NP-hard, thereby answering a question that had been open for over three decades.

## Burnt pancake graph

In a variation called the burnt pancake problem, the bottom of each pancake in the pile is burnt, and the sort must be completed with the burnt side of every pancake down. It is a signed permutation, and if a pancake i is "burnt side up" a negative element i` is put in place of i in the permutation. The burnt pancake graph is the graph representation of this problem.
A $P'_{n}$ burnt pancake graph is regular, its order is $2^{n}\cdot n!$, its degree is $n$.
For its variant David S. Cohen (best known by his pen name "David X. Cohen") and Manuel Blum proved in 1995, that $3n/2\leq P'_{n}\leq 2n-2$ (when the upper limit is only true if $n>9$).
Burnt pancake numbers (sequence A078941 in the OEIS) :
| $n$ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| $P'_{n}$ | 1 | 4 | 6 | 8 | 10 | 12 | 14 | 15 | 17 | 18 | 19 | 21 |
The girth of a burnt pancake graph is:
    $g(P_{n})=8{\text{, if }}n>2.$

## Other classes of pancake graphs

Both in the original pancake sorting problem and the burnt pancake problem, prefix reversal was the operation connecting two permutations. If we allow non-prefixed reversals (as if we were flipping with two spatulas instead of one) then four classes of pancake graphs can be defined. Every pancake graph embeds in all higher-order pancake graphs of the same family.
Classes of pancake graphs :
| Name | Notation | Explanation | Order | Degree | Girth (if n>2) |
| unsigned prefix reversal graph | $UP_{n}$ | The original pancake sorting problem | $n!$ | $n-1$ | $6$ |
| unsigned reversal graph | $UR_{n}$ | The original problem with two spatulas | $n!$ | ${n \choose 2}$ | $4$ |
| signed prefix reversal graph | $SP_{n}$ | The burnt pancake problem | $2^{n}\cdot n!$ | $n$ | $8$ |
| signed reversal graph | $SR_{n}$ | The burnt pancake problem with two spatulas | $2^{n}\cdot n!$ | ${n+1 \choose 2}$ | $4$ |

## Applications

Since pancake graphs have many interesting properties such as symmetric and recursive structures (they are Cayley graphs, thus are vertex-transitive), sublogarithmic degree and diameter, and are relatively sparse (compared to e.g. hypercubes), much attention is paid to them as a model of interconnection networks for parallel computers. When we regard the pancake graphs as the model of the interconnection networks, the diameter of the graph is a measure that represents the delay of communication.
Pancake flipping has biological applications as well, in the field of genetic examinations. In one kind of large-scale mutations, a large segment of the genome gets reversed, which is analogous to the burnt pancake problem.