• Aucun résultat trouvé

Applications and Variants

Fast subset convolution is a powerful tool for the design of fast exponential time algorithms. Nevertheless it is important to mention that algorithmic applications often require extensions or modifications of the standard approach presented here.

This may require the use of auxiliary functions which facilitate convolution, and it may also require changes in the dynamic programming algorithms for the standard fast subset convolution. In the following sections we present examples illustrating the use of fast subset convolution.

In Chap. 4, inclusion-exclusion algorithms for generic covering and partition problems counting the number ofk-coverings andk-partitions have been presented.

This allowed the design and analysis of anO(2n)time algorithm to compute the chromatic number of a graph.

All these results can also be achieved by an application of fast subset convolution.

Let U be a set of n elements and letS be a family of subsets ofU. Recall that pairwise disjoint setsS1,S2, . . . ,Skform ak-partition ofUintoSifSi∈ S, 1≤i≤k andS1∪S2∪ · · · ∪Sk=U. We always assume here that for everyS⊆ U, there is a polynomial time algorithm checking whetherS∈ S.

In Sect.3.4a simple dynamic programming algorithm counting the numbers of k-partitions in timeO(3n)is presented. Let us show how to use subset convolution to speed up this algorithm.

Theorem 7.9.LetU be a set of n elements and letSbe a family of subsets ofU. For any k≥1, the number of k-partitions ofUintoSis computable in timeO(2n).

Proof. Let f : 2U→ {0,1}be an indicator function, i.e. for anyS⊆ U, f(S) =1 if and only ifS∈ S. Then the number ofk-partitions is

Y1,Y2,...,Yk⊆U

k i=1Yi=U YiY j=/0 ifi6=j

k

i=1

f(Yi).

Let f∗k: 2U→Zbe a function defined as follows f∗k=f∗f∗ · · · ∗f

| {z }

ktimes

.

By (7.2), for allS⊆ U

f∗k(S) =

Y1,Y2,...,Yk⊆S

k i=1Yi=S YiY j=/0 ifi6=j

k

i=1

f(Yi).

In particular, the number ofk-partitions ofUis equal to f∗k(U). To computef∗k(U), for everyS⊆ Uwe compute f∗2(S),f∗3(S), . . . ,f∗k(S)ink−1 subset convolutions.

7.3 Applications and Variants 133 Each of the steps uses fast subset convolution and is performed in timeO(2n). The number of steps can be reduced toO(logk)by using the doubling trick—computing

convolutions of f∗2i(S). ut

Theorem7.9is very general and many problems are special cases of it.

Of course, Theorem7.9yields aO(2n)algorithm counting proper colorings of ann-vertex graphG, and even more generally, computing its chromatic polynomial.

(We put f(S) =1 if and only ifS is an independent set.) We can also use it for natural extensions of the partitioning problem. For example, to count maximal k-colorable induced subgraphs of a graphGwith vertex setV. Indeed, forS⊆V,G[S]

isk-colorable if and only if f∗k(S)>0.

Domatic Number. A graphGhask-domatic partition X1,X2, . . . ,Xk if everyXi is a dominating set ofG. Theorem7.9can be used to count the number ofk-domatic partitions in timeO(2n)by putting f(S) =1 if and only ifSis a dominating set.

Interesting applications of subset convolution can be achieved by replacing the indicator function in the proof of Theorem7.9by some other functions.

Counting Spanning Forests.Aspanning forestof a graphGis an acyclic graphF spanning all vertices of G. In particular, if F is connected, then it is aspanning tree. The number of spanning trees in a graph is computable in polynomial time as the determinant of a maximal principal submatrix of the Laplacian ofG, a classical result known as Kirchhoff’s Matrix Tree Theorem. However, counting spanning forests is a #P-complete problem. For a setS⊆V, letτ(S)be the number of trees in the subgraph ofGinduced byS. Thus for everyS,τ(S)is computable in polynomial time. The crucial observation here is that the number of spanning forests in Gis equal to

Therefore, to find the number of forests inGwith exactlykconnected components, one has to computeτ∗kand this can be done inO(2n).

Even more generally, in timeO(2n)one can compute the number of spanning subgraphs ofGwithkcomponents and`edges. For graphG= (V,E), letsk,`(G) be the number of spanning subgraphs of G withk components and ` edges. To evaluate sk,`(G[X])for every X ⊆V, one can use a two-part recurrence one rank i∈ {0,1, . . . ,n}for|X|=iat a time. Omitting the base cases, fork≥2 we have

