Solving weighted and counting variants of connectivity problems parameterized by treewidth deterministically in single exponential time
It is well known that many local graph problems, like Vertex Cover and Dominating Set, can be solved in 2^{O(tw)}|V|^{O(1)} time for graphs G=(V,E) with a given tree decomposition of width tw. However, for nonlocal problems, like the fundamental class of connectivity problems, for a long time we did not know how to do this faster than tw^{O(tw)}|V|^{O(1)}. Recently, Cygan et al. (FOCS 2011) presented Monte Carlo algorithms for a wide range of connectivity problems running in time $c^{tw}|V|^{O(1)} for a small constant c, e.g., for Hamiltonian Cycle and Steiner tree. Naturally, this raises the question whether randomization is necessary to achieve this runtime; furthermore, it is desirable to also solve counting and weighted versions (the latter without incurring a pseudo-polynomial cost in terms of the weights). We present two new approaches rooted in linear algebra, based on matrix rank and determinants, which provide deterministic c^{tw}|V|^{O(1)} time algorithms, also for weighted and counting versions. For example, in this time we can solve the traveling salesman problem or count the number of Hamiltonian cycles. The rank-based ideas provide a rather general approach for speeding up even straightforward dynamic programming formulations by identifying “small” sets of representative partial solutions; we focus on the case of expressing connectivity via sets of partitions, but the essential ideas should have further applications. The determinant-based approach uses the matrix tree theorem for deriving closed formulas for counting versions of connectivity problems; we show how to evaluate those formulas via dynamic programming.
💡 Research Summary
The paper tackles a long‑standing gap in parameterized algorithms for graph problems: while many local problems (e.g., Vertex Cover, Dominating Set) admit deterministic algorithms running in $2^{O(\text{tw})}\cdot |V|^{O(1)}$ time on graphs equipped with a tree decomposition of width $\text{tw}$, non‑local connectivity problems such as Hamiltonian Cycle, Steiner Tree, or Traveling Salesperson have historically required $ \text{tw}^{O(\text{tw})}\cdot |V|^{O(1)}$ time. A breakthrough by Cygan et al. (FOCS 2011) showed that Monte‑Carlo (randomized) algorithms can achieve a single‑exponential dependence $c^{\text{tw}}\cdot |V|^{O(1)}$ for a wide range of connectivity problems. The natural question that follows is whether randomisation is essential, and whether the same speed can be obtained for weighted and counting versions without incurring pseudo‑polynomial dependence on the weights.
The authors answer both questions affirmatively by presenting two deterministic frameworks rooted in linear algebra: a rank‑based approach and a determinant‑based approach. Both yield $c^{\text{tw}}\cdot |V|^{O(1)}$ algorithms for a host of connectivity problems, and they extend seamlessly to weighted and counting variants.
Rank‑based approach.
Standard dynamic programming (DP) on a tree decomposition stores, for each bag, all partial solutions that respect the subgraph induced by the bag’s vertices. For connectivity problems these partial solutions encode global information (e.g., which vertices are already connected), leading to an exponential blow‑up in the number of states. The key insight is to view each partial solution as a binary vector (or matrix) and to study the linear span of these vectors over a finite field. If two sets of partial solutions generate the same subspace, one can be discarded without losing any global solution. By repeatedly applying Gaussian elimination during DP transitions, the algorithm maintains a representative set of at most $2^{O(\text{tw})}$ vectors per bag. This compression reduces the DP table size from $\text{tw}^{O(\text{tw})}$ to $c^{\text{tw}}$, while preserving correctness. The technique is particularly natural when connectivity is expressed via partitions of the bag’s vertices: each partition corresponds to a connectivity pattern, and the rank‑based reduction identifies a small basis of partitions that suffices to represent all possibilities. The authors prove that for any connectivity problem that can be expressed as a DP over partitions, the rank‑based reduction yields a deterministic $c^{\text{tw}}$ algorithm.
Determinant‑based approach.
The second framework leverages the Matrix‑Tree Theorem and its extensions. Many connectivity counting problems can be written as determinants of Laplacian‑type matrices. For example, the number of spanning trees equals any cofactor of the Laplacian; the number of Hamiltonian cycles can be expressed via a signed sum of permanents that, after algebraic manipulation, becomes a determinant of a suitably modified matrix. The authors show how to embed the weight of each edge directly into the matrix entries, so that the determinant evaluates to the total weight of all feasible substructures. Crucially, the determinant of the whole graph can be decomposed along a tree decomposition: each bag contributes a small sub‑matrix, and the global determinant can be assembled by a DP that multiplies and adds these local contributions. Because each local matrix has size bounded by $\text{tw}+1$, its determinant can be computed in $O(\text{tw}^3)$ time, and the DP runs in $c^{\text{tw}}$ steps. This yields deterministic algorithms for counting Hamiltonian cycles, counting Steiner trees of a given weight, and for solving the weighted Traveling Salesperson Problem (TSP) without any pseudo‑polynomial factor.
Weighted and counting variants.
Both frameworks naturally handle edge weights that are polynomially bounded or even exponential, because the algebraic operations (Gaussian elimination, determinant evaluation) are performed over rings that can encode weights symbolically. Consequently, the algorithms compute exact optimal values (for weighted decision problems) or exact counts (for counting problems) in the same $c^{\text{tw}}$ time bound.
Results and implications.
The paper presents concrete algorithms with explicit constants $c$ for several flagship problems:
- Hamiltonian Cycle existence and counting in $6^{\text{tw}}\cdot n^{O(1)}$ time.
- Traveling Salesperson Problem (both decision and optimization) in $6^{\text{tw}}\cdot n^{O(1)}$ time.
- Steiner Tree (weighted) in $5^{\text{tw}}\cdot n^{O(1)}$ time.
- Counting spanning trees, Steiner trees, and Hamiltonian cycles.
Beyond these, the authors argue that the rank‑based reduction is a general tool for any DP whose states can be represented as vectors over a field, suggesting future applications to problems such as graph partitioning, network design, and even certain parameterized counting problems outside pure connectivity.
In summary, the paper eliminates the need for randomisation in achieving single‑exponential dependence on treewidth for connectivity problems, and it simultaneously provides deterministic algorithms for weighted and counting versions. The two linear‑algebraic techniques—rank‑based state compression and determinant‑based counting—constitute a powerful new paradigm for designing efficient parameterized algorithms on graphs of bounded treewidth.