NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Fast hamiltonicity checking via bases of perfect matchings

Marek Cygan, Stefan Kratsch, Jesper Nederlof

This research paper, "Fast Hamiltonicity checking via bases of perfect matchings," presents a significant breakthrough in the algebraic treatment of one of computer science's most famous NP-complete problems: finding a Hamiltonian cycle. By discovering a hidden low-rank structure in how graphs connect, the authors provide faster algorithms and prove that their approach hits a fundamental "speed limit" of computation.

TL;DR

The authors show that the "Matching Connectivity matrix"—which tracks how perfect matchings combine to form Hamiltonian cycles—has a surprisingly small basis. They use this algebraic insight to create the fastest known algorithms for Hamiltonicity in bipartite graphs and graphs with bounded pathwidth, proving the latter is optimal under the Strong Exponential Time Hypothesis (SETH).

What Problem Does This Paper Address?

The Hamiltonian Cycle problem (finding a simple cycle that visits every vertex exactly once) has been studied since the 19th century. While we have known since the 1960s how to solve it in $O(2^n)$ time using dynamic programming, breaking that exponential barrier is notoriously difficult.

The challenge lies in "state explosion." When building a cycle piece-by-piece (dynamic programming), you usually have to keep track of all the different ways partial paths can be paired up. Naively, the number of pairings grows super-exponentially (like $n!$). Previous work used "Catalan structures" to reduce this, but the authors of this paper ask: Can we use linear algebra to compress these states even further?

Methods

The core of the paper is the Matching Connectivity matrix ($H_t$). Imagine a matrix where both rows and columns are labeled by all possible perfect matchings of a graph with $t$ vertices. An entry is $1$ if the union of two matchings forms a single Hamiltonian cycle, and $0$ otherwise.

  • Matrix Factorization: The authors prove that $H_t$ has a rank of exactly $2^{t/2-1}$ over the field $GF(2)$. This is much smaller than the total number of matchings. They provide an explicit way to factor this large matrix into two smaller, rectangular ones.
  • Basis Change Algorithm: In dynamic programming over a "path decomposition," the set of active vertices changes as the algorithm moves through the graph. The authors developed a method to quickly update the "fingerprint" of partial solutions as the basis of matchings changes.
  • Isolation Lemma: Because their algebraic method counts solutions modulo 2, it might return 0 even if Hamiltonian cycles exist (if there's an even number of them). They use the Isolation Lemma—a standard tool in randomized algorithms—to assign random weights to edges, ensuring that a unique minimum-weight cycle exists with high probability, which "isolates" the solution for the modulo-2 check.

Datasets

As a theoretical computer science paper, it does not use empirical datasets or training sets. Instead, it evaluates performance based on complexity classes and graph types:

  • Directed Bipartite Graphs: Graphs where vertices are split into two sets and edges only go from one set to the other.
  • Bounded Pathwidth Graphs: Graphs that can be laid out in a "path-like" structure of a certain width ($pw$).
  • Cubic Graphs: Graphs where every vertex has exactly three neighbors.

Key Insights and Ideas

  • The "Aha" Moment on Rank: The most surprising finding is that the connectivity of matchings is "low-rank." Even though there are many ways to pair vertices, most of that information is redundant for the purpose of completing a Hamiltonian cycle. You only need to store a "fingerprint" of size $2^{t/2}$.
  • The $2 + \sqrt{2}$ Constant: This specific value ($\approx 3.414$) emerges from the recurrence relations used to build their matching basis. It represents a new fundamental constant for the complexity of Hamiltonicity.
  • Algebraic Compression: The paper shifts the focus from combinatorial state-tracking to algebraic representation. By working over $GF(2)$, they can "cancel out" complex path configurations that don't lead to a valid cycle.

Key Results

  • Bipartite Speedup: A new Monte Carlo algorithm for directed bipartite graphs that runs in $1.888^n n^{O(1)}$ time, significantly faster than the standard $2^n$.
  • Pathwidth Efficiency: For undirected graphs with pathwidth $pw$, they achieve a running time of $(2 + \sqrt{2})^{pw} n^{O(1)}$.
  • Cubic Graphs: As a corollary, they obtain an algorithm for cubic graphs running in $1.1583^n$ time, which was the fastest known at the time of publication.
  • Proving Optimality: Using a complex reduction from the Boolean Satisfiability problem (CNF-SAT), they prove that if anyone finds an algorithm faster than $(2 + \sqrt{2})^{pw}$, it would imply a major breakthrough in complexity theory (breaking SETH). This suggests their algorithm is essentially the best possible for this approach.

Limitations and Future Work

  • Randomization: The algorithms are Monte Carlo, meaning they can occasionally fail to find a cycle even if one exists (false negatives). Derandomizing these algorithms—making them deterministic while keeping the speed—remains a major open challenge.
  • Bipartiteness Constraint: The $1.888^n$ result currently only applies to directed graphs that are bipartite. The authors note that extending this to all directed graphs is a natural next step.
  • Treewidth vs. Pathwidth: While the paper focuses on pathwidth, many graphs are better described by "treewidth." The authors suggest that their techniques could likely be extended to treewidth with the same complexity, but the "basis change" logic becomes significantly more complex.

Summary updated

BibTeX
@inproceedings{cygan2013fast,
  author = {Marek Cygan and Stefan Kratsch and Jesper Nederlof},
  title = {{Fast hamiltonicity checking via bases of perfect matchings}},
  booktitle = {STOC},
  year = {2013},
  doi = {10.1145/2488608.2488646},
}
Figure