[Paper Review] A Linear Time Algorithm for Solving #2SAT on Cactus Formulas
This paper presents an O(n + m)-time algorithm for counting the number of satisfying assignments (#2SAT) in 2-CNF formulas whose underlying graph structure forms a cactus. By exploiting the tree-like structure of cacti and using dynamic programming on the cycle structure, the algorithm achieves linear-time complexity, outperforming state-of-the-art tools like sharpSAT and countAntom in empirical evaluation.
An O(n+m)-time algorithm is presented for counting the number of models of a two Conjunctive Normal Form Formula F that represents a Cactus graph, where n is the number of variables and m is the number of clauses of F. Although, it was already known that this class of formulas could be computed in polynomial time, we compare our proposal algorithm with two state of the art implementations for the same problem, sharpSAT and countAntom. The results of the comparison show that our algorithm outperforms both implementations, and it can be considered as a base case for general counting of two Conjunctive Normal Form Formulas.
Motivation & Objective
- To develop an efficient algorithm for counting models of 2-CNF formulas restricted to cactus graphs.
- To achieve linear-time complexity O(n + m) in the number of variables and clauses.
- To outperform existing state-of-the-art solvers such as sharpSAT and countAntom in runtime efficiency.
- To provide a foundational approach for general #2SAT counting by exploiting structural properties of cactus formulas.
Proposed method
- The algorithm models the 2-CNF formula as a cactus graph, where each clause corresponds to an edge and variables to vertices.
- It uses dynamic programming on the tree decomposition of the cactus, handling cycles and trees separately.
- For each biconnected component (cycle or tree), it computes the number of valid variable assignments satisfying all clauses.
- The algorithm traverses the cactus structure in linear time, combining results from subtrees and cycles using multiplicative and additive rules.
- It leverages the fact that cactus graphs have at most one cycle through any edge, simplifying dependency tracking.
- The final count is computed by aggregating contributions from all components using recursive combination rules.
Experimental results
Research questions
- RQ1Can #2SAT on cactus formulas be solved in linear time using structural properties of the formula graph?
- RQ2How does the performance of the proposed algorithm compare to existing state-of-the-art solvers like sharpSAT and countAntom?
- RQ3To what extent can the cactus structure be exploited to design efficient counting algorithms?
- RQ4Is the proposed algorithm a viable base case for general #2SAT counting?
Key findings
- The proposed algorithm runs in O(n + m) time, achieving linear complexity in the size of the input formula.
- Empirical evaluation shows the algorithm outperforms both sharpSAT and countAntom in runtime across tested instances.
- The algorithm effectively exploits the cactus structure by decomposing the formula into cycles and trees for independent processing.
- The dynamic programming approach on the cactus graph structure enables efficient and correct model counting without exponential blowup.
- The results validate the algorithm as a strong candidate for use as a base case in broader #2SAT counting frameworks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.