Computing Twin-width with SAT and Branch & Bound

André Schidler, Stefan Szeider

Introduction

Twin-width is a relatively recent graph width measure introduced in 2020. It offers a powerful framework for solving NP-hard problems by identifying structural regularities in graphs. If a graph class has bounded twin-width, many otherwise intractable problems become solvable in linear time. However, the practical utility of twin-width is hindered by the computational difficulty of determining the measure itself, which is an NP-hard problem.

Figure 1: Illustration of a graph G, its contraction sequence, and the resulting contraction forest T.

Methodology

This research introduces two primary algorithmic approaches to compute twin-width more efficiently: a compact SAT encoding (SAT-CPT) and a custom Branch & Bound algorithm (BB-CCH).

SAT-CPT: A Compact SAT Encoding

Previous SAT-based methods for computing twin-width relied on $O(n^4)$ clauses, which limited scalability. The authors propose a more efficient encoding that reduces the complexity to $O(n^3)$. This is achieved by decoupling the representation of the contraction forest from the error-tracking logic. The encoding utilizes "totalizer" and "sequence counter" constraints to manage the "red edges"—edges representing inconsistencies introduced during vertex contraction.

Figure 4: A simplified graph showing the accumulation of red edges (errors) during the contraction process.

BB-CCH: Branch & Bound with Partition Caching

The BB-CCH algorithm employs a recursive search strategy enhanced by several pruning techniques:

  • Tri-twin Reduction: Merging vertices that satisfy specific structural conditions without affecting the optimal twin-width.
  • Symmetry Breaking: Utilizing graph automorphisms to avoid redundant exploration of isomorphic states.
  • Partition Caching: A novel caching mechanism that stores vertex partitions. By checking if a current partition has been processed previously, the algorithm avoids re-solving identical subproblems, which is significantly faster than full graph isomorphism checks.

Experimental Evaluation

The algorithms were benchmarked against two datasets:

  1. Structured Graphs: Mathematical families such as Paley, Grid, Rook, and Queen graphs, known for their complex internal structures.
  2. Treewidth Lib: A collection of 242 graph instances (up to 200 vertices) commonly used in width-measure research.

Key Results and Insights

The proposed methods demonstrate significant performance improvements over existing state-of-the-art tools:

  • Efficiency Gains: The SAT-CPT encoding achieved speedups of 10x to 100x on structured graphs. For instance, the Paley-73 graph's computation time was reduced from 12 hours to 13 minutes.
  • BB-CCH Performance: The Branch & Bound approach proved exceptionally fast for structured cases, often finding solutions in under one second.
  • Scalability: On the Treewidth Lib benchmark, the new methods solved 44 instances to optimality, more than doubling the 20 instances solved by previous methods. BB-CCH also provided superior upper bounds for the majority of the instances.

A key insight is the complementary nature of the two approaches: SAT solvers excel at finding optimal solutions for highly structured graphs, while Branch & Bound is more effective at providing tight upper bounds for larger, general-purpose graphs.

Conclusion

While computing twin-width remains a significant challenge for large, unstructured graphs, the SAT-CPT and BB-CCH algorithms represent a major step forward. The introduction of partition caching and more compact encodings allows for the practical application of twin-width to a broader range of problems. Future research will focus on integrating more advanced symmetry-breaking techniques and refining structural pruning rules to further push the boundaries of solvable instances.

Summary updated

BibTeX
@inproceedings{schidler2023computing,
  author = {André Schidler and Stefan Szeider},
  title = {{Computing Twin-width with SAT and Branch \& Bound}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/224},
}
Figure