A large part of research on parameterized algorithms has been focused on algorithmic techniques for parametrizations of decision problems. However, relatively less effort has been invested for solving parameterized counting problems. In this paper, we provide a general data-reduction concept for counting problems, leading to a formal definition of the notion of a compactor. Our main result is an algorithmic meta-theorem for the existence of a polynomial size compactor, that is applicable to a wide family of problems of graphs.
1.1 General context
Parameterized complexity has been proposed as a multi-variable framework for coping with the inherent complexity of computational problems. Nowadays, it is a mature discipline of modern Theoretical Computer Science and has offered a wealth of algorithmic techniques and solutions (see [14, 19, 24, 42] for related textbooks). In some cases, in-depth investigations on the common characteristics of parameterized problems gave rise to algorithmic meta-theorems. Such theorems typically provide conditions, logical and/or combinatorial, for a problem to admit a parameterized algorithm [33, 32, 39, 46]. Important algorithmic meta-theorems concern model-checking for Monadic Second Order Logic (MSOL) [11, 9, 2, 47] on bounded treewidth graphs and model checking for First Order Logic (FOL) on certain classes of sparse graphs [23, 31, 15, 22, 21, 34].
In some cases, such theorems have a counterpart on counting parameterized problems. Here the target is to prove that counting how many solutions exist for a problem is fixed parameter tractable, under some parameterization of it. Related meta-algorithmic results concern counting analogues of Courcelle’s theorem, proved in , stating that counting problems definable in MSOL are fixed-parameter tractable when parameterized by the tree-width of the input graph. Also similar results for certain fragments of MSOL hold when parameterized by the rank-width of the input graph . Moreover, it was shown in  that counting problems definable in first-order logic are fixed-parameter tractable on locally tree-decomposable graphs (e.g. for planar graphs and bounded genus graphs).
Kernelization and data-reduction.
A well-studied concept in parameterized complexity is kernelization. We say that a parameterized problem admits a polynomial kernel if there is an algorithm – called kernelization algorithm – that can transform, in polynomial time, every input instance of the problem to an equivalent one, whose size is bounded by a function of the parameter. When this function is polynomial then we have a polynomial kernel. A polynomial kernel permits the drastic data-reduction of the problem instances to equivalent “miniatures” whose size is independent from the bulk of the input size and is polynomial on the parameter. That way, a polynomial kernel, provides a preprocessing of computationally hard problems that enables the application of exact algorithmic approaches (however still super-polynomial) on significantly reduced instances .
Meta-algorithmic results for kernelization.
Apart from the numerous advances on the design of polynomial kernels for particular problems, algorithmic meta-theorems appeared also for kernelization. The first result of this type appeared in , where it was proved that certain families of problems on graphs admit polynomial kernels on bounded genus graphs. The logic-condition of  is CMSOL-expressibility or, additionally, the Finite Integer Index (FII) property (see [1, 8, 16]). Moreover, the meta-algorithmic results of  require additional combinatorial properties for the problems in question. The results in  where extended in  (see also ) where the combinatorial condition for the problem was related to bidimensionality, while the applicability of the results was extended in minor-closed graph classes. Finally, further extensions appeared in  where, under the bounded treewidth-modulability property (see Subsection 1.2), some of the results in [25, 5] could be applied to more graph classes, in particular those excluding some fixed graph as a topological minor.
Data reduction for counting problems.
Unfortunately, not much has been done so far in the direction of data-reduction for parameterized counting problems. The most comprehensive work in this direction was done by Marc Thurley  (see also ) who proposed the first formal definition of a kernelization analogue for parameterized problems called counting kernelization. In  Thurley investigated up to which extent classic kernelization techniques such as Buss’ Kernelization and crown decomposition may lead to counting counterparts of kernelization. In this direction, he provided counting kernelizations for a series of parameterized counting problems such as and -#VertexCover, -card-#Hitting Set and -#Unique Hitting Set.
Another framework for data-reduction on parameterized counting problems is provided by the notion of a compactor. In a precursory level, it appeared for the first time in . The rough idea in  was to transform the input of a parameterized counting problem to a structure, called the compactor, whose size is (polynomially) bounded by the parameter and such that the enumeration of certain family of objects (referred as compactor enumeration in ) in the compactor is able to derive the number of solutions for the initial instance. This technique was introduced in  for counting restrictive list -colorings and, later in , for counting generalized coverings and matchings. However none of [18, 43] provided a general formal definition of a compactor, while, in our opinion, the work of Thurley provides a legitimate formalization of compactor enumeration.
In this paper, we define formally the concept of a compactor for parameterizations of function problems (that naturally include counting problems) that is not based on enumeration. As a first step, we observe that for parameterized function problems, the existence of a compactor is equivalent to the existence of an FPT-algorithm, a fact that is also the case for classic kernels on decision problems and for counting kernels in .
Under the above formal framework, we prove an algorithmic meta-theorem on the existence of polynomial compactors for a general family of graph problems. In the next subsection, we define the compactor concept and we present the related meta-algorithmic results.
1.2 Our results
Counting problems and parameterizations.
First of all notice that, for a counting problem, it is not possible to have a kernelization in the classic sense, that is to produce an reduced instance, bounded by a function of , that is counting-equivalent in the sense that the number of solutions in the reduced instance will provide the number of solutions in the original one. For this reason we need a more refined notion of data compression where we transform the input instance to “structure”, whose size is bounded by a function of This structure contains enough information (combinatorial and arithmetical) so as to permit the recovering of the number of the solutions in the initial instance. We next formalize this idea to the concept of a compactor.
Let be all non-negative integers and by the set of all polynomials. Let be a fixed alphabet. A parameterized function problem is a pair where An FPT-algorithm for is one that, given , outputs in steps. When evaluating the running time, we use the standard Uniform Cost Measure (UCM) model where all basic arithmetic computations are carried out in constant time. We also disregard the size of the numbers that are produced during the execution of the algorithm.
Let be a parameterized function problem. A compactor for is a pair where
is a polynomially computable function, called an condenser,
is a computable function, called a extractor,
, i.e., , , and
there is a recursive function where
We call the function size of the compactor and, if , we say that is a polynomial-size compactor for We call the running time of the algorithm computing , measured as a function of , condensing time of We also call the running time of the algorithm computing , measured as a function of , decoding time of We can readily observe the following.
A parameterized function problem has an FPT-algorithm if and only if there is a compactor for it.
Let be a parameterized function problem. We assume the UMC model. Suppose that an algorithm computes in time for any input Then let be a function defined as
Cleary, can be computed in polynomial time since if , then one can compute by in time Furthermore, has length at most For the extractor , we define the image of under as
Note that the function can be computed; in particular can be computed by Clearly, we have and is a compactor for
Conversely, let be a compactor for and a function be a size of the compactor. For any input , we can run an algorithm in time to compute and an algorithm in time to compute As and the function can be assumed to be non-decreasing, this computes in time ∎
Up to our best knowledge, the notion of compactor as formalized in this paper is new. As discussed in Subsection 1.1, similar notions have been proposed such as counting kernelization  and compactor enumeration . In both counting kernelization and compact enumeration, a mapping from the set of all certificates to certain objects in the new instance is required. While this approach comply more with the idea of classic kernelization, it seems to be more restrictive. The main difference of our compactor from the previous notions is that (the condenser of) a compactor is free of this requirement, which makes the definition more flexible and easier to work with. Due to this flexibility and succinctness, we believe that our notion might be amenable for lower bound machineries akin to those for decision problem kernelizations.
Parameterized counting problems on graphs.
A structure is a pair where is a graph and Given a MSOL-formula on structures and some graph class , we consider the following parameterized counting problem
Input: a graph , an non-negative integer Parameter: Count: the number of vertex sets such that and
Formally, is the pair , where is a function with and is the function with To see as a counting problem, we consider the relation where if , then encodes and encodes an such that and Clearly,
A tree decomposition of a graph is a pair , where is a tree and such that:
for every edge , there is a such that , and
for each and each contained in the unique path of connecting and , it holds that
We call the vertices of nodes of and the images of bags of The width of a tree decomposition is The treewidth of a , denoted by , is the minimum width over all tree decompositions of
We say that an instance of is a null instance if it has no solutions. Given a graph , we say that a vertex set is a -treewidth modulator of if the removal of from leaves a graph of treewidth at most . Given an MSOL-formula and a graph class , we say that is treewidth modulable if there is a constant (depending on and only) such that, for every non-null instance of , has a -treewidth modulator of size at most
Let be the class of all graphs that do not contain a subdivision of as a subgraph. The next theorem states our main result.
For every graph and every MSOL-formula , if is treewidth modulable, then there is a compactor for of size with condensing time and decoding time
As a corollary of the main theorem we have the following.
For every graph and every MSOL-formula , if is treewidth modulable, then can be solved in steps.
In the above results, the constants hidden in the -notation depend on the choice of , on the treewidth-modulability constant , and on the choice of
Recall that the above results are stated using the UCM model. As for , the number of solutions is and this number can be encoded in bits. Assuming that summations of two -bit numbers can be done in steps and multiplications of two -bit numbers can be done in steps, then the size of the compactor in Theorem 1 is the condensing and extracting times are and respectively. Consequently, the running time of the algorithm in Corollary 1 is
Coming back to the algorithmic meta-theorems on parameterized counting problems we should remark that the problem condition of Corollary 1 is weaker than MSOL, as it additionally demands treewidth-modulability. However, the graph classes where this result applies have unbounded treewidth or rankwidth. That way our results can be seen as orthogonal to those of .
1.3 Outline of the compactor algorithms
Our approach follows the idea of applying data-reduction based on protrusion decomposability. This idea was initiated in  for the automated derivation of polynomial kernels on decision problems. The key-concept in  is the notion of a protrusion, a set of vertices with small neighborhood to the rest of the graph and inducing a graph of small treewidth. Also,  introduced the notion of a protrusion decomposition, which is a partition of to graphs such the first one is a “center”, of size , and the rest are protrusions whose neighborhoods are in the center.
The meta-algorithmic machinery of  is based on the following combinatorial fact: for the problems in question, YES-instances – in our case non-null instances– admit a protrusion decomposition that, when the input has size , one of its protrusions is “big enough”. This permits the application of some “graph surgery” that consists in replacing a big protrusion with a smaller one and, that way, creates an equivalent instance of the problem (the replacements are based on the MSOL-expressibiliy of the problem). In the case of counting problems, this protrusion replacement machinery does not work (at least straightforwardly) as we have to keep track, not only of the way some part of a solution “invades” a protrusion, but also of the number of all those partial solutions. Instead, we take another way that avoids stepwise protrusion replacement. In our approach, the condenser of the compactor first constructs an approximate protrusion decomposition, then, it computes how many possible partial solutions of all possible sizes may exist in each one of the protrusions. This computation is done by dynamic programming (see Section 4) and produces a total set of arithmetic values. These values, along with the combinatorial information of the center of the protrusion decomposition and the neighborhoods of the protrusions in the center, constitutes the output of the condenser. This structure can be stored in space (given that arithmetic values can be stored in constant space) and contains enough information to obtain the number of all the solutions of the initial instance in steps (Section 4).
We stress that the above machinery demands the polynomial-time construction of a constant-factor approximation of a protrusion-decomposition. To our knowledge, this remains an open problem in general. So far, no such algorithm has been proposed, even for particular graph classes, mostly because meta-kernelization machinery in  (and later in [28, 25, 38, 27]) is based on stepwise protrusion replacement and does not actually need to construct such a decomposition. Based on the result in , we show that that the construction of such an approximate protrusion decomposition is possible on -topological-minor-free graphs, given that it is possible to construct an approximate -treewidth modulator of In fact, this can been done in general graphs using the randomized constant-factor approximation algorithm in . Responding to the need for a deterministic approximation we provide a constant-factor approximation algorithm that finds a -treewidth modulator on -topological-minor free graphs (Section 3). This algorithm runs in steps and, besides from being a necessary step of the condenser of our compactor, is of independent algorithmic interest.
We use to denote the set of all non-negative integers. Let and We say that if there exists a function such that Given , we define by Also, given some we define Given a set and a , we denote
2.1 Graphs and boundary graphs
All graphs in this paper are simple and undirected. Given a graph , we use to denote the set of its vertices. Given a we denote by the set of all neighbours of in that are not in We also set and we use and as shortcuts of and (when the index is a graph denoted by ). We define as the graph obtained from if we remove the vertices in , along with the edges incident to them. The subgraph of induced by is the graph Finally, we set We call the size of a graph and is reserved to denote the size of the input graph for time complexity analysis.
Given a graph , a subdivision of is any graph that is obtained from after replacing its edges by paths with the same endpoints. We say that a graph is a topological minor of if contains as a subgraph some subdivision of We also say that is -topological-minor-free if it excludes as a topological minor.
A labeling of a graph is any injective function Given a structure we call the annotated set of and the vertices in annotated vertices of
A boundaried structure, in short a b-structure, is a triple where is a graph and We say that is the boundary of and is the annotated set of Also we call the vertices of boundary vertices and the vertices in annotated vertices. We use notation to denote all b-structures whose boundary has at most vertices. We set , , , We refer to as the underlying graph of and we always assume that the underlying graph of a b-structure is accompanied with some labelling Under the presence of such a labelling, we define the index of a boundary vertex as the quantity i.e., the index of when we arrange the vertices of according to in increasing order. We extend the notion of index to subsets of in the natural way, i.e., the index of consists of the indices of all the vertices in
A boundaried graph, in short b-graph, is any b-structure such that For simplicity we use the notation to denote b-graphs instead of using the heavier notation For every , we use to denote the b-graphs in We avoid denoting a boundary graph as an annotated graph as we want to stress the role of as a boundary.
We say that two b-structures and are compatible, denoted by , if and have the same index and the labeled graphs and , where each vertex of is labeled by its index, are identical.
Given two compatible b-structures and , we define as the structure where
the graph is obtained by taking the disjoint union of and and then identifying boundary vertices of and of the same index, and
the vertex set is obtained from and after identifying equally-indexed vertices in and
Keep in mind that is an annotated graph and not a b-structure. We always assume that the labels of the boundary of prevail during the gluing operation, i.e., they are inherited to the identified vertices in while the labels of the boundary of dissapear in Especially, when and are compatible b-graphs, we treat as a graph for notational simplicity.
Treewith of b-structures.
Given a b-structure , we say that the triple is a tree decomposition of if is a tree decomposition of , , and We see as a tree rooted on The width of a tree decomposition is the width of the tree decomposition The treewidth of a b-structure is the minimum width over all its tree decompositions and is denoted by We use (resp. ) to denote all b-structures (resp. b-graphs) in (resp. ) with treewidth at most
Let be a graph. Given , an -protrusion decomposition of is a sequence of of b-graphs where, given that , it holds that
|3. is a subgraph of||4.|
We cal the set center of the above -protrusion decomposition.
Protrusion decompositions have been introduced in  in the context of kernelization algorithms (see also [28, 25]). The above definition is a modification of the original one in , adapted for the needs of our proofs. The only essential modification is the parameter , used in the last requirement. Intuitively, bounds the “internal” treewidth of each protrusion
2.2 MSOL and equivalence on boundaried structures.
(Counting) Monadic Second Order Logic.
The syntax of Counting Monadic Second Order Logic (CMSO) on graphs includes the logical connectives variables for vertices, edges, sets of vertices, and sets of edges, the quantifiers that can be applied to these variables and the following predicates:
where is a vertex variable and is a vertex set variable;
where is an edge variable and is an edge set variable;
where is an edge variable, is a vertex variable, and the interpretation is that the edge is incident with the vertex ;
where and are vertex variables and the interpretation is that and are adjacent;
equality (“=”) of variables representing vertices, edges, sets of vertices, and sets of edges.
the atomic sentence that is true if and only if
If we restrict the formulas so that variables are only vertex variables, we obtain the set of FOL-formulas.
Equivalences between b-structures and b-graphs.
Let be a MSOL-formula and Given two b-structures , we say that if
Notice that is an equivalence relation on The following result is widely known as Courcelle’s theorem and was proven . The same result was essentially proven in  and . The version on structures that we present below appeared in [5, Lemma 3.2.].
There exists a computable function such that for every CMSO-formula and every , the equivalence relation has at most equivalence classes.
Given a MSOL-formula and under the light of Proposition 1, we consider a (finite) set containing one minimum-size member from each of the equivalence classes of Keep in mind that Notice that for every , there is a b-structure in , we denote it by , such that
3 Approximating protrusion decompositions
The main result of this section is a constant-factor approximation algorithm computing a -treewidth modulator (Lemma 3). Based on this we also derive a constant-factor approximation algorithm for a protrusion decomposition (Theorem 2). For our proofs we need the following lemma that is a consequence of the results in .
For every -vertex graph and every , there exists a constant and an algorithm that takes as input an -topological-minor-free graph and a -treewidth modulator and outputs a -protrusion decomposition along with tree decompositions of its b-graphs of width at most , in steps.
We may assume that and is an topological-minor-free graph. It is known that for any , there is a such that every -topological-minor-free graph on vertices has at most cliques of any non-negative size (including 0 or 1 (see e.g. [40, 26, 45, 44]). We first prove the following claim:
Claim 1: If and is a collection of pairwise vertex-disjoint connected subsets of such that , then
Proof of claim: Let Consider the following procedure iterating over : for each , we choose two vertices which are non-adjacent in and add the edge in Let be the resulting graph. For each , observe that is a topological minor of , therefore itself is -topological-minor-free. Since an -topological-minor-free graph does not contain as a subgraph a clique on vertices and , not every vertex pair in is adjacent in This means that the procedure will be carried out up to the -th iteration. We conclude that has at least edges, therefore also at least cliques. As is -topological-minor-free, we derive the claim.
In [38, Algorithm 1], an -time algorithm , is presented which takes as input a graph , a -treewidth modulator , and a positive integer , and outputs some and a collection of pairwise vertex-disjoint connected subsets of such that
for every , , and
for every connected component of , and
The set and the collection is produced by [38, Algorithm 1]. In particular the sets in are the sets denoted by “”, while condition (i) is justified by the course of that algorithm. Condition (iii) is proved in [38, Lemma 7]. Apply the algorithm for in time and observe that, from Claim 1, , therefore
Let be the partition of the connected components of into maximal collections of connected components of that have the same neighborhood in We set and we call clusters of Clearly, the clusters of can be found in linear time.
Claim 2. the number of clusters of is at most
Proof of Claim. Let be a maximum set of indices such that there exist pairwise-distinct vertex pairs for satisfying and Among all such sets of indices, we select so as to minimize , and fix a pair for each Consider the graph and keep in mind that is a topological minor of , thus it is -topological-minor-free.
By maximality of , each for is a clique in (whose size is some non-negative number). Moreover, it holds that for all Indeed, if , then the maximality of implies that an edge between the vertex pair has been added to for some Because and are distinct clusters, it follows that However, provides the same graph , while the sum of neighborhood sizes over the index set strictly decreases, a contradiction.
Now, set for every , and for every By the previous argument, it is easy to see that is an injective mapping from to vertex sets of cliques in As is -topological-minor-free, and the claim holds.
Lastly, we set and argue that is a -protrusion decomposition, where Consider a tree decomposition of of width at most , which exists since each connected component of is a subgraph of (because ) and is a -treewidth modulator. Each can be computed in steps, using the algorithm in . By adding a root node to an arbitrary node of with and letting for every node , we can obtain a tree decomposition of the b-graph Observe that the width of is at most , by the third condition in the output of Now, it is straightforward to verify that
The last item holds because for each , is a subgraph of and is a -modulator of ∎
As a consequence of Lemma 2, as long as the input graph has many vertices (linear in ), there is a vertex set whose (internal) treewidth is at most and contains sufficiently many vertices. The key step of the approximation algorithm, to be shown in the next lemma, is to replace with a smaller graph of the same ‘type’. Two conditions are to be met during the replacement: first, the minimum-size of a -treewidth modulator remains the same. Secondly, a -treewidth modulator of the new graph can be ‘lifted’ to a -treewidth modulator of the graph before the replacement without increasing the size.
For every -vertex graph and every , there is a constant , depending on and , and an algorithm that, given a graph and , either outputs an -treewidth-modulator of of size at most or reports that no -treewidth modulator of exists with size at most This algorithm runs in steps.
Let be the constant from Lemma 2; for any -treewidth modulator of , there is -protrusion decomposition. We set , and the constant shall be fixed later. We first observe that there is an MSOL-formula such that given a structure , is a -treewidth modulator iff To see this, take into account that for every , there exits a set of graphs such that is a -treewidth modulator of iff does not contain any subdivision of a graph in As topological minor containment can be expressed in CMSOL, one can use the this observation to construct , as required.
The next claim states that whenever has sufficiently many vertices, either it contains a boundaried graph on a vertex set (which we shall replace by a boundaried graph of the same ‘type’ with strictly smaller size) or it does not have a -treewidth modulator of size at most
If has a -treewidth modulator of size at most and , then contains a vertex subset such that , and
Proof of claim: By the assumption and the choice of , we know that has a -protrusion decomposition As , there will be an such that We set and Notice that satisfies and From Lemma contains a subset where and The same proof implies that This, together with the fact that , imply that ∎
Now we want to fix the constant Let Consider a subset which consists of b-graphs of treewidth at most satisfying Clearly, for a vertex set of a graph satisfying the conditions of Claim 1, the b-graph is a member of For and an integer , we define
and write We say that and are -type-equivalent for if Intuitively, that two b-graphs and have the same -type for means that for any (partial) -treewidth modulator of , has a (partial) -treewidth modulator of the same size and achieving an identical ‘state’ on the boundary, and vice versa. Notice that when and are -type-equivalent for some , they have the same boundary size.
Let be -type-equivalent. Let be an arbitrary b-graph with Then for every , has a -treewidth modulator of size at most if and only if does.
Proof of claim: We remind that and are compatible because of , and thus is well-defined. Let for and let Suppose that is a -treewidth modulator of of size at most Furthermore, we can assume that Indeed, if this is not the case then, because , we could replace by that is also a -treewidth modulator of and
We set , , and note that As , we also have that This implies that there is an such that From this equivalence, we derive that or, equivalently, Finally observe that The opposite direction can be proved in the same way (we only exchange the roles of and ).∎
Since is a subset of the representatives and for some function by Proposition 1, there are at most distinct -types for Since -type-equivalence is an equivalence relation on , we can partition the set of b-graphs into -many equivalence classes under -type-equivalence. Let be the set containing a minimum-size b-graph of each equivalence class of We set the constant
Consider a routine B on which outputs a vertex subset such that , and , or reports that no such exists. Notice that there exist a FOL-formula such that if and only if a desired vertex subset exists. As proved in , model-checking for FOL-formulas can be done in linear time for classes of graphs with bounded expansion (which include -topological-minor-free graphs). Moreover, according to , in the same graph classes, answers to first-order queries can be enumerated with constant delay after a linear time preprocessing. Therefore, there exists a routine B that, given a graph , either correctly reports that does not contain a set as above or outputs one in -steps.
We present the approximation algorithm. Starting from and iterating over , we run the routine B as long as If the routine reports that no such set exists, then the algorithm reports that contains no -treewidth modulator of size at most exists and terminates. Otherwise, we set where , and is the member of which is -type-equivalent with Clearly, each iteration can be performed in steps, which is the runtime of the routine B. At each iteration , we have and thus the algorithm terminates in at most iterations. Therefore, in steps, we either report that has no -treewidth modulator of size , or produce a sequence of graphs with
Let us see the correctness of the algorithm. If the answer of B is negative at iteration , the condition and Claim 1 implies that does not contain any -treewidth modulator of size at most Since the minimum-size of a -treewidth modulator remains the same for and by Claim 2, does not contain any -treewidth modulator of size
Suppose the algorithm produces a sequence Notice that is a -treewidth modulator for having at most vertices. By ‘lifting’ this solution iteratively, we can produce a sequence of -treewidth modulator for the graphs , each of size at most Formally, given a -treewidth modulator of obtained by replacing by its representative in , a -treewidth modulator of