Counting Perfect Matchings as Fast as Ryser

We show that there is a polynomial space algorithm that counts the number of perfect matchings in an $n$-vertex graph in $O^*(2^{n/2})\subset O(1.415^n)$ time. ($O^*(f(n))$ suppresses functions polylogarithmic in $f(n)$).The previously fastest algori…

Authors: Andreas Bj"orklund

Coun ting P erfect Matc hings as F ast as Ryser ∗ Andreas Bj¨ orklund † Abstract W e show that there is a polynomia l space algo rithm that counts the num b er of perfect matchings in an n -vertex graph in O ∗ (2 n/ 2 ) ⊂ O (1 . 41 5 n ) time. ( O ∗ ( f ( n )) suppr esses functions po lylogar ithmic in f ( n )).The prev io usly fas tes t a lg orithms fo r the proble m was the exp onential space O ∗ (((1 + √ 5) / 2) n ) ⊂ O (1 . 6 1 9 n ) time algorithm by Koivisto, and for polynomia l spa ce, the O (1 . 942 n ) time algor ithm by Nederlof. Our new algo rithm’s runtime matches up to p olynomial factors that o f Ryser’s 1963 algorithm for bipartite graphs. W e present our algorithm in the more gener al setting o f computing the hafnian ov er an arbitrar y ring, analog o usly to Ryser’s algor ithm for per manent computatio n. W e also give a simple argument why the general exact set cov er coun ting problem o ver a slightly sup erp oly no mial sized family of subsets of an n element g round set cannot b e solved in O ∗ (2 (1 − ǫ 1 ) n ) time for any ǫ 1 > 0 unless there are O ∗ (2 (1 − ǫ 2 ) n ) time alg orithms for computing a n n × n 0 / 1 matrix p e rmanent, for some ǫ 2 > 0 dep ending only o n ǫ 1 . 1 In tro duc tion The p erm anen t of a matrix A = ( A i,j ) ∈ R n × n o v er a ring R is defined as p er(A) = X σ ∈ S n n Y i =1 A i,σ ( i ) Here S n is the set of all p ermutations on n elemen ts. Ryser [14] ga v e an algorithm for computing the p ermanen t in O ( n 2 n ) op erations ov er R , and it r emains to this date the fastest kno wn f or general matrices. O nly in sp ecial cases as e.g. when the input matrix is sparse significan tly faster algorithms are kn own. In this pap er we sh o w that a previously studied, seemingly harder, problem admits jus t as fast an algorithm up to p olynomial factors. It includes the p ermanen t computation as a sp ecial case: T he h afnian of a matrix B = ( B i,j ) ∈ R 2 n × 2 n o v er a rin g R is commonly defi ned as haf( B ) = X σ ∈ C 2 n n Y i =1 B σ (2 i − 1) ,σ (2 i ) Here C 2 n is the set of canonical p erm utations on 2 n elemen ts, p erm utations σ ob eying I. ∀ i : σ (2 i − 1) < σ (2 i ) and I I. ∀ i : σ (2 i − 1) < σ (2 i + 1). Ob serv e that hafnians only d ep end on matrix elements strictly ab o v e the main diagonal. F or con ven tional r easons thou gh , a hafnian ∗ This w ork was supp orted by the Swedish Research Council grant “Exact Algorithms” VR 2007-6595. † Dept. of Comp. S ci., Lu nd Universit y . 1 is defin ed only for zero diagonal symmetric m atrices. A simple connection b et w een hafnians and p er m anen ts is giv en b y haf  0 A A T 0  = p er( A ) W e sho w that 2 n × 2 n hafnians can b e computed as fast as Ryser’s algorithm computes n × n p ermanents. Theorem 1 F or B ∈ R 2 n × 2 n a symmetric zer o diagonal matrix with elements fr om a ring R , haf ( B ) c an b e c ompute d i n O ∗ (2 n ) ring op er ations, storing only a p olyno mial in n numb er of ring elements at any instanc e of the c omputation. Computing the p ermanent of an n × n 0 / 1 matrix has an equiv alen t form u lation in terms of counting p erfect matc hings in an asso ciated bipartite graph on 2 n v ertices. Just identify ro ws with one half of the v ertices and the columns w ith the other. There is an edge b etw een ro w vertex r and column vertex c if the matrix en try at r, c is 1. Analogously , computing the hafnian of a 2 n × 2 n 0 / 1 matrix has an equiv alent formulati on in terms of count ing p erfect matc hings in an asso ciated gener al graph on 2 n vertice s. Th ink of the matrix as an adjacency matrix for a graph. Thus with our new algorithm we can coun t p erfect matc hin gs in general graphs just as fast as Ryser’s algorithm counts them in bipartite ones. Corollary 2 Ther e is a p olyno mial sp ac e, O ∗ (2 n/ 2 ) time algorithm that c omputes the nu mb er of p erfe ct matchings in any n -vertex gr aph . In other words, either bipartiteness do esn ’t h elp m uc h for p erfect matc hing counti n g, or Ryser’s algorithm is far from optimal. Th is sh ou ld be con trasted with the p roblems’ kn own appro ximabilit y situation: There are p olynomial time appro ximation sc hemes for coun ting p erfect matc hin gs in bip artite grap h s [8], b ut the fastest approximat ion sc hemes for general ones still ru n in time singly exp onential in the n u mb er of v ertices [15]. W e note th at the tec hn ique used in our algorithm makes profound us e of the fact that it coun ts co v ers of 2-sets. One would hop e th at the technique could b ear fr uit ev en for larger set families. Unfortunately it seems lik e it d o esn’t. W e giv e here some evidence to why this ma y b e. I n a general exact set co ve r count ing problem, w e are giv en a family F of s ubsets of arbitrary size of a ground set U on n elemen ts. Th e ob jectiv e is to count the num b er of wa ys to pic k pairwise disjoin t subsets from F w hose union co v er all of U . T his is kn o wn to admit an O ∗ (2 n ) time algorithm [4] (and a trivial O ∗ ( |F | 2 n ) time algorithm by d ynamic p rogramming across all vertex subsets). W e pr o v e here that if the fastest known p ermanen t computation algorithms for 0 / 1 matrices are close to optimal, then w e cannot hop e to improv e on general exact set co ve r counting. Theorem 3 F or ev ery c onstant ǫ 1 > 0 , any algorithm c ap able of c ounting the solutions to any exact set c over instanc e F , U, | U | = n , |F | ∈ n O (log n ) in O ∗ (2 (1 − ǫ 1 ) n ) time, implies the existenc e of an algorithm that c omputes the p ermanent of any n × n 0 / 1 matrix in O ∗ (2 (1 − ǫ 2 ) n ) time, for some ǫ 2 > 0 dep ending only on ǫ 1 . 1.1 Previous W ork Computing the Permanen t. Ryser [14 ] p resen ted an inclusion–exclusion based algo rith m to ev aluate the p ermanen t of an n × n matrix o v er an y ring in O ( n 2 n ) ring op erations. V alian t [17] sho w ed that computing 2 the p er m anen t ev en restricted to elemen ts of non-negativ e in tegers is #P-hard. Dell et al. [6] concluded in the same spirit that one cannot compu te n × n in teger p ermanen ts in 2 o ( n ) time unless y ou can count the satisfiying assignments to 3CNF Bo olean n -v ariat e form ulas faster than Ω( c n ) for ev ery c > 1 (I.e. a coun ting analogue of the E xp onentia l Time Hyp othesis [7]). There is ho w ever no known explanation as to why the exp onential base 2 should b e optimal. F or restricted cases, there are some s mall impro vemen ts. Bax and F ranklin [2] sho wed that for 0 / 1 matrices, th er e is an exp [ − ( n 1 / 3 / 2 ln ( n ))]2 n exp ected time algorithm. Building on their constr u ction, Serv edio and W an [16] ga v e an algorithm that computes the p ermanent of any matrix w ith at most cn nonzero en tries in O ∗ ((2 − ǫ ) n ) time, with ǫ d ep endin g on c . Coun ting P erfect Matc hings in General Graphs. Bj¨ orklund and Husfeldt [3] ga v e a p olynomial sp ace algorithm that coun ts the p erfect matc h- ings in an n -v ertex graph in O ( n 2 2 n ) time. They also presen ted an exp onentia l space O (1 . 733 n ) time algo rithm based on fast matrix m ultiplication. Koivisto [10] show ed an elegan t exp onenti al space O ∗ ( φ n ) time algorithm w here φ = (1 + √ 5) / 2 ≈ 1 . 61 8 is the golden ratio. A generalizat ion of Ryser’s formula to general graphs was giv en indep end en tly b y Nederlof[12], and Amin i et al. [1], who sh o w ed that if the graph has an ind ep enden t set of size i , one can coun t the p erfect matc hings in O ( n 3 2 n − i ) time. In a y et unpu blished pap er Nederlof [13] further improv es the p olynomial space ru nning time to O (1 . 942 n ). 1.2 Ov erview. The remainder of the pap er is organized as follo ws. In Section 2 w e try to explain the idea b ehind the algorithm. A formal pro of in the hafnian setting is giv en in S ection 3, where th e pro ofs of Theorem 1 and indirectly Corolla ry 2 are giv en. Finally , In Section 4 w e giv e the pro of of Theorem 3. 2 Our Algorithmic Idea W e will in the n ext section describ e our new algorithm in detail. First we will try to pro vide some intuition. The under lyin g idea of the algorithm is p erh aps b est envisio ned in th e p erf ect matc hing setting. Consider an undir ected u nw eigh ted graph and sup p ose yo u wa nt to count its p erfect matc hings. O ur algorithm op erates in stages. In eac h stage w e remo v e t w o v ertices from the graph and replace them w ith new “lab eled” edges b et wee n the remaining vertice s. The added labeled edges r epresent wa ys a partial matc hing can co v er the remo ved vertice s. In particular, the p artial matc h in g alw a ys co v er b oth of the remo v ed ve rtices and thus they can b e treated as just one lab el, we neve r consider a partial matc hing cov ering only one of th em. The effectiv e sp eedup is ac hieve d exactly b y this fact, that we alw a ys trade t wo v ertices for one n ew lab el. Confer Figure 1 for an exa mp le of three sub sequent inv o cations of this remo v e-and-replace op eration. As the op eration is rep eate d it resu lts in termediately in m ultilab eled edges. When the graph’s v ertices are exhausted, all that is left is a set of m ultilab eled “empty” edges. Their disjoin t lab el co v ering com binations describ e all p erfect matc hings of the original graph. This is an exact s et co ve r counti n g problem on h alf of the v ertices num b er of lab els. In Figure 1, all wa ys to com bine the partial matc hings listed und er “ ∅ :” in stage 3 suc h th at eac h of the three lab els 1 , 2 , 3 is used precisely once, rep r esen ts a p erfect matc hing in the original graph in stage 0. E.g. ef [1] , ad ∪ bc [23] is the p erfect matc hing 3 ef ∪ ad ∪ bc , and ce ∪ d f [12] , ab [3] is the p erfect matc hing ce ∪ d f ∪ ab . Moreo ver, ev ery p erfect matc hing in the original graph can b e written as an exact s et co v er from the list in this wa y . In the next section we will see how this id ea is formalized in the general hafnian s etting. b a c d e f Stage 0 ∅ : ef [1] . ce ∪ d f [1] af ∪ ce [1] b a c d Stage 1 ∅ : ef [1] , cd [2] , ce ∪ d f [12] . af ∪ ce ∪ b d [12] . ac ∪ bd [2] , ad ∪ bc [2 ] , b a Stage 2 ∅ : ef [1] , cd [2] , ce ∪ d f [12] , ab [3] , ad ∪ bc [23] , ac ∪ bd [23] , af ∪ ce ∪ b d [123] . Stage 3 Figure 1: V ertices are remo ved in p airs and are replaced by lab els, fi rst vertic es e, f for the lab el 1, then c, d for 2, and fin ally a, b for 3. Lab eled edges includ ing empty edges listed u nder “ ∅ :”, representi n g partial matc h in gs of the r emo v ed vertic es, are created. The lab els are written within brac k ets. In the final stage, the partial matc hings listed u nder “ ∅ :” constitute an exact set co v er problem for which th e solutions are pr ecisely the p erfect matc hings in the original graph. 3 An Algorithm for the Hafnian In this section we pro v e Theorem 1. W e describ e an algorithm to compu te haf( B ) of a m atrix B ∈ R 2 n × 2 n for an arbitrary ring R . First we suggest an implemen tation of our algorithm that uses exp on ential space since it is easier to reason ab out, but w e will see in Section 3.5 ho w the space usage can b e redu ced to only p olynomial in n . 3.1 Lab el Extensions of a Ring. W e will op erate o ve r extension rings of R . T hey are designed to k eep track of the m ultilab eled elemen ts men tioned in the previous sectio n. The reason will hop efully b ecome clear in Sec- tion 3.3 where we pro ve a syn tactically tight r ecursion form ula for the hafnian in term s of th e extension ring. W e call the exte n s ion rings R [ U m ] for m a non-negativ e in teger. On e can think of the structure U m as the set of subsets of [ m ], with a partial function ∪ disj : [ m ] × [ m ] → [ m ] defined as ∪ disj ( a, b ) = a ∪ b for d isj oin t a, b and un d efined otherw ise. An elemen t in R [ U m ] is nothing m ore than a v ector r ∈ R [ m ] , i.e. a v ector of 2 m elemen ts from R . F or an element r ∈ R [ U m ], w e write r X to denote the co ordin ate in r asso ciated w ith the sub set X . Syntactic ally , we write r = X X ⊆ [ m ] r X [ X ] 4 to describ e the rin g extension element r . Add ition of r , q ∈ R [ U m ] is giv en b y r + q = X X ⊆ [ m ] ( r X + q X )[ X ] Here the + within the parantheses refers to addition of elemen ts in R , i.e. the vec tors r and q are added element wise. Multiplicatio n is a bit more complicate d . It is defined in a con v olution lik e manner by r · q = X X ⊆ [ m ] ( X Y ⊆ X r Y q X − Y )[ X ] Again, op erations w ithin the p aran theses are o ver the r ing R . W e wr ite 1[ ∅ ] to emphasize the multiplic ativ e identit y . Note that R [ U i ] is a sub ring of R [ U i +1 ] for ev ery i , i.e. op erations o v er R [ U i ] are meaningful also in R [ U i +1 ]. W e will use this f act extensiv ely . 3.2 Algorithm. Supp ose w e wa nt to compute haf( B ) for B ∈ R 2 n × 2 n . Our algorithm op erates in stages. Initially , w e set B (0) = B . In eac h sub s equen t stage i , we w ill redu ce the hafn ian compu tation of a matrix B ( i − 1) to one for a matrix B ( i ) . W e call this op eration a sque eze , b ecause the latter matrix’s dimensions will b e smaller, but its elements b elong to a larger ring than its predecessor’s. F ormally , in stage i the hafnian of a matrix B ( i − 1) ∈ R [ U i − 1 ] (2 n − 2 i +2) × (2 n − 2 i +2) is related to the hafnian of a derived matrix B ( i ) ∈ R [ U i ] (2 n − 2 i ) × (2 n − 2 i ) . I n the fin al stage n , w e are left with a h afn ian of a zero-dimensional matrix wh ic h w e b y d efinition equate with one. W e also associate an element β ( i ) ∈ R [ U i ] with stage i called the sque eze factor of the stage. Our algorithm simply computes the pro d uct of these squeeze facto rs and in the end returns the element asso ciated with the lab el set [ n ], confer Algorithm 1. Algorithm 1 haf( B ), B ∈ R 2 n × 2 n B (0) ← B h ← 1[ ∅ ] for i = 1 , 2 , · · · n do Compute B ( i ) and β ( i ) (according to Section 3.2.1 ). h ← h · β ( i ) end for return h [ n ] 3.2.1 The Squeeze O p eration. In every stage w e will expu nge the t w o fi rst rows and columns from the present inpu t matrix and ins tead app end a new elemen t (a lab el) to the set of the ring extension. Consider stage i . On input B ( i − 1) ∈ R [ U i − 1 ] (2 n − 2 i +2) × (2 n − 2 i +2) w e define B ( i ) ∈ R [ U i ] (2 n − 2 i ) × (2 n − 2 i ) through B ( i ) j,k = ( B ( i − 1) j +2 ,k +2 + S i,j,k : j 6 = k 0 : j = k 5 where S i,j,k = 1[ { i } ] · ( B ( i − 1) 1 ,j +2 · B ( i − 1) 2 ,k +2 + B ( i − 1) 1 ,k +2 · B ( i − 1) 2 ,j +2 ) The squeeze factor of the stage is defi n ed b y β ( i ) = 1[ ∅ ] + 1[ { i } ] · B ( i − 1) 1 , 2 3.3 Correctness Analysis. The essence of our algorithm is captured in the follo wing lemma: Lemma 4 F or e very subset X ⊆ [ i − 1] (haf ( B ( i − 1) )) X = ( β ( i ) · h af ( B ( i ) )) { i }∪ X for al l i ≥ 1 . Pro of Recall that B ( i − 1) ∈ R [ U i − 1 ] m × m with m = 2 n − 2 i + 2. By definition of the hafnian haf( B ( i − 1) ) = X σ ∈ C m m/ 2 Y j =1 B ( i − 1) σ (2 j − 1) ,σ (2 j ) (1) First consider the case i = n separately . The ab ov e formula yields haf( B ( n − 1) ) = B ( n − 1) 1 , 2 . W e can write this as (haf( B ( n − 1) )) ∅ = ((1[ ∅ ] + 1[ { n } ] · B ( n − 1) 1 , 2 ) · h af( B ( n ) )) { 1 } since haf( B ( n ) ) = 1 by defi n ition. Id entifying the righ t hand side paran theses expression as β ( n ) , it follo ws that the lemma is true for i = n . Next consider the case i < n . First observe that for every σ ∈ C m , w e alwa ys ha v e σ (1) = 1 and either σ (2) = 2 or σ (3) = 2. W e separate these tw o cases in Eq 1 : haf( B ( i − 1) ) = B ( i − 1) 1 , 2 · X σ ∈ C m σ (2)=2 m/ 2 Y j =2 B ( i − 1) σ (2 j − 1) ,σ (2 j ) | {z } T 1 + X σ ∈ C m σ (3)=2 B ( i − 1) 1 ,σ (2) B ( i − 1) 2 ,σ (4) m/ 2 Y j =3 B ( i − 1) σ (2 j − 1) ,σ (2 j ) | {z } T 2 Second w e note that the firs t term T 1 of the righ t h and side ab ov e for ev ery X ⊆ [ i − 1] T 1 X =   1[ { i } ] · B ( i − 1) 1 , 2 · X σ ∈ C m − 2 m/ 2 − 1 Y j =1 B ( i ) σ (2 j − 1) ,σ (2 j )   { i }∪ X Third we see that the second term T 2 of the righ t hand side for ev ery X ⊆ [ i − 1] T 2 X =   X σ ∈ C m − 2 m/ 2 − 1 Y j =1 B ( i ) σ (2 j − 1) ,σ (2 j )   { i }∪ X 6 Putting the t wo together we get  haf( B ( i − 1) )  X =   (1[ ∅ ] + 1[ { i } ] · B ( i − 1) 1 , 2 ) · X σ ∈ C m − 2 m/ 2 − 1 Y j =1 B ( i ) σ (2 j − 1) ,σ (2 j )   { i }∪ X By the definition of the hafnian and the stretc h factor, th e Lemma follo ws. Note that h af( B ) = (haf( B (0) )) ∅ . Recursive application of Lemma 4 up to haf( B ( n ) ) = 1 (since B ( n ) is zero-dimensional), sho ws th at h af( B ) = ( Q n i =1 β ( i ) ) [ n ] , whic h is what Algorithm 1 computes. 3.4 Run time Analysis. It is str aightforw ard to note that adding t wo element s in R [ U m ] can b e done in 2 m additions o v er R . Multiplication of t w o elemen ts a, b ∈ R [ U m ] can b e compu ted in m 2 2 m additions and m ultiplications o v er R usin g fast subset con vo lution [5]. W e describ e its comp on ents here anew for completeness. First, w e introd uce a p olynomial o v er R in a symb olic rank v ariable r , and compute the rank ed zeta transforms ˆ a X ( r ) = X Y ⊆ X a Y r [ Y ] , ˆ b X ( r ) = X Y ⊆ X b Y r [ Y ] Second, w e compute the elemen t wise p ro du cts ˆ c X ( r ) = ˆ a X ( r ) ˆ b X ( r ) Third, w e tak e the ranke d M¨ obius inv ersion. Here [ r m ] p ( r ) for a p olynomial p ( r ) refers to the co efficien t of the monomial r m in p ( r ): d X = [ r | X | ] X Y ⊆ X ( − 1) m −| Y | ˆ c X ( r ) This d is the p ro du ct. The p ro of is imp licit in L emm a 5 in the next section, where we show ho w to mak e the whole algorithm u se only p olynomial space. F or no w, sin ce b oth the zeta transform and the M¨ obius inv ersion can b e computed in O ( m 2 m ) ring op er ations by Y ates’s algorithm [18], the r unt ime b ound for m u ltiplication follo ws. No w confer Algorithm 1. In stage i , we compu te B ( i ) using at most O ((2 n − 2 i ) 2 ) multi- plications an d additions of R [ U i ] elements. T he tota l runt ime in terms of r ing op erations o ver R of computing all the B i ’s is P n i =1 O ((2 n − 2 i ) 2 ) O ( i 2 2 i ) ⊂ O ∗ (2 n ). Moreo v er, multi p lyin g all the squ eeze factors toge ther is P n i =1 O ( i 2 2 i ) ⊂ O ∗ (2 n ) ring op erations on R . Altogether, an O ∗ (2 n ) ring op er ations algorithm as claimed. 3.5 P olynomial Space. Explicitly holding a rin g elemen t of R [ U m ] requires storing u p to 2 m elemen ts of R . W e describ e in this section how the algorithm can b e implemen ted to on ly hold a p olynomial in n n um b er of elemen ts of R at an y instan t in time. The idea goes bac k at least to Karp [9] who sho wed ho w some dynamic programming recur r ences across subs ets could b e replaced 7 b y an inclusion–exclusion formula. Th e tec hnique w as recen tly formalized by Lokshta nov and Nederlof [11]. W e describ e it h er e for our algorithm in p articular for completeness. First w e n ote that Algo rithm 1 can b e view ed as an ev aluation of an arithmetic circuit o v er R [ U n ]. W e nev er do anyt hin g else inte rmed iately with an element of R [ U m ] anywhere in the algorithm except f or addition or m u ltiplication with another elemen t. Only at the very end we ask for the elemen t of h corresp ond ing to [ n ]. One w a y of lo oking at the tec hniqu e, is to consid er the rank ed zeta tr ansforms of the previously section, and count in the transformed domain ”all-the-w a y”. W e d on’t trans f orm bac k and f orth every time w e need to m ultiply t wo ring elemen ts of R [ U n ], instead we sta y in the ranke d zeta transf ormed represent ation du ring the w hole algorithm. In the end we transform bac k via an inclusion–exclusion formula, since we are only intereste d in th e elemen t for [ n ]. Let us again recall the rank ed zeta trans form. F or e ∈ R [ U n ] asso ciate for eve ry subset X ⊆ [ n ] a p olynomial in a symb olic rank v ariable r ˆ e X ( r ) = X Y ⊆ X e Y r [ Y ] The b eaut y of this relation is that b oth additions and m ultiplications o v er R [ U n ] n o w can b e treated as elemen t wise op erations. This is well known, see for instance [5]. Th e case of addition is straigh tforward from the definition, i.e. sin ce ( e + f ) X = e X + f X w e hav e [ e + f X = ˆ e X + ˆ f X from linearit y . F or multiplicatio n we ha v e Lemma 5 ( [5]) F or any e 1 , e 2 , . . . , e k ∈ R [ U n ] ( e 1 · e 2 · · · e k ) [ n ] = [ r n ] X X ⊆ [ n ] ( − 1) n −| X | \ ( e 1 · e 2 · · · e k ) X ( r ) = [ r n ] X X ⊆ [ n ] ( − 1) n −| X | k Y i =1 ˆ e i X ( r ) Pro of W e recall f rom the definition of multiplicatio n for the first (left) expression th at ( e 1 · e 2 · · · e k ) [ n ] = X Y 1 ∪ Y 2 ∪···∪ Y k =[ n ] ∀ i 0 b e a fixed constan t less than one. F or large enough int egers k , n we can hav e n chosen as the largest int eger smaller than 2 ⌈ ( ǫ 1 k / 2 − 1) ⌉ for wh ic h k divides n . Note that for suc h v alues k ≥ ǫ − 1 1 (2 ⌈ log 2 n ⌉ + 2). Let M ∈ { 0 , 1 } n × n b e a matrix whose p ermanent w e w an t to compute. First note that th e p ermanen t of M is a p ositiv e integ er at most equal to n !. W e will us e the Chinese r emainder theorem to r eco v er the v alue of the p erm an ent.W e compute a i = p er( M )(mo d m i ) for n pairwise coprime mo du li m i < n 2 . The pr ime num b er theorem 9 asserts that w e can fin d suc h a set of mo du li for large enou gh n . Just tak e m i as the smallest p o wer larger than n of the i :th prime. W e show h o w to construct counti ng exact s et co v er instances I i = ( U, F i ) for eac h m i , whose solution equals a i (mo d m i ). W e s tart by d ividing the ro ws of M into m group s R 1 , R 2 , · · · , R m of the same size k . W e will add sets to F i for eac h such group so that in ev ery exact set co v er, exactl y one set fr om eac h group is pr esen t. T o this en d , w e asso ciate a set L i for eac h group R i , which will all b e p art of the ground set U . Each L i has size 2 ⌈ log 2 n ⌉ + 2 ≤ ǫ 1 k . W e let l 6 = r ∈ L i b e tw o of its elemen ts. Th e subsets of L i con taining ex- actly one of l or r , are divided in t w o families L i and R i as follo ws. Ev ery su bset T ⊆ L i − { r } suc h that l ∈ T b elongs to L i , and ev ery subset T ⊆ L i − { l } su c h that r ∈ T b elongs to R i . Note that for any t wo disjoint T 1 , T 2 ∈ L i ∪ R i suc h that T 1 ∪ T 2 = L i , one of them b elong to L i and the other to R i . Also note that L i has at least n 2 > m i mem b ers. The construction is as follo ws. W e set U = [ n ] ∪ L 1 ∪ · · · ∪ L k . Note that | U | ≤ n + ǫ 1 n . Let U k denote the family of all k -sized su bsets of [ n ]. F or ev ery subs et T ∈ U k and j we compu te w j ( T ) = X σ ∈ S k k Y l =1 M ( R j ( l ) , T ( σ ( l ))) (mo d m i ) Here and in the follo wing T ( l ) for a set T refers to the l th memb er of the set. W e let F i con tain the sets T ∪ L j (1) , T ∪ L j (2) , · · · , T ∪ L j ( w j ( T )) for every T ∈ U k and eve ry j . W e also add all sets in R j for all j to F i . Note th at |F i | ∈ O ( | U | log | U | ). This completes the construction. Lemma 6 The solution to I i mo dulo m i e quals a i . Pro of By defin ition p er( M ) = X σ ∈ S n n Y i =1 M i,σ ( i ) Iden tifying the m ro w groups the relation can b e rewritten p er( M ) = X T 1 ∪ T 2 ∪···∪ T m =[ n ] ∀ a : T a ∈U k m Y j =1 X σ ∈ S k k Y i =1 M ( R j ( i ) , T j ( σ ( i ))) Substituting w into the form ula we ha v e p er( M ) ≡ X T 1 ∪ T 2 ∪···∪ T m =[ n ] ∀ a : T a ∈U k m Y j =1 w j ( T j ) (mo d m i ) (2) F rom the other direction, note that ev ery exact set cov er F ′ ⊂ F i con tains exactly 2 m sets, one set from eac h R j , and for ev ery j there is a set which is the union of a set T fr om U k and one of the first w j ( T ) sets in L j . Let L j [ l ] b e shorthand for th e fi r st l sets in L j , i.e. the sets L j (1) , L j (2) , · · · , L j ( l ). W e hav e that the s olution to I i equals X V 1 ∪ W 1 ∪ V 2 ∪ W 2 ···∪ W 2 m = U ∀ j : V j ∩ L j ∈L j [ w j ( V j ∩ [ n ])] ∀ j : V j ∩ [ n ] ∈U k ∀ j : W j ∈R j 1 10 Since the W j ’s are uniqu ely determined by the V j ’s, it can b e r ewritten as X V 1 ∪ V 2 ∪···∪ V m = U ∀ j : V j ∩ L j ∈L j [ w j ( V j ∩ [ n ])] ∀ j : V j ∩ [ n ] ∈U k 1 ≡ X T 1 ∪···∪ T m =[ n ] ∀ a : T a ∈U k m Y j =1 w j ( T j ) (mo d m i ) This is the s ame expr ession as the r ight hand side of Eq. 2. W e set ǫ 2 = ǫ 2 1 . It tak es O ( m  n k  k !) time to construct eac h I i na ¨ ıv ely from M . F or our c hoice of k , this is (muc h) less than O ∗ (2 (1 − ǫ 2 ) n ) for large enough n . Now if w e h ad an O ∗ (2 (1 − ǫ 1 ) n ′ ) time alg orithm to solv e an exact set co v er counting problem on an n ′ elemen t ground set, we could solv e I i for all i = 1 , 2 , · · · , n and h ence compute p er( M ) from the a i ’s using the Chinese r emainder theorem in O ∗ (2 (1 − ǫ 2 1 ) n ) = O ∗ (2 (1 − ǫ 2 ) n ) time, since n ′ = | U | = (1 + ǫ 1 ) n . This completes the p ro of of Theorem 3. Ac kno wledgmen ts The author is grateful to sev eral anonymous referees for v aluable comment s. References [1] O. Amini, F. V. F omin, and S. Saurabh. C oun ting Subgraph s via Homomorphisms. In pro ceedings of the 36th ICALP , pp. 71–82, 2009. [2] E. Ba x and J. F ranklin . A P ermanent Algorithm with exp [( n 1 / 3 / 2 ln ( n ))] Exp ecte d Sp eedu p for 0-1 Matrices. Algorithmica, V olume 32, Num b er 1, 157–162, 2002. [3] A. Bj¨ orklund an d T. Husfeldt. Exact algorithms f or Exact Satisfiabilit y and Number of P erfect Matc hings. Algorithmica 52, pp. 226–249 , 2008 . [4] A. Bj¨ orklu nd, T. Husfeldt, and M. Koivisto. Set partitioning via inclusion–exclusion. SIAM Journal on Compu ting, V olume 39, Issue 2, p p. 546– 563, 2009. [5] A. Bj¨ orklund, T. Husfeldt, P . Kaski, and M. Koivisto. F ourier meets M¨ obius: F ast Sub- set Conv olution. In pro ceedings of the 39th A CM sym p osium on th eory of computing (STOC), pp. 67–74, 2007. [6] H. Dell, T. Husfeldt, and M. W ahlen. Exp onen tial Time Comp exity o d the p ermanen t and the T utte p olynomial. In pro ceedings of th e 37th ICALP , pp. 426–437 , 2010 . [7] R. Impagliazzo , R. Pa tur i, F. Zane. Whic h problems ha ve strongly exp onent ial complex- it y? Journal of Computer and System Sciences, 63(4):512– 530, 2001. [8] M. Jerrum, A. Sinclair, and E. Vigo d a. A p olynomial-time appr o ximation algorithm for the p ermanen t of a matrix w ith n on-negativ e en tries. Jou r nal of the ACM 5, pp . 671-6 97, 2004. [9] R. M. Karp. Dynamic p rogramming meets the principle of inclusion and exclusion, Op er. Res. Lett. 1, no. 2, pp. 49–51, 1982. 11 [10] M. Koivisto. P artitioning int o sets of b oun ded cardinalit y . 4th In ternational W orks hop on P arameterized an d Exact Computation (IWPEC ), LNCS 5917, pp. 258 –263, Springer, 2009. [11] D. Lokshtano v and J. Nederlof. Sa ving space by algebraization. I n pro ceedings of the 42nd A CM s y m p osium on theory of compu ting (STOC ), pp. 321–330, 2010. [12] J. Nederlof. Inclusion exclusion f or hard problems. Masters thesis, Utrec ht Un iv ersit y , August 2008. [13] J. Nederlof. F ast p olynomial- sp ace algorithms using Mobius inv ersion: Im- pro ving on S teiner T ree and related problems. Su b mitted, a v aila ble at h ttp://folk.uib.no/jne061/Steinerfull.p df , 2010. [14] H. J. Rys er. Combinatorial Mathematics, The Caru s mathematical monographs, The Mathematica l Ass o ciati on of America, 1963. [15] P . Sank o wski. Alternativ e algorithms for coun ting all m atchings in a graph . In pro ceed- ings of the 20th ST ACS, p p. 427–43 8, 200 3. [16] R. A. Servedio and A. W an. Computing sparse p ermanen ts faster. Information Pro cessing Letters, V olume 96 Issu e 3, 15 No ve mb er 2005. [17] L. G. V alia nt. Th e complexit y of computing the p ermanen t. Theor. Comput. Sci. 8, p p. 189–2 01, 1979. [18] F. Y ate s, The Design and Analysis of F act orial Exp erimen ts, T ec hnical Communicat ion No. 35, Commonw ealth Bureau of Soil Science, Harp enden , UK, 1937. 12

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment