Perihamiltonian Graph

Author

Eric W. Weisstein
January 22, 2026

This notebook downloaded from https://mathworld.wolfram.com/notebooks/GraphTheory/PerihamiltonianGraph.nb.

For more information, see Eric's MathWorld entry https://mathworld.wolfram.com/PerihamiltonianGraph.html.

©2026 Wolfram Research, Inc. except for portions noted otherwise

Sources

https://houseofgraphs.org/meta-directory/perihamiltonian

Fabrici, I.; Madaras, T.; Timková, M.; van Cleemput, N.; and Zamfirescu, C.~T.  "Non-Hamiltonian Graphs in Which Every Edge-Contracted Subgraph Is Hamiltonian."   Appl. Math. Comput. 392, Art. 125714, 2021.

Counts

<<MathWorld`Graphs`

Do[Print[{n,Count[ConnectedGraphs[n],_?PerihamiltonianGraphQ]//Timing}],{n,9}]

Compute

true=Select[
GraphData[{"Connected","Nonhamiltonian"},;;12],
PerihamiltonianGraphQ[GraphData[#]]&
]

GraphDataCountTable

table=GraphDataCountTable["Perihamiltonian"]

DateString[]

TextGrid[OEISUpdates[table],Dividers->All]

Parametrized families

<<MathWorld`Graphs`

Alkane

seq=Table[GraphData[{"Alkane",n},"Perihamiltonian"],{n,10}]

AlternatingGroupGraph

seq=Table[GraphData[{"AlternatingGroupGraph",n},"Perihamiltonian"],{n,2,6}]

Andrasfai

seq=Table[GraphData[{"Andrasfai",n},"Perihamiltonian"],{n,20}]

Antelope n×n

seq=Table[GraphData[{"Antelope",{n,n}},"Perihamiltonian"],{n,20}]

Antiprism

Entity["Graph",{"Antiprism",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Antiprism",n},"Perihamiltonian"],{n,3,25}]

Apollonian

seq=Table[GraphData[{"Apollonian",n},"Perihamiltonian"],{n,5}]

Barbell

seq=Table[GraphData[{"Barbell",n},"Perihamiltonian"],{n,3,20}]

Bishop n×n

seq=Table[GraphData[{"Bishop",{n,n}},"Perihamiltonian"],{n,20}]

BlackBishop n×n

seq=Table[GraphData[{"BlackBishop",{n,n}},"Perihamiltonian"],{n,20}]

Book

seq=Table[GraphData[{"Book",n},"Perihamiltonian"],{n,20}]

Bruhat

seq=Table[GraphData[{"Bruhat",n},"Perihamiltonian"],{n,6}]

Camel n×n

seq=Table[GraphData[{"Camel",{n,n}},"Perihamiltonian"],{n,20}]

Cameron

seq=Table[GraphData[{"Cameron",n},"Perihamiltonian"],{n,20}]

Centipede

seq=Table[GraphData[{"Centipede",n},"Perihamiltonian"],{n,10}]

CocktailParty

seq=Table[GraphData[{"CocktailParty",n},"Perihamiltonian"],{n,20}]

Complete

Entity["Graph",{"Complete",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Complete",n},"Perihamiltonian"],{n,30}]

CompleteBipartite n×n

Entity["Graph",{"CompleteBipartite",{n,n}}]["Perihamiltonian"]

seq=Table[GraphData[{"CompleteBipartite",{n,n}},"Perihamiltonian"],{n,20}]

CompleteBipartite m×n

Entity["Graph",{"CompleteBipartite",{m,n}}]["Perihamiltonian"]

DeleteCases[Flatten[Table[{
{m,n},
GraphData[{"CompleteBipartite",{m,n}},"Perihamiltonian"],
Piecewise[{{False,m n==2},{True,Abs[n-m]==1||m==n==1}},False]
},{n,10},{m,n}],1],{_,x_,x_}]

CompleteTripartite n×n×n

Entity["Graph",{"CompleteTripartite",{n,n,n}}]["Perihamiltonian"]

seq=Table[GraphData[{"CompleteTripartite",{n,n,n}},"Perihamiltonian"],{n,10}]

CompleteTripartite k×m×n

Entity["Graph",{"CompleteTripartite",{k,m,n}}]["Perihamiltonian"]

DeleteCases[Flatten[Table[{
{k,m,n},
GraphData[{"CompleteTripartite",{k,m,n}},"Perihamiltonian"],
False
},{n,10},{m,n},{k,m}],2],{_,x_,x_}]

CossidentePenttila

GraphData[{"CossidentePenttila","Perihamiltonian"}]

CrossedPrism

seq=Table[GraphData[{"CrossedPrism",2n},"Perihamiltonian"],{n,2,12}]

Crown

seq=Table[GraphData[{"Crown",n},"Perihamiltonian"],{n,20}]

CubeConnectedCycle

Entity["Graph",{"CubeConnectedCycle",n}]["Perihamiltonian"]

seq=Table[GraphData[{"CubeConnectedCycle",n},"Perihamiltonian"],{n,3,8}]

Cycle

Entity["Graph",{"Cycle",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Cycle",n},"Perihamiltonian"],{n,3,30}]

CycleComplement

seq=Table[GraphData[{"CycleComplement",n},"Perihamiltonian"],{n,3,20}]

DiagonalIntersection

seq=Table[GraphData[{"DiagonalIntersection",n},"Perihamiltonian"],{n,3,14}]

Dipyramid

seq=Table[GraphData[{"Dipyramid",n},"Perihamiltonian"],{n,3,20}]

DorogovtsevGoltsevMendes

seq=Table[GraphData[{"DorogovtsevGoltsevMendes",n},"Perihamiltonian"],{n,0,7}]

DoubleCone

seq=Table[GraphData[{"DoubleCone",n},"Perihamiltonian"],{n,3,20}]

Empty

Entity["Graph",{"Empty",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Empty",n},"Perihamiltonian"],{n,30}]

FibonacciCube

seq=Table[GraphData[{"FibonacciCube",n},"Perihamiltonian"],{n,15}]

Fiveleaper n×n

seq=Table[GraphData[{"Fiveleaper",{n,n}},"Perihamiltonian"],{n,20}]

Flower

seq=Table[GraphData[{"Flower",n},"Perihamiltonian"],{n,5,20}]

FoldedCube

seq=Table[GraphData[{"FoldedCube",n},"Perihamiltonian"],{n,2,10}]

Gear

seq=Table[GraphData[{"Gear",n},"Perihamiltonian"],{n,3,20}]

Giraffe n×n

seq=Table[GraphData[{"Giraffe",{n,n}},"Perihamiltonian"],{n,20}]

Goldberg

seq=Table[GraphData[{"Goldberg",n},"Perihamiltonian"],{n,3,20}]

Grid n×n

Entity["Graph",{"Grid",{n,n}}]["Perihamiltonian"]

seq=Table[GraphData[{"Grid",{n,n}},"Perihamiltonian"],{n,20}]

Grid m×n

Entity["Graph",{"Grid",{m,n}}]["Perihamiltonian"]

Sort@DeleteCases[Flatten[Table[{
{m,n},
GraphData[{"Grid",{m,n}},"Perihamiltonian"],
Piecewise[{{True,m n==2||(Min[m,n]==3&&Mod[Max[m,n],2]==1)}},False]
},{n,10},{m,n}],1],{_,x_,x_}]

GraphData[{"Grid",{3,9}},"Perihamiltonian"]

PerihamiltonianGraphQ[GraphData[{"Grid",{3,9}}],Debug->True]//Timing

Grid n×n×n

Entity["Graph",{"Grid",{n,n,n}}]["Perihamiltonian"]

seq=Table[GraphData[{"Grid",{n,n,n}},"Perihamiltonian"],{n,10}]

Grid k×m×n

Entity["Graph",{"Grid",{k,m,n}}]["Perihamiltonian"]

Sort@DeleteCases[Flatten[Table[{
{k,m,n},
GraphData[{"Grid",{k,m,n}},"Perihamiltonian"],
Piecewise[{{True,k m n==2||(Min[k,m,n]==1&&k m n==3Max[k,m,n]&&Mod[Max[k,m,n],2]==1)}},False]
},{n,5},{m,n},{k,m}],2],{_,x_,x_}]

HalvedCube

seq=Table[GraphData[{"HalvedCube",n},"Perihamiltonian"],{n,10}]

Hanoi

seq=Table[GraphData[{"Hanoi",n},"Perihamiltonian"],{n,6}]

Helm

seq=Table[GraphData[{"Helm",n},"Perihamiltonian"],{n,3,20}]

Hypercube

Entity["Graph",{"Hypercube",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Hypercube",n},"Perihamiltonian"],{n,0,10}]

KC

GraphData[{"KC","Perihamiltonian"}]

Keller

Entity["Graph",{"Keller",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Keller",n},"Perihamiltonian"],{n,5}]

King n×n

seq=Table[GraphData[{"King",{n,n}},"Perihamiltonian"],{n,20}]

King m×n

DeleteCases[Flatten[Table[{
{m,n},
GraphData[{"King",{m,n}},"Perihamiltonian"],
Piecewise[{{True,m n==2}},False]
},{n,10},{m,n}],1],{_,x_,x_}]

Knight n×n

Entity["Graph",{"Knight",{n,n}}]["Perihamiltonian"]

seq=Table[GraphData[{"Knight",{n,n}},"Perihamiltonian"],{n,20}]

Knight m×n

Entity["Graph",{"Knight",{m,n}}]["Perihamiltonian"]

DeleteCases[Flatten[Table[{
{m,n},
GraphData[{"Knight",{m,n}},"Perihamiltonian"],
False
},{n,10},{m,n}],1],{_,x_,x_}]

KP

GraphData[{"KP","Perihamiltonian"}]

Ladder

Entity["Graph",{"Ladder",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Ladder",n},"Perihamiltonian"],{n,20}]

LadderRung

seq=Table[GraphData[{"LadderRung",n},"Perihamiltonian"],{n,20}]

LindgrenSousselier

seq=Table[GraphData[{"LindgrenSousselier",n},"Perihamiltonian"],{n,11}]

LucasCube

seq=Table[GraphData[{"LucasCube",n},"Perihamiltonian"],{n,15}]

MengerSponge

seq=Table[GraphData[{"MengerSponge",n},"Perihamiltonian"],{n,3}]

MoebiusLadder

Entity["Graph",{"MoebiusLadder",n}]["Perihamiltonian"]

seq=Table[GraphData[{"MoebiusLadder",n},"Perihamiltonian"],{n,3,25}]

Mycielski

Entity["Graph",{"Mycielski",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Mycielski",n},"Perihamiltonian"],{n,11}]

Odd

Entity["Graph",{"Odd",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Odd",n},"Perihamiltonian"],{n,7}]

Paley

GraphData[{"Paley","Perihamiltonian"}]

Pan

seq=Table[GraphData[{"Pan",n},"Perihamiltonian"],{n,3,20}]

Path

Entity["Graph",{"Path",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Path",n},"Perihamiltonian"],{n,20}]

PathComplement

seq=Table[GraphData[{"PathComplement",n},"Perihamiltonian"],{n,20}]

Peisert

GraphData[{"Peisert","Perihamiltonian"}]

Pell

seq=Table[GraphData[{"Pell",n},"Perihamiltonian"],{n,9}]

PlummerToft

seq=Table[GraphData[{"PlummerToft",n},"Perihamiltonian"],{n,20}]

Prism

Entity["Graph",{"Prism",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Prism",n},"Perihamiltonian"],{n,3,25}]

Queen n×n

seq=Table[GraphData[{"Queen",{n,n}},"Perihamiltonian"],{n,20}]

Rook n×n

seq=Table[GraphData[{"Rook",{n,n}},"Perihamiltonian"],{n,20}]

RookComplement n×n

seq=Table[GraphData[{"RookComplement",{n,n}},"Perihamiltonian"],{n,20}]

SierpinskiCarpet

seq=Table[GraphData[{"SierpinskiCarpet",n},"Perihamiltonian"],{n,4}]

SierpinskiGasket

seq=Table[GraphData[{"SierpinskiGasket",n},"Perihamiltonian"],{n,7}]

SierpinskiTetrahedron

seq=Table[GraphData[{"SierpinskiTetrahedron",n},"Perihamiltonian"],{n,6}]

Spoke n×n

seq=Table[GraphData[{"Spoke",{n,n}},"Perihamiltonian"],{n,5}]

StackedBook m×n

DeleteCases[Flatten[Table[{
{m,n},
GraphData[{"StackedBook",{m,n}},"Perihamiltonian"],
False
},{n,10},{m,n}],1],{_,x_,x_}]

StackedBook n×n

seq=Table[GraphData[{"StackedBook",{n,n}},"Perihamiltonian"],{n,10}]

StackedPrism m×n

DeleteCases[Flatten[Table[{
{m,n},
GraphData[{"StackedPrism",{m,n}},"Perihamiltonian"],
False
},{m,3,8},{n,5}],1],{_,x_,x_}]

StackedPrism n×n

seq=Table[GraphData[{"StackedPrism",{n,n}},"Perihamiltonian"],{n,3,5}]

Star

Entity["Graph",{"Star",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Star",n},"Perihamiltonian"],{n,25}]

Sun

seq=Table[GraphData[{"Sun",n},"Perihamiltonian"],{n,3,20}]

Sunlet

seq=Table[GraphData[{"Sunlet",n},"Perihamiltonian"],{n,3,20}]

Tetrahedral

seq=Table[GraphData[{"Tetrahedral",n},"Perihamiltonian"],{n,6,10}]

TorusGrid n×n

seq=Table[GraphData[{"TorusGrid",{n,n}},"Perihamiltonian"],{n,3,20}]

Transposition

Entity["Graph",{"Transposition",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Transposition",n},"Perihamiltonian"],{n,6}]

Trapezohedron

Entity["Graph",{"Trapezohedron",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Trapezohedron",n},"Perihamiltonian"],{n,3,20}]

Triangular

seq=Table[GraphData[{"Triangular",n},"Perihamiltonian"],{n,2,20}]

TriangularGrid

seq=Table[GraphData[{"TriangularGrid",n},"Perihamiltonian"],{n,0,20}]

TriangularHoneycombAcuteKnight

seq=Table[GraphData[{"TriangularHoneycombAcuteKnight",n},"Perihamiltonian"],{n,20}]

TriangularHoneycombBishop

seq=Table[GraphData[{"TriangularHoneycombBishop",n},"Perihamiltonian"],{n,20}]

TriangularHoneycombObtuseKnight

seq=Table[GraphData[{"TriangularHoneycombObtuseKnight",n},"Perihamiltonian"],{n,20}]

TriangularHoneycombQueen

seq=Table[GraphData[{"TriangularHoneycombQueen",n},"Perihamiltonian"],{n,20}]

TriangularHoneycombRook

seq=Table[GraphData[{"TriangularHoneycombRook",n},"Perihamiltonian"],{n,20}]

TriangularSnake

seq=Table[GraphData[{"TriangularSnake",n},"Perihamiltonian"],{n,1,20,2}]

Web

seq=Table[GraphData[{"Web",n},"Perihamiltonian"],{n,3,20}]

Wheel

Entity["Graph",{"Wheel",n}]["Perihamiltonian"]

seq=Table[GraphData[{"Wheel",n},"Perihamiltonian"],{n,4,20}]

WheelComplement

seq=Table[GraphData[{"WheelComplement",n},"Perihamiltonian"],{n,4,20}]

WhiteBishop n×n

seq=Table[GraphData[{"WhiteBishop",{n,n}},"Perihamiltonian"],{n,2,20}]

WhiteCamel n×n

seq=Table[GraphData[{"Bishop",{n,n}},"Perihamiltonian"],{n,{5}}]

Zebra n×n

seq=Table[GraphData[{"Zebra",{n,n}},"Perihamiltonian"],{n,20}]