# Pancyclic graph

In the mathematical study of graph theory, a pancyclic graph is a directed graph or undirected graph that contains cycles of all possible lengths from three up to the number of vertices in the graph. Pancyclic graphs are a generalization of Hamiltonian graphs, graphs which have a cycle of the maximum possible length.

## Definitions

An n-vertex graph G is pancyclic if, for every k in the range 3 ≤ kn, G contains a cycle of length k. It is node-pancyclic or vertex-pancyclic if, for every vertex v and every k in the same range, it contains a cycle of length k that contains v. Similarly, it is edge-pancyclic if, for every edge e and every k in the same range, it contains a cycle of length k that contains e.

A bipartite graph cannot be pancyclic, because it does not contain any odd-length cycles, but it is said to be bipancyclic if it contains cycles of all even lengths from 4 to n.

## Planar graphs

A maximal outerplanar graph is a graph formed by a simple polygon in the plane by triangulating its interior. Every maximal outerplanar graph is pancyclic, as can be shown by induction. The outer face of the graph is an n-vertex cycle, and removing any triangle connected to the rest of the graph by only one edge (a leaf of the tree that forms the dual graph of the triangulation) forms a maximal outerplanar graph on one fewer vertex, that by induction has cycles of all the remaining lengths. With more care in choosing which triangle to remove, the same argument shows more strongly that every maximal outerplanar graph is node-pancyclic. The same holds for graphs that have a maximal outerplanar spanning subgraph, as do for instance the wheel graphs.

A maximal planar graph is a planar graph in which all faces, even the outer face, are triangles. A maximal planar graph is node-pancyclic if and only if it has a Hamiltonian cycle: if it is not Hamiltonian, it is certainly not pancyclic, and if it is Hamiltonian, then the interior of the Hamiltonian cycle forms a maximal outerplanar graph on the same nodes, to which the previous argument for maximal outerplanar graphs can be applied. For instance, the illustration shows the pancyclicity of the graph of an octahedron, a Hamiltonian maximal planar graph with six vertices. More strongly, by the same argument, if a maximal planar graph has a cycle of length k, it has cycles of all smaller lengths.

Halin graphs are the planar graphs formed from a planar drawing of a tree that has no degree-two vertices, by adding a cycle to the drawing that connects all the leaves of the tree. Halin graphs are not necessarily pancyclic, but they are almost pancyclic in the sense that there is at most one missing cycle length. The length of the missing cycle is necessarily even. If none of the interior vertices of a Halin graph has degree three, then it is necessarily pancyclic.

Bondy (1971) observed that many classical conditions for the existence of a Hamiltonian cycle were also sufficient conditions for a graph to be pancyclic, and on this basis conjectured that every 4-connected planar graph is pancyclic. However, Malkevitch (1971) found a family of counterexamples.

## Tournaments

A tournament is a directed graph with one directed edge between each pair of vertices. Intuitively, a tournament can be used to model a round-robin sports competition, by drawing an edge from the winner to the loser of each game in the competition. A tournament is called strongly connected or strong if and only if it cannot be partitioned into two nonempty subsets L and W of losers and winners, such that every competitor in W beats every competitor in L. Every strong tournament is pancyclic and node-pancyclic. If a tournament is regular (each competitor has the same number of wins and losses as each other competitor) then it is also edge-pancyclic; however, a strong tournament with four vertices cannot be edge-pancyclic.

## Graphs with many edges

Mantel's theorem states that any n-vertex undirected graph with at least n2/4 edges, and no multiple edges or self-loops, either contains a triangle or it is the complete bipartite graph Kn/2,n/2. This theorem can be strengthened: any undirected Hamiltonian graph with at least n2/4 edges is either pancyclic or Kn/2,n/2.

There exist n-vertex Hamiltonian directed graphs with n(n + 1)/2 − 3 edges that are not pancyclic, but every Hamiltonian directed graph with at least n(n + 1)/2 − 1 edges is pancyclic. Additionally, every n-vertex strongly connected directed graph in which each vertex has degree at least n (counting incoming and outgoing edges together) is either pancyclic or it is a complete bipartite directed graph.

## Graph powers

For any graph G, its kth power Gk is defined as the graph on the same vertex set that has an edge between every two vertices whose distance in G is at most k. If G is 2-vertex-connected, then by Fleischner's theorem its square G2 is Hamiltonian; this can be strengthened to show that it is necessarily vertex-pancyclic. More strongly, whenever G2 is Hamiltonian, it is also pancyclic.

## Computational complexity

It is NP-complete to test whether a graph is pancyclic, even for the special case of 3-connected cubic graphs, and it is also NP-complete to test whether a graph is node-pancyclic, even for the special case of polyhedral graphs. It is also NP-complete to test whether the square of a graph is Hamiltonian, and therefore whether it is pancyclic.

## History

Pancyclicity was first investigated in the context of tournaments by Harary & Moser (1966), Moon (1966), and Alspach (1967). The concept of pancyclicity was named and extended to undirected graphs by Bondy (1971).