Fast exact algorithms via the Matrix Tree Theorem
V. Arvind, Srijan Chakraborty, Samir Datta, Asif Khan
TL;DR
The paper presents a unified, simple framework that leverages the Matrix Tree Theorem and roots-of-unity sieving to design fast exact algorithms for counting Hamiltonian paths and a broad class of subgraph patterns, all within polynomial space. A central recipe constructs a graph H and a matrix C so that determinants encode spanning-tree–based encodings of target patterns, and then uses root-of-ununity substitutions to isolate the desired monomials, optionally aided by the isolation lemma. The method yields near-best-known runtimes for several problems: undirected bipartite Hamiltonian paths in $O^*(2^{n/2})$, directed bipartite Hamiltonian paths in $O^*(3^{n/2})$, and counting of perfect matchings in bipartite graphs in $O^*(2^{n/2})$, among others, with extensions to maximum matchings via the Gallai–Edmonds decomposition and to perfect $k$-star covers and $k$-matchings. All algorithms operate in polynomial space, highlighting the practicality and scalability of the approach. The work unifies and simplifies prior algebraic techniques, offering a versatile framework that can drive further improvements in exact counting and decision problems in graphs.
Abstract
Fast exact algorithms are known for Hamiltonian paths in undirected and directed bipartite graphs through elegant though involved algorithms that are quite different from each other. We devise algorithms that are simple and similar to each other while having the same upper bounds. The common features of these algorithms is the use of the Matrix-Tree theorem and sieving using roots of unity. Next, we use the framework to provide alternative algorithms to count perfect matchings in bipartite graphs on $n$ vertices, i.e., computing the $\{0,1\}$-permanent of a square $n/2 \times n/2$ matrix which runs in a time similar to Ryser. We demonstrate the flexibility of our method by counting the number of ways to vertex partition the graph into $k$-stars (a $k$-star consist of a tree with a root having $k-1$ children that are all leaves). Interestingly, our running time improves to $O^*((1+ε_k)^n)$ with $ε_k \rightarrow 0$ as $k \rightarrow \infty$. As an aside, making use of Björklund's algorithm for exact counting perfect matchings in general graphs, we show that the count of maximum matchings can be computed in time $O^*(2^ν)$ where $ν$ is the size of a maximum matching. The crucial ingredient here is the famous Gallai-Edmonds decomposition theorem. All our algorithms run in polynomial space.
