Abstract
We define the modular treewidth of a graph as its treewidth after contraction of modules. This parameter properly generalizes treewidth and is itself properly generalized by clique-width. We show that the number of satisfying assignments can be computed in polynomial time for CNF formulas whose incidence graphs have bounded modular treewidth. Our result generalizes known results for the treewidth of incidence graphs and is incomparable with known results for clique-width (or rank-width) of signed incidence graphs. The contraction of modules is an effective data reduction procedure. Our algorithm is the first one to harness this technique for #SAT. The order of the polynomial bounding the runtime of our algorithm depends on the modular treewidth of the input formula. We show that it is unlikely that this dependency can be avoided by proving that SAT is W[1]-hard when parameterized by the modular incidence treewidth of the given CNF formula.
Similar content being viewed by others
References
Bacchus, F., Dalmao, S., Pitassi, T.: Solving #SAT and Bayesian inference with backtracking search. J. Artif. Intell. Res. 34, 391–442 (2009)
Bodlaender, H.L.: A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput. 25(6), 1305–1317 (1996)
Courcelle, B.: The monadic second-order logic of graphs XIV: uniformly sparse graphs and edge set quantifications. Theor. Comput. Sci. 299(13), 1–36 (2003)
Courcelle, B., Engelfriet, J., Rozenberg, G.: Handle-rewriting hypergraph grammars. J. Comput. Syst. Sci. 46(2), 218–270 (1993)
Courcelle, B., Makowsky, J.A., Rotics, U.: Linear time solvable optimization problems on graphs of bounded clique-width. Theory Comput. Syst. 33(2), 125–150 (2000)
Courcelle, B., Makowsky, J.A., Rotics, U.: On the fixed parameter complexity of graph enumeration problems definable in monadic second-order logic. Discr. Appl. Math. 108(1–2), 23–52 (2001)
Courcelle, B., Olariu, S.: Upper bounds to the clique-width of graphs. Discr. Appl. Math. 101(1–3), 77–114 (2000)
Fischer, E., Makowsky, J.A., Ravve, E.R.: Counting truth assignments of formulas of bounded tree-width or clique-width. Discr. Appl. Math. 156(4), 511–529 (2008)
Ganian, R., Hlinený, P., Obdrzálek, J.: Better algorithms for satisfiability problems for formulas of bounded rank-width. Fund. Inform. 123(1), 59–76 (2013)
Gomes, C.P., Sabharwal, A., Selman, B.: Handbook of Satisfiability. In: Biere, A., Heule, M., van Maaren, H., Walsh, T. (eds.) Model Counting, pp. 633–654. IOS Press, Amsterdam (2009)
Gottlob, G., Pichler, R.: Hypergraphs in model checking: acyclicity and hypertree-width versus clique-width. SIAM J. Comput. 33(2), 351–378 (2004)
Habib, M., Paul, C.: A survey of the algorithmic aspects of modular decomposition. Comput. Sci. Rev. 4(1), 41–59 (2010)
Kaski, P., Koivisto, M., Nederlof, J.: Homomorphic hashing for sparse coefficient extraction. In: 7th International Symposion on Parameterized and Exact Computation (IPEC 2012), LNCS, vol. 7535, pp. 147–158. Springer (2012)
Kloks, T.: Treewidth: Computations and Approximations. Springer, Berlin (1994)
Ordyniak, S., Paulusma, D., Szeider, S.: Satisfiability of acyclic and almost acyclic CNF formulas. Theor. Comput. Sci. 481, 85–99 (2013)
Oum, S., Seymour, P.: Approximating clique-width and branch-width. J. Combin. Theory Ser. B 96(4), 514–528 (2006)
Pietrzak, K.: On the parameterized complexity of the fixed alphabet shortest common supersequence and longest common subsequence problems. J. Comput. Syst. Sci. 67(4), 757–771 (2003)
Robertson, N., Seymour, P.D.: Graph minors X. Obstructions to tree-decomposition. J. Combin. Theory Ser. B 52(2), 153–190 (1991)
Roth, D.: On the hardness of approximate reasoning. Artif. Intell. 82(1–2), 273–302 (1996)
Samer, M., Szeider, S.: Algorithms for propositional model counting. J. Discrete Algorithms 8(1), 50–64 (2010)
Sang, T., Beame, P., Kautz, H.A.: Performing Bayesian inference by weighted model counting. In: Proceedings, The Twentieth National Conference on Artificial Intelligence and the Seventeenth Innovative Applications of Artificial Intelligence Conference, July 9–13, 2005, Pittsburgh, Pennsylvania, USA, pp. 475–482. AAAI Press/The MIT Press (2005)
Schönhage, A., Strassen, V.: Schnelle multiplikation großer zahlen. Computing 7(3–4), 281–292 (1971)
Szeider, S.: On fixed-parameter tractable parameterizations of SAT. In: Giunchiglia, E. Tacchella, A. (eds.) Theory and Applications of Satisfiability, 6th International Conference, SAT 2003, Selected and Revised Papers, Lecture Notes in Computer Science, vol. 2919, pp. 188–202. Springer (2004)
Valiant, L.G.: The complexity of computing the permanent. Theor. Comput. Sci. 8(2), 189–201 (1979)
Author information
Authors and Affiliations
Corresponding author
Additional information
Slivovsky and Szeider’s research was supported by the ERC, grant reference 239962. Paulusma’s research was supported by EPSRC, grant reference EP/G043434/1.
An extended abstract of this paper appeared in the Proceedings of STACS 2013.
Appendices
Appendix 1: The Proof of Theorem 2
Recall that the W[1]-hardness reduction of Theorem 2 is exactly the same as the reduction in the proof of the result from [15] that states that SAT is W[1]-hard when parameterized by the \(\beta \)-hypertree width. To be more precise, only Claim 1 in the proof of Theorem 2 is new.
Theorem 2 SAT is W[1]-hard, when parameterized by the modular incidence treewidth of the input formula.
Proof
A clique in a graph is a subset of vertices that are mutually adjacent. A k-partite graph is balanced if its k partition classes are of the same size. A partitioned clique of a balanced k-partite graph \(G=(V_1,\ldots ,V_k,E)\) is a clique K with \(|K\cap V_i|=1\) for \(i=1\ldots ,k\). We devise a parameterized reduction from the following problem, which is \(\text {W[1]}\)-complete [17].
Partitioned Clique
Instance: A balanced k-partite graph \(G=(V_1,\ldots ,V_k,E)\).
Parameter: The integer k.
Question: Does G have a partitioned clique?
Before we describe the reduction we introduce some auxiliary concepts. For any three variables \(z,x_1,x_2\), let \(F(z,x_1,x_2)\) denote the formula consisting of the clauses
This formula has exactly three satisfying assignments, corresponding to the vectors 000, 101, and 110. Hence each satisfying assignment sets at most one out of \(x_1\) and \(x_2\) to true, and if one of them is set to true, then z is set to true as well (“\(z=x_1+x_2\)”). Taking several instances of this formula we can build a “selection gadget.” Let \(x_1,\dots ,x_m\) and \(z_1,\dots ,z_{m-1}\) be variables. We define \(F^{=1}(x_1,\dots ,x_m;z_1,\dots ,z_{m-1})\) as the union of \(F(z_1,x_1,x_2)\), \(\bigcup _{i=2}^{m-1} F(z_{i},z_{i-1},x_{i+1})\), and \(\{\{z_{m-1}\}\}\). Now each satisfying assignment of this formula sets exactly one variable out of \(\{x_1,\dots ,x_m\}\) to true, and, conversely, for each \(1\le i \le m\) there exists a satisfying assignment that sets exactly \(x_i\) to true and all other variables from \(\{x_1,\dots ,x_m\}\) to false.
Now we describe the reduction. Let \(G=(V_1,\ldots ,V_k)\) be a balanced k-partite graph for \(k\ge 2\). We write \(V_i=\{v_1^i,\dots ,v_n^i\}\). We construct a formula F. As the variables of F we take the vertices of G plus new variables \(z_j^i\) for \(1\le i \le k\) and \(1\le j \le n-1\). We put \(F=\bigcup _{i=0}^kF_i\) where the formulas \(F_i\) are defined as follows: \(F_0\) contains for any \(u \in V_i\) and \(v \in V_j\) (\(i \ne j\)) with \(uv \notin E\) the clause \(C_{u,v} = \{\,\overline{u}, \overline{v} \,\}\cup \{\,w \;{|}\;w \in (V_i \cup V_j) {\setminus } \{\,u,v\,\}\,\}\); for \(i>0\) we define \(F_i=F^{=1}(v_1^i,\dots ,v_n^i;z_1^i,\dots ,z_{n-1}^i)\). To prove the theorem it suffices to show the following two claims.
Claim 1 The modular incidence treewidth of F is at most \(\bigl (\begin{array}{c} k\\ 2\end{array}\bigr ) + 1\).
For \(1 \le i \le k\), let \(D^i_1, \dots , D^i_n\) be the vertices in I(F) with \(N(D^i_1) =\{z^i_1, v^i_1, v^i_2\}\) , \(N(D^i_j) = \{z^i_j, z^i_{j-1},v^i_{j+1}\}\) for \(2 \le j \le n - 1\) and \(N(D^i_n) =\{z^i_{n-1}\}\). In I(F), the set of vertices \(C_{u,v}\) can be partitioned into modules \(\mathcal {C}_1 \dots , \mathcal {C}_m\), where \(m \le \bigl (\begin{array}{c} k \\ 2\end{array}\bigr )\). By deleting these modules, we obtain a graph \(I'(F)\) that consists of k connected components corresponding to the subgraphs of I(F) induced by \(\{v^i_1,\dots ,v^i_n,z^i_1,\dots ,z^i_{n-1},D^i_1,\dots ,D^i_n\}\) for \(1 \le i \le k\). Note that these components are trees, so the treewidth of \(I'(F)\) is 1. Thus the graph obtained from \(I'(F)\) by contracting modules has treewidth 1. We can turn the corresponding tree decomposition into a tree decomposition of \(I^*(F)\) that has width \(m+1\le \bigl (\begin{array}{c} k \\ 2\end{array}\bigr ) + 1\) by simply adding the set of m clause modules \(\{\mathcal {C}_1, \dots , \mathcal {C}_m\}\) to each bag.
Claim 2 G has a partitioned clique if and only if F is satisfiable.
To prove Claim 2 we first suppose that G has a partitioned clique K. We define a partial truth assignment \(\tau {:}\,V\rightarrow \{0,1\}\) by setting \(\tau (v)=1\) for \(v\in K\), and \(\tau (v)=0\) for \(v\notin K\). This partial assignment satisfies \(F_0\), and it is easy to extend \(\tau \) to a satisfying truth assignment of F. Conversely, suppose that F has a satisfying truth assignment \(\tau \). Because of the formulas \(F_i\), \(1\le i \le k\), \(\tau \) sets exactly one variable \(v^i_{j_i}\in V_i\) to true. Let \(K=\{v^1_{j_1},\dots ,v^k_{j_k}\}\). The clauses in \(F_0\) ensure that \(v^i_{j_i}\) and \(v^{i'}_{j_{i'}}\) are adjacent in G for each pair \(1\le i < i' \le k\), hence K is a partitioned clique of G. This proves Claim 2. \(\square \)
Appendix 2: The Missing Proof inside Example 2
Recall that in Example 2 we defined a formula \(\psi _m\) for \(m\ge 1\) as follows. We let \(x_1, \dots , x_m\), \(y_1, \dots , y_m\) be 2m distinct variables. Then we let \(\psi _m\) consist of the clauses \(C_i\) for \(1 \le i \le m\) where \(C_i = \{y_i, x_1, \dots , x_m\}\), along with m singleton clauses \(\{x_1\}, \dots , \{x_m\}\). In this appendix we show the following result. Note that all necessary terminology not stated in Sect. 2 is defined inside the proof.
Proposition 4
For all \(m\ge 1\), the signed incidence clique-width of \(\psi _m\) is at most 4.
Proof
Let C be a finite set. A C-labeled graph is a pair \((G, \lambda )\) where G is a directed graph and \(\lambda \) is a mapping \(\lambda {:} V(G) \rightarrow C\), called a C-labeling of G. Let \(\mathbf{G} = (G, \lambda )\) be a C-labeled graph and let \(a,b \in C\) with \(a \ne b\). We define the following two unary operations on labeled graphs:
-
We let \(\alpha _{a,b}(\mathbf{G}) = (G', \lambda )\), where \(G'\) is the graph obtained from G by introducing an arc (v, w) for any pair of vertices \(v,w \in V(G)\) such that \(\lambda (v) =a\) and \(\lambda (w) = b\).
-
We let \(\rho _{a \rightarrow b}(\mathbf{G}) = (G,\lambda ')\), where \(\lambda '(v) = b\) if \(\lambda (v) = a\) and \(\lambda '(v) = \lambda (v)\) otherwise, for any \(v \in V(G)\).
Moreover, for a set of vertices \(U \subseteq V(G)\), we let \(\mathbf{G}[U]\) denote the C-labeled graph \((G[U], \lambda |_U)\), where \(\lambda |_U\) denotes the restriction of \(\lambda \) to U. The disjoint union \(\mathbf{G}_{\mathbf{1}} \oplus \mathbf{G}_{\mathbf{2}}\) of two C-labeled graphs \(\mathbf{G}_{\mathbf{1}}\) and \(\mathbf{G}_{\mathbf{2}}\) is defined in the obvious way.
Let \(\mathbf{G} = (G, \lambda )\) and \(\mathbf{G}^{\varvec{'}} = (G', \lambda ')\) be C-labeled graphs. We write \(\mathbf{G} \rightarrow \mathbf{G}^{\varvec{'}}\) if \(V(G') = V(G)\) and one of the following conditions holds:
-
1.
\(\mathbf{G} = \mathbf{G}_{\mathbf{1}} \oplus \mathbf{G}_{\mathbf{2}}, \mathbf{G}^{\varvec{'}} = \mathbf{G}_{\mathbf{1}} \oplus \rho _{a \rightarrow b}(\mathbf{G}_{\mathbf{2}})\) or
-
2.
\(\mathbf{G} = \mathbf{G}_{\mathbf{1}} \oplus \mathbf{G}_{\mathbf{2}}, \mathbf{G}^{\varvec{'}} = \mathbf{G}_{\mathbf{1}} \oplus \alpha _{a,b}(\mathbf{G}_{\mathbf{2}})\),
where \(\mathbf{G}_{\mathbf{1}}, \mathbf{G}_{\mathbf{2}}\) are C-labeled graphs and \(a,b \in C\) with \(a \ne b\). A C-construction [7] of a labeled graph \(\mathbf{G}\) is a sequence \(\mathbf{G}_{\mathbf{0}},\mathbf{G}_{\mathbf{1}},\dots ,\mathbf{G}_{\mathbf{n}}\) of C-labeled graphs satisfying the following properties:
-
1.
\(\mathbf{G}_{\mathbf{0}} = (G_0, \lambda _0)\) such that \(E(G_0) = \emptyset \);
-
2.
\(\mathbf{G}_{\mathbf{i}} \rightarrow \mathbf{G}_{\mathbf{i}+\mathbf{1}}\) for \(0 \le i < n\);
-
3.
\(\mathbf{G}_{\mathbf{n}} = \mathbf{G}\).
By Proposition 3.1 of [7] a directed labeled graph \(\mathbf{G}\) has directed clique-width at most k if and only if \(\mathbf{G}\) has a C-construction for some set C of cardinality k.
Note that the signed incidence graph of a formula is a directed graph and that the signed incidence clique-width of a formula is equal to the directed clique-width of the signed incidence graph. In line with [7], we view unlabeled (directed) graphs as labeled graphs where all vertices have the same label. We give a C-construction of \((I_m, \lambda _1)\), where \(I_m\) denotes the signed incidence graph of \(\psi _m\), \(\lambda _1\) is a C-labeling of \(I_m\) such that \(\lambda _1(v) = 1\) for each \(v \in V(I_m)\), and \(C = \{1,2,3,4\}\). Recall that \(\psi _m = \{\,C_i, D_i \;{|}\;1 \le i \le m \,\}\), where \(C_i = \{y_i, x_1, \dots , x_m\}\) and \(D_i = \{x_i\}\). Accordingly, \(V(I_m) = \bigcup _{i=1}^m \{x_i,y_i,C_i,D_i\}\) and \(E(I_m) = \bigcup _{i=1}^m \{ (x_i,D_i),(y_i,C_i)\} \cup \{\,(x_i,C_j) \;{|}\;1 \le i,j \le m \,\}\).
Let \(G_0\) denote the (directed) graph with \(V(G_0) = V(I_m) = V\) and \(E(G_0) = \emptyset \), and let \(\lambda \) denote the C-labeling of \(G_0\) given by
for \(1 \le i \le m\). The graph \(\mathbf{G}_{\mathbf{0}} = (G_0, \lambda )\) will be the initial graph in our C-construction. For \(1 \le i \le m\), the graph \(\mathbf{G}_{\mathbf{i}}\) is simply the graph \(\mathbf{G}_{\mathbf{i}-\mathbf{1}}\) with an arc from \(x_i\) to \(D_i\). This can be expressed as
Under the assumption that
this implies that \(\mathbf{G}_{\mathbf{i}-\mathbf{1}} \rightarrow \mathbf{G}_{\mathbf{i}}\). Condition (5) is satisfied initially since \(G_0\) does not contain any edges, and the definition in (4) ensures that it remains true for \(1 \le i \le m\).
For \(m + 1 \le i \le 2m\), we let \(\mathbf{G}_{\mathbf{i}}\) be \(\mathbf{G}_{\mathbf{i}-\mathbf{1}}\) with an additional arc from \(y_i\) to \(C_i\). That is,
Again, this implies that \(\mathbf{G}_{\mathbf{i}-\mathbf{1}} \rightarrow \mathbf{G}_{\mathbf{i}}\) provided that
It follows from the construction of \(\mathbf{G}_{\mathbf{m}}\) and the definition in (6) that condition (7) must be satisfied for each \(m + 1 \le i \le 2m\). We let \(\mathbf{G}_{\mathbf{2m}+\mathbf{1}} = (G_{2m+1}, \lambda ) = \alpha _{2,3}(\mathbf {G_{2m}})\), introducing all arcs \((x_i, C_j)\) with \(1 \le i,j \le m\). Since \(G_{2m+1} = I_m\) and \(\mathbf{G}_{\mathbf{i}} \rightarrow \mathbf{G}_{\mathbf{i}+\mathbf{1}}\) for \(0 \le i \le 2m\) we find that the sequence \(\mathbf{G}_{\mathbf{0}},\mathbf{G}_{\mathbf{1}},\dots ,\mathbf{G}_{\mathbf{2m}+\mathbf{1}}\) is a C-construction of \((I_m, \lambda )\). Finally, we replace redundant labels by setting \(\mathbf{G}_{\mathbf{2m}+\mathbf{2}} = \rho _{2 \rightarrow 1}(\mathbf{G}_{\mathbf{2m}+\mathbf{1}})\), \(\mathbf{G}_{\mathbf{2m}+\mathbf{3}} = \rho _{3 \rightarrow 1}(\mathbf{G}_{\mathbf{2m}+\mathbf{2}})\), and \(\mathbf {G_{2m+4}} = \rho _{4 \rightarrow 1}(\mathbf{G}_{\mathbf{2m}+\mathbf{3}})\) to obtain a C-construction of \((I_m, \lambda _1)\). We conclude that \(I_m\) has directed clique-width at most \(|C| = 4\). Hence, the signed incidence clique-width of \(\psi _m\) (which is equal to the directed clique-width of \(I_m\), as observed above) is at most \(|C| = 4\) as well.\(\square \)
Rights and permissions
About this article
Cite this article
Paulusma, D., Slivovsky, F. & Szeider, S. Model Counting for CNF Formulas of Bounded Modular Treewidth. Algorithmica 76, 168–194 (2016). https://doi.org/10.1007/s00453-015-0030-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-015-0030-x