Wednesday, October 14, 2026

[erhwccoo] Hamiltonian paths

given a graph, find a Hamiltonian path if it exists.  this is NP-complete.

if a Hamiltonian path is easy to find (perhaps there are many), find a path quickly.  this feels vaguely like the axiom of choice.  uniformly randomly sample among all Hamiltonian paths (cf Wilson's algorithm uniformly sampling spanning trees).

assign indices to each possible Hamiltonian path.  given an index, get its path.  inverse.

find a Hamiltonian cycle if one exists.  sample.  index.

find a Hamiltonian path if it exists with start and endpoint constrained to given subsets of nodes.

if a Hamiltonian path does not exist, find a path that maximizes the number of nodes visited, not visiting any node more than once.  or, approximately maximize: visit a lot of nodes.

No comments :