Tutte Polynomial.The computation of the Tutte polynomial can be seen as a gener-alization of graph coloring and counting spanning forests. TheTutte polynomialof a graphG= (V,E)is the bivariate polynomial

T(G;x,y) =

A⊆E

(x−1)r(E)−r(A)(y−1)|A|−r(A),

wherer(A) =|V| −k(A)andk(A)is the number of connected components of the graph induced inGby the edges ofA.

Many graph parameters are points or regions of the so-called Tutte plane. For example,

• T(G,2,1)is the number of spanning forests inG;

• T(G,1,1)is the number of spanning trees inG;

• T(G,1,2)is the number of connected subgraphs inG;

• T(G,2,0)is the number of acyclic orientations ofG;

• The chromatic polynomialP(G,λ)ofGis expressible as P(G,λ) = (−1)r(E)λk(E)T(G; 1−λ,0).

The computations of numberssk,`(G), the number of spanning subgraphs withk components and`edges, is important to compute the Tutte polynomial. The crucial fact (which we do not prove here) is that the Tutte polynomial can be expressed in the following form

TG(x,y) =

k,`

sk,`(G)(x−1)k−c(y−1)`+k−n,

whereGhasccomponents andnvertices. The following theorem is due to Bj¨orklund, Husfeldt, Kaski, and Koivisto [27].

Theorem 7.10.The Tutte polynomial of an n-vertex graph G can be computed in timeO(2n).

In the remaining part of this section we present some variants that are relaxations of the subset convolution of form (7.2).

Let us recall thatU={1,2, . . . ,n}is a set and f,g: 2U→Zare two functions.

Definition 7.11.Thecovering productof f andg, denoted by f∗cgis defined for allS⊆ Uas

(f∗cg)(S) =

X,Y⊆S X∪Y=S

f(X)·g(Y). (7.9)

Definition 7.12.Thepacking productof f andgis defined for allS⊆ U as (f∗pg)(S) =

X,Y⊆S X∩Y=/0

f(X)·g(Y). (7.10)

7.3 Applications and Variants 135 Definition 7.13.Theintersecting covering productof f andg, denoted by f∗icg, is defined for allS⊆ Uas

Now let us consider algorithms to compute these products.

Theorem 7.14.Given functions f,g: 2U→Z, there is an algorithm to compute the covering product(f∗cg)(S)for all S⊆ U in timeO(n2n).

Proof. Givenf andg, the algorithm first computes the zeta transforms fζandgζin timeO(2n). Then taking the elementwise product of the transforms(fζ·gζ)(X) = fζ(X)·gζ(X), the M¨obius transform is applied to the result. Using fast zeta and M¨obius transforms, as presented in Sect.7.1, the algorithm needs timeO(2n).

To see that the algorithm indeed outputs (f∗cg)(S), note that the result of the described M¨obius transform is

Now each ordered pair(Y,Z)of subsets ofS, contributes(−1)|S\X|to the sum in (7.3) for allX withY,Z⊆X.Therefore the overall coefficient of f(Y)g(Z)is 1 if Y∪Z=S, otherwise the coefficient is 0. Consequently

X⊆S

Given the algorithms for fast subset convolution and fast covering product, it is not hard to establish fast algorithms to compute the packing product and the inter-secting covering product.

Theorem 7.15.Given functions f,g: 2U→Z, there are algorithms to compute the packing product(f∗pg)(S)and the intersecting covering product for all S⊆ Uin timeO(2n).

Proof. Let f1be the function assigning to each subset ofU the integer 1. Hence by (7.2), for allh: 2U→Zand allS⊆ U

(h∗f1)(S) =

Y⊆S

h(Y).

Consequently, given functions f andgthe algorithm computes ((f∗g)∗f1)(S) =

Y,Z⊆S Y∩Z=/0

f(Y)g(Z) = (f∗pg)(S).

Thus the packing product f ∗pg can be evaluated by first computing the subset convolution f∗gand by then computing the subset convolution of(f∗g)and f1. Using fast subset convolution the algorithm needs timeO(2n).

An algorithm to compute the intersecting covering product in timeO(2n) fol-lows immediately from the observation

f∗icg=f∗cg−f∗g.

u t