Source
HamiltonianPath/SimpleGraph
Target
HamiltonianCircuit/SimpleGraph
Motivation
This is the standard path-to-cycle construction and supplies a missing reverse connection between two canonical Hamiltonian problems. There is currently no path from Hamiltonian Path to Hamiltonian Circuit.
Reference
Bowen Waggoner, “Standard 21: P and NP 2: NP-Completeness”, gives this mapping reduction explicitly: add a new vertex adjacent to every old vertex, extend a Hamiltonian path through it, and recover a Hamiltonian path by deleting it from a Hamiltonian cycle. The notes state the construction for directed graphs using both incident arc directions; for this repository's undirected SimpleGraph, those two directions become one undirected edge {x,v} and the same proof applies verbatim.
Garey and Johnson, Computers and Intractability, 1979, is retained as a reference for the Hamiltonian Path and Hamiltonian Circuit problem definitions and their classical complexity status; its catalog entries are not the source of the universal-vertex construction.
Reduction Algorithm
Let G=(V,E), n=|V|, and m=|E|.
- If
n<2, the source implementation accepts the unique empty/singleton ordering. Return a fixed triangle, and during extraction return the unique source ordering.
- Otherwise add a new vertex
x.
- Preserve every edge in
E and add {x,v} for every v in V.
- Given a Hamiltonian cycle in the target, rotate it to start at
x, delete x, and return the remaining vertex order.
For n>=2, a Hamiltonian path v_0,...,v_{n-1} extends to cycle x,v_0,...,v_{n-1},x. Conversely deleting x from any target Hamiltonian cycle leaves a Hamiltonian path in G. The explicit small-instance branch covers the full behavior of the source model, whose empty and singleton instances are satisfiable while the target rejects circuits with fewer than three vertices.
The repository's SimpleGraph representation permits self-loops and parallel edges. The construction copies them unchanged. They do not affect correctness: no new edge joins two old vertices, so every consecutive pair remaining after x is deleted must already be adjacent in G; loops cannot join two distinct positions of a Hamiltonian ordering, and parallel copies do not change adjacency.
Size Overhead
The formulas are safe polynomial upper bounds including the fixed small-instance output.
| Target metric |
Formula |
num_vertices |
num_vertices + 3 |
num_edges |
num_edges + num_vertices + 3 |
For n>=2, the exact sizes are n+1 vertices and m+n edges.
Validation Method
- Exhaust every simple graph through four vertices and compare source/target feasibility.
- Check both cycle orientations and rotation during extraction.
- Explicitly test
n=0, n=1, two isolated vertices, a single edge, disconnected graphs, stars, self-loops, and parallel edges.
Example
- Source instance:
V={0,1,2,3,4}, edges {01,12,23,34,02,13}. It has Hamiltonian path 0-1-2-3-4, alongside many invalid and partial orderings.
- Construction: add vertex
5 and edges {05,15,25,35,45}.
- Target instance: six vertices and eleven edges.
- Round trip: cycle
5-0-1-2-3-4-5 maps to source path 0-1-2-3-4. As a negative companion, the four-vertex star has no Hamiltonian path, and its augmented graph has no Hamiltonian cycle. Both were checked exhaustively.
BibTeX
@misc{Waggoner2025NPCompleteness,
author = {Waggoner, Bowen},
title = {Standard 21: P and NP 2: NP-Completeness},
year = {2025},
howpublished = {University of Colorado Boulder course notes},
url = {https://bowaggoner.com/courses/2025/csci3104/book/standards/21-pnp-complete.html},
note = {Accessed 2026-08-01}
}
@book{GareyJohnson1979,
author = {Garey, Michael R. and Johnson, David S.},
title = {Computers and Intractability: A Guide to the Theory of NP-Completeness},
publisher = {W. H. Freeman},
year = {1979}
}
Source
HamiltonianPath/SimpleGraph
Target
HamiltonianCircuit/SimpleGraph
Motivation
This is the standard path-to-cycle construction and supplies a missing reverse connection between two canonical Hamiltonian problems. There is currently no path from Hamiltonian Path to Hamiltonian Circuit.
Reference
Bowen Waggoner, “Standard 21: P and NP 2: NP-Completeness”, gives this mapping reduction explicitly: add a new vertex adjacent to every old vertex, extend a Hamiltonian path through it, and recover a Hamiltonian path by deleting it from a Hamiltonian cycle. The notes state the construction for directed graphs using both incident arc directions; for this repository's undirected
SimpleGraph, those two directions become one undirected edge{x,v}and the same proof applies verbatim.Garey and Johnson, Computers and Intractability, 1979, is retained as a reference for the Hamiltonian Path and Hamiltonian Circuit problem definitions and their classical complexity status; its catalog entries are not the source of the universal-vertex construction.
Reduction Algorithm
Let
G=(V,E),n=|V|, andm=|E|.n<2, the source implementation accepts the unique empty/singleton ordering. Return a fixed triangle, and during extraction return the unique source ordering.x.Eand add{x,v}for everyv in V.x, deletex, and return the remaining vertex order.For
n>=2, a Hamiltonian pathv_0,...,v_{n-1}extends to cyclex,v_0,...,v_{n-1},x. Conversely deletingxfrom any target Hamiltonian cycle leaves a Hamiltonian path inG. The explicit small-instance branch covers the full behavior of the source model, whose empty and singleton instances are satisfiable while the target rejects circuits with fewer than three vertices.The repository's
SimpleGraphrepresentation permits self-loops and parallel edges. The construction copies them unchanged. They do not affect correctness: no new edge joins two old vertices, so every consecutive pair remaining afterxis deleted must already be adjacent inG; loops cannot join two distinct positions of a Hamiltonian ordering, and parallel copies do not change adjacency.Size Overhead
The formulas are safe polynomial upper bounds including the fixed small-instance output.
num_verticesnum_vertices + 3num_edgesnum_edges + num_vertices + 3For
n>=2, the exact sizes aren+1vertices andm+nedges.Validation Method
n=0,n=1, two isolated vertices, a single edge, disconnected graphs, stars, self-loops, and parallel edges.Example
V={0,1,2,3,4}, edges{01,12,23,34,02,13}. It has Hamiltonian path0-1-2-3-4, alongside many invalid and partial orderings.5and edges{05,15,25,35,45}.5-0-1-2-3-4-5maps to source path0-1-2-3-4. As a negative companion, the four-vertex star has no Hamiltonian path, and its augmented graph has no Hamiltonian cycle. Both were checked exhaustively.BibTeX