mucha sankowski planar matching journal version

19
 Algorithmica (2006) 45:3-20 DOI: 10.1007/s00453-005-1187-5 lgorithmica 9 2006 Springer Science Business Media, Inc. Maximum Matchings in Planar Graphs via Gaussian Elimination Marcin Mucha 2 and Piotr Sankowski 2 Abstract We present a randomized algorithm for finding maximum matchings in planar graphs in time O(n ~ where co is the expo nent of the best known matrix m ultiplication algorithm. Since co < 2.38, this algorithm breaks through the O ( n J.5 ) barrier for the m atching problem. This is the first result of this kind for general planar graphs. We also present an algorithm lor generating perfect matchings in planar graphs uniformly at random using O (n ~ arithmetic operations. Our algorithm s are based on the Gaussian elimination approach to m aximum m atchings introduced in [ 16]. Key Words. Maximum matching, Planar graphs, Fast m atrix multiplication. 1. Introduction. A matching in an undirected graph G = (V, E) is a subset M ___ E, such that no two edges in M are incident. Let n = I V I, m = I El. A perfect matching is a matching of cardinality n/2. The problems of finding a Maximum Matching (i.e. a matching of maximum size) and, as a special case, finding a Perfect Matching if one exists, are two of the most fundamental algorithmic graph problems. Solving these problems in time polynomial in n remained an elusive goal for a long time until Edmonds [4] gave the first algorithm. Several other algorithms have been found since then, the fastest of them being the algorithm of Micali and Vazirani [14], Blum [ 1 and Gabow and Tarjan [5]. The first of these algorithms is in fact a modification of the Edmonds algorithm, the other two use different techniques, but all of them run in time O (mq -ff), which gives O(n 25) for dense graphs. The matching problems seem to be inherently easier for planar graphs. For a start, these graphs have O (n) edges, so O(m~v/~) = O (nl5). The same time complexity can also be achieved by directly using the separator theo rem for planar graphs [ 12], However, there is more to it. Using the duality-based reduction of maximum flow with multiple sources and sinks to single source shortest paths problem (see [15]), Klein et al. [8] were able to give an algorithm finding perfect matchings in bipartite planar graphs in time O (n 4/3 log n). This reduction, however, does not carry over to the case of general planar graphs. We have recently shown [ 16], that extending the randomized technique of Lowisz [ 13] leads to an O(n ~ algorithm for finding maximum matching in general graphs. In this paper we use similar techniques, together with separator-based decomposition of planar 1 This research w as supported by KBN Grant 4T11C04425. 2 Institute of Informatics, W arsaw University, Banacha 2, 02-097 Warsaw, Poland. {mucha,sank/@ mimuw.edu.pl. Received Novem ber 30, 2004; revised May 19, 2005. Communicated by S. Albe rs and T. Radzik. Online publication February 10, 2006.

Upload: lorenzojcd

Post on 07-Oct-2015

5 views

Category:

Documents


0 download

DESCRIPTION

Planar, math

TRANSCRIPT

DOI: 10.1007/s00453-005-1187-5
9 2006 Springer Science Business Media, Inc.
M a x i m u m M a t c h i n g s i n P l a n a r G r a p h s
v ia Ga uss ian El iminat ion
M a r c i n M u c h a 2 a n d P i o t r S a n k o w s k i 2
Abstract
We present a randomized algorithm for finding maximum matchings in planar graphs in time
O(n ~
wh ere co is the exponent of the best known matrix m ultiplication algorithm. Since co < 2.38, this
algorithm breaks through the O (n J.5) barrier for the matching problem. This is the first result of this kind for
general planar graphs. We also present an algorithm lor generating perfect matchings in planar graphs uniformly
at random using O
arithmetic operations. Our algorithms are based on the Gaussian elimination approach
to m aximum m atchings introduced in [ 16].
Key Words. Maximummatching, Planar graphs, Fast matrix multiplication.
1. I n t r o d u c t i o n . A matching in an und i rec ted gra ph G = (V, E ) i s a sub se t M ___ E,
such tha t no two e dge s in M are inc iden t . Le t n = I V I, m = IEl . A
perfect matching
i s a m a t c h i n g o f c a r d i n a l i t y n/2. T h e p r o b l e m s o f f i n d i n g a Maximum Matching (i.e. a
m a t c h i n g o f m a x i m u m s i z e) a n d, a s a s p e c i a l c a s e , f i n d in g a Perfect Matching i f one
e x i s ts , ar e tw o o f th e m o s t f u n d a m e n t a l a l g o r i t h m i c g r a p h p r o b l e m s .
S o l v i n g t h e s e p r o b l e m s i n ti m e p o l y n o m i a l i n n r e m a i n e d a n e l u s i v e g o a l f o r a l o n g
t ime un t i l Ed mo nd s [4] gave t he f i rs t a l go r i t hm . Seve ra l o the r a lgo r i t h ms have been
found s i nce t hen , the f a s t e s t o f t hem be in g t he a lgo r i t h m o f Mi ca l i and Vaz i r an i [ 14 ] ,
B lum [ 1 and G abo w and Ta r j an [5] . The f i rs t o f t he se a lg o r i t hm s i s i n f ac t a mod i f i c a t i o n
o f t h e E d m o n d s a l g o r i t h m , t h e o t h e r t w o u s e d i f f e r e n t t e c h n iq u e s , b u t a l l o f th e m r u n i n
t ime O (mq - f f) , wh i ch g iv es O( n 25 ) f o r dense g r aphs .
T h e m a t c h i n g p r o b l e m s s e e m t o b e i n h e r e n t l y e a s i e r f o r p l a n a r g r a p h s . F o r a s t a r t ,
t he se g r aphs hav e O (n ) edges , so O(m~v/~) = O ( n l 5 ) . T h e s a m e t i m e c o m p l e x i t y c a n
a l s o b e a c h i e v e d b y d i r e c t l y u s in g t h e s e p a r a t o r t h e o r e m f o r p l a n a r g r a p h s [ 1 2] , H o w e v e r ,
t h e r e is m o r e t o i t. U s i n g t h e d u a l i t y - b a s e d r e d u c t i o n o f m a x i m u m f l ow w i t h m u l t i p l e
sou rce s and s i nks t o s i ng l e sou rce sho r t e s t pa th s p ro b l e m ( s ee [15 ]) , K le in e t a l. [ 8] we re
a b l e to g i v e a n a l g o r i t h m f i n d in g p e r f e c t m a t c h i n g s i n b i p a r ti t e p l a n a r g r a p h s i n t i m e
O (n 4/3 l og n ) . Th i s r educ t i on , howev e r , doe s no t c a r ry o ve r t o t he ca se o f gene ra l p l an a r
g raphs .
We have r e cen t l y show n [ 16 ], tha t ex t end in g t he r and om ized t e chn ique o f Lowi sz [ 13]
l eads t o an
O(n ~
a l g o r i t h m f o r f i n d in g m a x i m u m m a t c h i n g i n g e n e r a l g r a p h s . I n t h is
p a p e r w e u s e s i m i l a r t e c h n i q u e s, t o g e t h e r w i t h s e p a r a t o r - b a s e d d e c o m p o s i t i o n o f p l a n a r
1 This research was supported by KBN Grant 4T11C04425.
2 Institute of Informatics, W arsaw University, Ban ach a 2, 02-0 97 W arsaw, Poland. {mucha,sank/@
mimuw.edu.pl.
Received Novem ber 30, 2004; revised May 19, 2005. Communicated by S. Albe rs and T. Radzik.
Online publication February 10, 2006.
 
4 M. Mucha and E Sankowski
graphs and the fas t nes ted dissect ion a lgor i thm, to show that maximum matchings in
planar graphs can be found in t im e O (n ~
REMARK l. In the case of w = 2 an addit ional poly loga rithm ic factor appea rs, so in
the remainder of th is pape r we assum e for s impl ic i ty that w > 2 .
There is one point to notice here. The O(n ~) algor i thm for general graphs presented
in [ 16] is fas ter than the s tandard m ax im um matching a lgor i thm s only i f the C opp ers m ith-
Winograd matr ix mul t ip l ica t ion is used (see [3]) . On the other hand, for our O(n ~/2)
algor i thm to be fas ter than the s tandard a lgor i thms appl ied to planar graphs , i t i s enough to
use any o(n 3) matrix m ultiplicatio n algorith m, e.g. the classic alg orithm of Strassen [20].
This suggests that our results not only consti tute a theoretical breakthrough, but might
a lso give a new pract ica l approach to solving the m axi m um m atching pro blem in planar
graphs.
The same techniques can be used to generate perfect matchings in p lanar graphs
uniformly a t random using O(n ~ ar i thmet ic operat ions . This improves on the resul t
of Wilson [22].
The res t of the paper i s organized as fol lows. In the next sect ion w e recal l som e wel l -
known resul ts concerning the a lgebraic approach to the maximum matching problem
and the key ideas from [16], In Section 3 we recall the separator theorem for planar
graphs and the fast nested dissection algorithm and show how these can be used to test
planar graphs for perfect matchings w i th O (n ~ operat ions . In Sect ion 4 we present an
algor i thm for f inding perfect matchings in p lanar graphs w i th O(n ~~ operat ions , and
in Sect ion 5 we show how to extend i t to an a lgor i thm f inding m ax im um matchings . In
all these algorithms we use multivariate rational functions ari thmetic and so their t ime
complexity is in fact much larger than O(n~ This issue is addressed in Section 6,
where we show that a ll the comp utat ions can be pe rformed over a f in ite f ie ld Zp, for a
random prime p ~(n4 ) . In Sect ion 7 we present an a lgor i thm for generat ing perfect
matchings in p lanar graphs uniformly a t random.
2 Pre l iminar ies
2.1. Matchings, Adjacency Matrices and Their Inverses. Let G = (V, E) be a graph
and let n = IV[ and V = {vl . . . . . vn}. A skew symmetric adjacency matrix of G is an
n x n matrix ,4(G) such that
I xi,j i f (vi, vj) ~ E and i < j ,
A(G)i,j = -x i.j i f (vi, vj) c E and i > j , ,
0 o therwise
where the Xi, j a r e unique var iables corresponding to the edges of G. Fo r /~ {Xi, : Ui , Uj)
c E}, le t Z[E ] be the r ing of polyno mials wi th in tegral coeff ic ients and var iables f rom
/~, and let Z(/~) be i ts f ield of fractions, i .e. f ield of rational fu nctions with integral
 
Tutte [21 ] obse rved the following
THEOREM 2. The symbol ic determinant de t .A(G) is non-zero i f f G h as a per fec t
matching.
Lovfisz [13] generalized this to
THEOREM 3. The rank o f the ske w sym metr ic adjacency matr ix A ( G ) i s equal to twice
the s ize of maxim um matching o f G.
Let G be a graph having a perfect matching and le t A = A( G) be i ts skew sym metr i c
adjacency matrix. By Theorem 2, ,~ is invertible. Rabin and Vazirani [18] showed that
THEOREM 4. /~-I)j,i 7~ 0 i f f the graph G - {1)i , 1)j } has a per fect matching.
In part icular, if (vi , vj) i s an edge in G, then ( / i - I ) j , i r 0 i f f U i , U j ) is al lowed,
i .e . i t is conta ined in so me pe rfect matching. This fo l lows f ro m the form ula (X -1
) i , j =
a d j ( X ) i , j / d e t X , where a d j ( X ) i . : - - t h e so-ca ll ed adjo in t o f X - - i s the de te rminan t o f X
wi th the j th row and i th co lumn removed , mult ip li ed by ( -1 ) i j.
Randomization.
per fec t ma tch ing . We need to compute d e t * ( G ) and answer YE S i f i t i s non-ze ro.
Unfortunately, this solution requires Z[/~] ari thmetic and is thus infeasible.
There is however another , more subt le , way of us ing Theorem 2 to tes t for perfect
match ings. R ecall the classic lem m a due to Zippe l [23] and S chwa rtz [19]:
LEMMA 5 (Zippe l, Sc hwa rtz). I f p ( x l . . . . . X m ) is a non-zero polynom ial of degree d
with coeff icients in a f iel d and S is a subset o f the f ield, then the probabili ty that p
evaluates to zero on a random elem ent (sl , s2 . . . . . s in) ~ S m is at mos t d /[S[.
Cho ose a prime p --- n o (l) and substi tute each variab le in/~ (G ) w ith a rand om e lem ent
of Zp. We call the result ing matrix the random adjacency matr ix o f G and denote i t by
A ( G ) . Since det A(G ) is a polynomial of degree n , by Lem m a 5 wi th high probabi l i ty
we have det A (G ) 5~ 0 i f fde t A(G) ~ O, i .e . G has a perfect matching. This rand omize d
tes t ing a lgor i thm was given by Lovfisz [13] . I t can be implemented to run in O( n ~ )
t im e using fast matrix multipl ication (w here co is the matrix m ultiplicati on expon ent,
currently co < 2.38, see [3]).
Lov~isz also showed that
THEOREM 6. The rank of A( G) is a t most twice the s ize of max imum matching in G.
The equalit y holds with prob abili ty at least 1 - (n / p).
Lovfisz ' s a lgor i thm is an exam ple of a general approach to constructing rand omize d
 
6 M. Much a and E Sankowski
of ra t ional funct ions and then use the Zipp el -S chw ar tz lem ma to show tha t i t can be
performed over Zp for a su i tab le choice of p .
In particular , this is the appro ach we tak e in this paper. In the rema ind er of this sect ion,
as wel l as in Sect ions 3-5 , we descr ibe our a lgor i thms us ing Z( /~) a r i thmet ic (even
though i t i s comp uta t ional ly infeas ib le) . The com plexi t y bounds for these a lgor i thms are
express ed in te rms of the numb er o f Z( /~) opera t ions . In Sect ion 6 we show tha t i f a ll the
comp uta t ions are per fo rmed over a f ini te f ie ld Zp ins tead of Z( E) , wi th h igh probabi l i ty
we st i l l get correct results , for a sufficiently large (but polynomial in n) prime p.
2.3. P e r f e c t M a t c h i n g s v ia G a u s s i a n E l i m i n a t i o n . We now reca l l a technique , recent ly
developed by the authors , of f inding per fec t matching s us ing G auss ia n e l iminat ion . This
technique can be used to f ind an inc lus ionwise m axim al a l lowed subm atchin g of any
matching in t ime O n ~ ) , which i s a key e l emen t o f ou r ma tch ing a lgo r i t hm fo r p l ana r
graphs . A more de ta iled expos i t ion o f the Gauss ian e l iminat ion techn ique and fas ter
a lgor i thms for matchings in b ipar t i te an d ge nera l graph s can be found in [ 16] .
Consider a skew symmetr ic ad jacency matr ix A = A G ) of a graph G = (V, E) ,
wh er e I V I = n, V = {v i, U2 .. . . . Un }. If (vi, ~ j ) E E and (A- i )i,j ~z~ 0, then ~)i, U ) is an
a l lowed edge . We may thus choose th is edge as a matching edge and t ry to f ind a per fec t
mat chin g in G = G - {vl , v2}. Th e pr ob lem with this app roa ch is that edge s that were
a l lowed in G might not be a l lowed in G . Com put in g the matr ix .4(G ) - I f rom scra tch i s
out of the question as the result ing a lgori th m would require O (n ~+1) oper ation s to f ind
a pe rfec t ma tching . T he re i s however ano the r way o f compu t ing A(G ) - I , sugges t ed by
THEOREM 7 (Elimination Theorem). L e t
x = \ u i y ]
whe re fc l . i :~ O. Then Y I = I) _ t~ T/ Xi , i .
PROOF. Since X X L = 1, we have
Using these equali t ies we get
Y(]) - t~vr /x l , l ) = L, I - uv v - YhO r/- ?t, L
= ln--1 - - H ~ r ~- Hf f l , t ~r /X l , l = ln -I - - b l~jT -~- U ~ r = L, 1 .
[]
The m odificat io n o f 1 d escrib ed in this theo rem is in fact a s ingle step of the well-
 
Maximum Matchings in Planar Graphs via Gaussian Elimination 7
(colum n) us ing the f ir s t equat ion ( row) . S imi lar ly , we can e l iminate f ro m X -J any o ther
var iable (colum n) j us ing any equat io n ( row) i , such tha t (X -1 )i,j 5 O.
In [16] we sho w tha t amo ng the conseq uen ces of Theo rem 7 i s a very s imple O (n 3)
a lgor i thm for f inding per fec t matchings in genera l graphs ( th is i s an easy corol la ry) as
wel l as O (n ~ a lgor i thm s for f inding per fec t matc hing s in b ipar ti te and ge nera l graphs .
The las t of these requi res so me add i t ional s t ruc tura l techniques .
2.4. Matching Verification. We now desc r ibe ano the r consequen ce o f Th eorem 7 , one
tha t is c ruc ia l for our approac h to f inding m axi mm n m atchin gs in p lanar graphs . In [ 161
we have show n tha t
THEOREM 8. Gaussian elimination without row or column pivoting can be done with
0 (n ~~ opera tions using lazy com putation s.
REMARK 9. The a lgor i thm in Th eo rem 8 is very s imi lar to the c lass ic Hop cro f t -B un ch
algor i thm [2] . I t i s however more in tu i t ive and be t te r su i ted for our purposes .
PROOF. As sum e tha t we are per fo rmin g Gauss ian e l iminat ion o n an n x n matr ix X
and af te r e l iminat ing the f ir st i - 1 rows and column s, we a lw ays have Xi i ~
O. In this
case we can avo id any row o r co lumn p ivo t ing , and the fo l lowing a lgo r i thm pe r fo rms
Gauss i an e l imina t ion o f t he who le ma t r ix X in t ime O(n~ By l azy e l imina t ion we
mean s tor ing the express ion of the form u v r / c descr ib ing the changes requi red in the
rema in ing submat r ix w i thou t ac tua l ly pe r fo rming them. Th ese chan ges a re t hen execu ted
in ba t ches du r ing the ca ll s to UP DA TE (R, C) wh ich upda te s t he Xs . c submat rix . Sup pose
tha t k chan ges w here accu mu la ted for the submatr ix X k . c a n d th e n U P D A T E ( R , C ) w a s
cal led . Let these changes be U V(/Cl U2U~'/C 2, 7 .
. . . . uk v k ~ok, t he accumula t ed change
o f XR,c is
I c , . . . u , l l c , = u v .
wh ere U is an IRI x k matrix with col um ns uj , u2 . . . . . uk and V is a k • ICI matrix
wi th rows v~/cT, v ~/c2 . . . . . v~ /ck. The matr ix U V can be found us ing fas t mat r ix
mult ipl icat ion.
L e t u s c o n s i d e r t h e c al l t o E L I M I N A T E - R O W S - A N D - C O L U M N S ( X , p , q ) ( s e e F i g-
ure 1), and let j = q - m + 1. Th e cost of the update s in the cal l is prop ort io nal to the
cos t o f mul t ip ly ing the 2 . /x 2 -i mat r ix by a 2 j x n m atrix. B y spli t t ing the secon d matrix
into 2J x 2 j square submatr ices , th is can be done in t im e n / 2 J ( 2 J ) a = n(2 J) ~ 1. Now ,
every j appears n/2 / t imes , so we ge t the to ta l t ime complexi ty of
[log n7 [log n]
Z n/2/n(2i)~~ I = n 2 Z (2~~ 2 j < n2(2~o 2)Flog.7 = O(nOO). []
j =0 j =0
This a lgor i thm has a very in teres t ing appl ica t ion:
THEOREM 10. Let G be a graph having a perfect matching. For any matching M of G,
an inclusion-wise maxima l allowe d (i.e. extendible to a perfect matching) submatch ing
 
ELIMINATE-ROWS-AND-COLUM NS(X, p , q ) :
1 . i f q = p t h e n
lazi ly el iminate the pth row and the pth column of X
r e t u r n
2. let m := [(p + q)/2 J
3. ELIMINATE-ROW S-AND -COLUM NS(p , m)
4. UPDATE({m + l ... .. q}, {m + 1 ... . n})
5. UPDATE({q + 1 ... . n}, {m + 1 . . . . q})
6 . ELIMINA TE-ROW S-AND -COLUM NS(m + 1, q )
ELIMINATE(X):
PROOF. Le t M = {(Vl,
/ )2) , / )3 , / )4 ) . . . . . Uk-l,
be t he
u n m a t c h e d v e r ti c e s. W e c o m p u t e t h e i n v e r s e , 4 ( G ) - 1 a n d p e r m u t e i ts r o w s a n d c o l u m n s
so tha t the row ord er i s v t , / )2 , v3, v4 . . . . . v,~ and the c o lu m n ord er i s v2 , v l , v4 ,
v3 . . . . . v , , v ~ _ l . N ow , p e r f o r m G a u s s i a n e l i m i n a t i o n o f th e f i rs t k r o w s a n d k c o l u m n s
u s i n g t he a l g o r i t h m o f T h e o r e m 8 , b u t i f t h e e l i m i n a t e d e l e m e n t i s z e r o j u s t s k i p t o
t h e n e x t r o w / c o l u m n p a ir . T h e e l i m i n a t e d r o w s a n d c o l u m n s c o r r e s p o n d t o a m a x i m a l
s u b m a t c h i n g M ' o f M . [ ]
2.5. Degree Reduction. W e n o w r e c a ll a w e l l - k n o w n t e c h n i q u e o f v e r t e x s p l i t t i n g
( see fo r exa mp le [22] ).
THEOREM 11. The problem o f f inding perfect maximum ) m atchings in planar graphs
is reducible in O n) t ime to the problem of f inding perfect maxim um) matchings in
planar graphs with maximum vertex degree 3. This reduction adds O n) new vertices.
PROOF. Sup pose t ha t G has a ve r t ex v w i th deg ree > 3 . Le t N (v ) be t he s et o f ne i ghb ou r s
o f v . W e c h o o s e t w o n e i g h b o u r s w], w2 ~ N v) and r ep l ace v w i th t h r ee ve r t i c e s
vl, v2, v3 as shown in F igu re 2 . Le t G be t he r e su l t i ng g r aph . The re i s a a one - to -one
/
/
\\\
w2 . %
Fig. 2 . Vertex spl i t t ing. On the lef t is a high degree vertex v. I t is matched in the perfect matching with one of
i ts ne ighb ours
w2
On the r ight is the grap h af ter spl i t t ing this vertex into vl v2 v3. Now v3 is matc hed with
 
Maximum Matchings in Planar Graphs via Gaussian Elimination 9
to < 3 requi res only O (m) = O (n) sp l i t t ing opera t ions , so the resul t ing gra ph has O (n)
vertices.
Even i f G has no per fec t matching , we can s t i l l use th is reduct ion . There i s an easy
t r ansl a tion o f ma x im um match ings in t he o r ig ina l g raph G to ma x im um match in gs in
the bounded deg ree g raph G and v i ce ve r sa ( i t i s no t one - to -one , t hough) . No t i ce t ha t
the num ber o f unm atched ve r t i ce s i n a ma x im um match ing i s t he s ame fo r G and G . [ ]
Thro ugho u t t he r es t o f t hi s pape r we r e s t r ic t ou r se lves t o g raphs wi th deg ree b oun ded
by 3.
3 . Testing Planar Graphs for Perfect Matching In th is s ec t ion we show h ow p lana r
g raphs can be t e st ed fo r pe r f ec t ma tch ing us ing O( n ~/2) opera t ions . We use the nes ted
d i s sec tion a lgo r i thm which pe r fo rms Gauss i an e l imina tion us ing O (n ~/2) ope ra t ions fo r
a specia l c lass of matr ices. Th e resul t s presented in the next subsec t ion are due to Lip ton
and Tar jan [11] and Lipton e t a l . [10] . We fo l low the presenta t ion in [17] as i t i s bes t
su i ted fo r our purposes .
3.1. Sparse LU F actorization via Nested Dissection. We say tha t a grap h G = (V, E)
has an s (n) - separa tor fami ly (wi th respect to som e con s tant no) i f e i ther IVI _< no,
or by de le t ing a se t S of ver t ices such tha t ISI _< s( IWr) , we may par t i t ion G in to two
disco nnec ted subgra phs wi th the ver tex se ts Vl and V2 such that I Vi I < 2 /31V1, i = 1,2 ,
and fur thermo re each of the two subg raphs o f G def ined by the vertex se ts S U Vi, i = 1 ,2 ,
a lso has an s (n) -se para tor fami ly . The se t S in th is def in i tion i s ca l led an s(n)-separator
in G (we a lso use the name small separators fo r O (v ~ ) - se pa ra to r s ) and the pa r ti t ion
resul t ing f rom recurs ive app l ica t ion of th is def in i t ion i s the s (n )-sepa rator tree. Par t i t ion
of a subgraph of G defines i ts children in the tree.
The fo l lowing theo rem o f L ip ton and Ta r jan [1 1] g ives an impor t an t examp le o f
g raphs hav ing O (v ~ ) - sepa ra to r f ami li e s :
THEOREM 12 (Separa tor The orem ) . Pla nar graph s have 0 (vrff )-separator families.
Moreover, an 0 ( V-if )-separator tree fo r a pla nar graph can be fo un d in t ime 0 (n log n) .
Let X be an n • n matr ix . The graph G ( X ) corresponding to A is def ined as fo l lows:
G ( X ) = (V , E ) , V = {1 ,2 . . . . . n}, E = { {i, j}l i 5 j and (X i,j r Oor Xj,i 0 ) } . T h e
exis tence of an O (v / -f f )-separa tor fami ly for G ( X ) makes f a s t e r Gauss i an e l imina t ion
poss ib le a s the fo l lowing theo rem o f L ip ton and Ta r jan shows :
THEOREM 13 (Nested Dissection). Let X be a symmetric positive definite matrix and
let G ( X ) have an O ( v ~ )-separator family. Given an O ( v/n ) separator tree fo r G ( X ),
Gaussian elimination on X can be perfo rme d in t ime 0 (n ~~ using so-called nes ted
dissection. The resulting LU factorization of X is given by matrices L and D , X =
L D L r , where matr ix L is unit lower-tr iangular and has O(n l o g n ) non-zero entries
and matrix D is diagonal.
REMARK 14. The assum pt ion of X being symm etr ic pos i tive def in i te i s need ed to assure
 
10 M. Mucha and E Sankowski
the e limina tion . I f we can gua ran tee t h i s i n some o the r way , then the a s su mpt ion can be
omit ted .
We do n ot present the de ta il s of th is a lgor i thm. T he bas ic idea i s to perm ute row s
and co lum ns o f X us ing the O Gv/-~)-separator t ree. Vert ices o f the top-leve l separ ator S
correspond to the las t ISI rows an d las t I SI co lum ns, e tc . Wh en Gau ss ian e l iminat ion i s
per formed in th is order , the matr ix remains sparse throughout the e l iminat ion .
S ince we a re go ing to pe r fo rm Gauss i an e l imina t ion on ma t r i ce s ove r Z ( /~ ) , we
need to f ind a way to apply Theo rem 13 to such matr ices . The usual not ion o f pos i t ive
def in i teness does not make sense in th is case , so we ca ll a mat r ix X over Z( /~) symmetric
positive definite i f i t is of the for m X = y y T fo r some non - s ingu la r Y .
We have the fo l lowing:
FACT 15 (Sy mb ol ic Nes ted Dissec t ion) . Th eor em 13 holds for matr ices over Z( /~) .
PROOF. Let X = Y yT be a sym me tr ic pos i t ive def in ite matr ix over g( /~ ) . Ac co rdin g to
Rem ark 14 we on ly need to gua ran tee t ha t no d iagona l ze ros app ea r du r ing the e l imina t ion
of X. Sin ce det Y 5~ 0, there exist a subst i tut io n v of variables in E , suc h that det Yo r 0,
wh ere Y~ is Y after the su bsti tut ion v.
Since Y~ is non -singula r , X , = Y~ Y~ is sym me tric po si t ive defini te in the usual se nse.
By Theorem 13 there are no d iagonal zeros dur ing the e l iminat ion of X~. The same has
to be t rue for X, s ince ent r ies of X~ are jus t subs t i tu ted vers ions of en t r ies of X. [ ]
3.2. The Testing Algorithm. Test ing a genera l grap h G fo r havin g a per fec t matc hing
requi res per form ing Gauss ian e l iminat ion on the matr ix ,4 = ,~(G) ( in order to co mp ute
i ts de terminant ) . In case of p lanar graphs and p lan ar matr ices , w e want to ge t an O
n ~/2)
algor i thm, so we have to use the nes ted d issec t ion a lgor i thm to per form the e l iminat ion .
In order to use i t , however , we need to guarantee tha t there are no zeros on the d iagonal
dur ing the e l iminat ion , an d the only kn own meth od o f doin g th is requi res f inding a
pe r f ec t ma tch ing f ir st . Th i s app roach does no t l ook ve ry p romis ing . In s tead , we w ork on
the ma t r ix /~ = ~ r .
Not ice tha t i f A i s non-s ingular ( i .e . G has a per fec t matching) , then/~ i s symmetr ic
pos i t ive def in i te . In orde r to use Fact 15, we ne ed to sho w tha t G B ) and al l i ts subgraphs
have smal l separa tors . This i s not t rue in genera l , but i t is t rue i f G is a bou nde d d egree
graph. Let S be a small separator in G A) = G, and cons ider the se t T conta in ing a l l
vert ices of S and al l their neighbours. We call T a thick separator corresponding to S.
Not ice th t Bi,j can be non-zero only i f there exis t s a pa th of length 2 be tween vi a n d
vj. Thus T i s a separa tor in G( /~) . T i s a lso a smal l separa tor , because G has bounded
degree and so ITI < 4[SI = 0(4 - ) - In the same man ner smal l separa tors can be fou nd
in any subgraph o f G( /3 ) , so Gauss i an e l imina tion on ma t r ix /~ can be pe r fo rm ed us ing
the nes ted d issec t ion a lgo r i thm wi th O (n ~~ opera t ions .
We are now ready to present the tes t ing a lgor i thm for p lanar graphs (see Figure 3) .
I f the nes ted d issec t ion a lgor i thm f inds an LU fa c tor iza t ion o f / ~ , then B i s non -
s ingular , and so A is non-s ingular , thus G has a per fec t matching . I f , howev er , the nes ted
dissec t ion fa i ls , i. e. there appears z ero on the d iagon al dur ing the e l iminat ion , then /~ i s
 
PLANAR-TEST-PERFECT-MATCHING(G):
2. compute i / = ~ ,~r ;
3. run nested dissect ion on/~;
4. G has a perfect matching iff the algorithm succeed s, i .e. finds an LU fac torization;
Fig. 3. An algorithm for testing if a planar graph has a perfect matching.
4 Findin g Perfect Matching s in Plana r Grap hs In t h i s s e c ti o n w e p r e s e n t a n a l g o -
r i t h m f o r f in d i n g p e r fe c t m a t c h i n g s i n p l a n a r g r a p h s . I n S e c t i o n 5 w e s h o w t h a t t h e m o r e
g e n e r a l p r o b l e m o f f i n d in g a m a x i m u m m a t c h i n g r e d u c e s t o th e p r o b l e m o f f i n d i n g a
p e r f e c t m a t c h i n g .
4.1. The General Idea . F o r a n y m a t r i x X , l e t X R , c d e n o t e a s u b m a t r i x o f X c o r r e -
s p o n d i n g t o r o w s R a n d c o l u m n s C .
T h e g e n e r a l i d e a o f th e m a t c h i n g a l g o r i t h m i s p r e s e n t e d i n F i g u r e 4 .
To f i nd a pe r f ec t ma t ch ing i n a p l ana r g r aph , we f i nd a sma l l s epa ra to r , ma t ch i t s
ve r t i c e s i n an a l l owe d way ( i .e . one t ha t c an be ex t en ded t o t he s e t o f a l l ve r t i c e s ) , and
t h e n s o l v e t h e p r o b l e m f o r e a c h o f th e c o n n e c t e d c o m p o n e n t s c r e a t e d b y r e m o v i n g t h e
e n d p o i n t s o f t h is m a t c h i n g . I n t h e r e m a i n d e r o f th i s s e c t io n , w e s h o w t h a t w e c a n p e r f o r m
steps 3 and 4 us ing O n ~/2) o p e r a t i o n s . T h i s g i v e s t h e c o m p l e x i t y b o u n d o f O n ~
o p e r a t i o n s f o r th e w h o l e a l g o r i t h m a s w e l l .
4.2. Comput ing the Important Par t o f f i t G) - j . W e c o u l d e a s i l y f i nd ( A ( G ) I ) r ,T i f
we had an LU f ac to r i za t i o n o f fit = f i t (G) . Unfo r tu na t e ly , 2 i i s no t sym me t r i c po s i t i ve
de f in i t e , so we canno t u se t he f a s t ne s t ed d i s s ec t i on a lgo r i t hm to f ac to r i ze f i t . I n t he
t e s t i ng phase we f i nd n x n ma t r i c e s L and D s uch t h a t / ~ r = L D L T , whe re L i s un i t
l o w e r - t r i a n g u l a r a n d D i s d i a g o n a l . W e n o w s h o w h o w L a n d D c a n b e u s ed t o c o m p u t e
( A - I ) r , r in t im e O n~~ We rep re sen t f i t , L and D a s b lock ma t r i c e s :
fit = fit2 1 A2 2 ] D = 02 2
L = \L 2, j [ Lz, 2J = -1 L -1 L I ,
L2 2L2 1 1 1 2 2
PLANAR-PERFECT-MATCHING(G) :
1. run PLANAR -TEST-PERFECT-MA TCHING(G);
2. let S be a small separator in G and let T be the corresp ondin g thick separator;
3 . f ind (A (G ) - l ) r , r ;
4 . us ing the FIND-ALL OWE D-SEPAR ATOR -MATC HINGprocedure, f ind an al lowed m atching
M incident on all vertices of S;
 
12 M. Mucha and E Sankowski
where lower r ight b locks in a ll mat r ices c orres pon d to the ver t ices of the th ick separa to r
T , fo r example Ar,r = A2,2. S i n c e , ~ r = L D L r , we have
/ ~ r ) - I = ( L T ) - I D - I L - I f i i ,
where the in teres t ing par t of .~ r ) - l i s
(AT)TI T = ((LT)- I )T, vD -I L-I ~V, r
: ( C ~ , 2 ) - D 2 , 1 ( L - I ) T , v A v+ T
(L~,: ) - t - ' - ' - + (L ~: )- t D~t2(L- ' fii
= D 2 , 2 L 2 . 2 A 2 , 2 , , )2.1 1.2.
The f ir st com pon en t can be ea s ily com pu ted wi th O(n ~ opera t ions us ing fas t mat r ix
mul t ip l ica t ion . The second com pon en t can be wr i tt en a s
T - I - I - I T - I - I - 1 - I
( L 2 , 2 ) D 2 , z ( L ) 2, 1 ~ 1 ,2 = - ( L 2 , 2 ) D 2 , 2 L 2 , 2 L 2 , 1 L I , I A t , 2
and the only hard par t here i s to com pu te X = -L2,1L~I+ A 1 ,2 . Con sider the ma tr ix
When Gauss i an e l imina t ion i s pe r fo rmed on the non- sepa ra to r co lumns and ve r t i ce s o f
B , the l ower ri gh t submat rix becom es X . Th i s i s a we l l -know n p rope r ty o f the Schur
complem en t . E l imina tion can be pe r fo rmed wi th u se o f t he nes t ed d i s sec t ion a lgo r i thm
in t ime 0 ( ~ The idea here is that the separator t ree for/~fi~r is a val id separator tree
fo r L , thus a l so fo r B . The new non -ze ro en t ri e s o f L in t roduced by G auss i an e l imina t ion
(so-calledfill-in), corresp ond to the edge s tha t can only go up ward s in the sepa ra tor t ree,
f rom chi ld to one of i ts ances tors see [7] ) . Not ice tha t s ince L~. j is lower-d iag onal , there
are no problems wi th d iagonal zeros , even though B is not symmetr ic pos i t ive def in i te .
4.3. Matching the Separator Vertices. We now show how the sepa ra to r ve r ti ce s can be
ma tched us ing the ma tch ing ve r i fi ca tion a lgo r ithm. C ons ide r t he p rocedure p re sen ted in
Figure 5.
The ve r i f i ca t ion a lgo r i t hm f inds a max ima l a l l owed submatch ing M~ o f MG us ing
O( n ~'/2) opera t ions . I t works on the matr ix ,4 G ) - j , bu t it never uses any va lues f ro m
FIND-ALLOWED-SEPARATOR-MATCHING:
2. let GT = (T, E(T ) - E(T S));
3. let Me be any inclusionwise maximal m atching in GT using only allowed edges;
4. run the verification algorithm of The orem 10 on A-J)T.T to find a maxim al allowed submatch-
ing M~ of MG;
5. add M~ to M;
6. remov e the vertices m atched by M~ from GT;
7. mark edge s in Me - M~ as not allowed;
8. if M does not match all vertices o f S go to step 3;
 
Maximum Matchings in Planar Graphs via Gaussian Elimination 13
ou t s ide the submat r ix (5 , (G) - I )T ,T co r r e spon d ing to t he ve r t ice s o f T , so we on ly have
to compu te t h is submat r ix . Le t A be the re su lt o f runn ing the ve r i fi ca t ion a lgo r i t hm o n
~ = (A (G - V(M G))-I)T, r,,he m atr ix ( ,~ , -l ) r , T . Not ice tha t due to Th eo rem 7 , A r ,, r
whe re T is ob t a ined f rom T by r emov ing the ve rt i ce s ma tched by M ~. T hus the i nve rse
does no t need to be comp u ted f rom sc ra tch in each i t e ra t ion o f t he loop .
Now cons ide r t he a l l owed ma tch ing M cove r ing S , found by the a lgo r i t hm shown
in Figure 5 . Not ice tha t any edge e of M is e i ther inc ident o n a t leas t one edg e o f the
inc lus ionwise max ima l m a tch ing M c o r i s con ta ined in Mo , b ecause o f t he max ima l i t y
of Me . I f e is in M e, i t i s cho sen in s tep 4, o therwise one o f the edges inc ident to e i s
marked a s no t a l lowed . Eve ry edge e ~ M has a t mo s t fou r i nc iden t edges , so the l oop
is executed a t most f ive t imes and the whole procedure requi res O n ~ opera t ions .
5 . M a x i m u m v e r s us P e r fe c t M a t ch i n g s We no w show tha t the p rob lem o f f ind ing a
max imu m ma tch ing can be r educed to the p rob lem o f f i nd ing a pe r f ec t ma tch ing us ing
O(n ~/2) opera t ions . The pro blem is to f ind the la rges t subse t W c V, such tha t the
induced G[W] has a per fec t matching . Not ice tha t this is equiva lent to f inding the la rges t
subset W __ V, such that A w, w i s non-s ingular . The bas ic idea i s to use the nes ted
dissec t ion a lgor i thm. W e f ir s t show tha t non-s in gula r subm atr ices of A A r corr espo nd to
non- s ingu la r submat r i ces o f A (no te tha t Le mm a 16, Th eorem 17 and Theo rem 18 a re
a ll we l l -kno wn fac ts ) .
LEMMA 16. The matrbc A A T has the same rank as A.
PROOF. We wi ll prove tha t ker (A ) = ker(ATA). Let v be such tha t (ATA)v = 0. We
have
s o A r = 0 . [ ]
We wi l l a l so need the fo l lowing c l a s si c t heo rem o f F roben ius ( s ee [9 ] ):
THEOREM 17 (Frobenius The orem ) . Let A be an n x n skew-symmetric matrix and let
X, Y __. {1 . . . . . n} such that [X[ = [Y[ = r an k( A) . Then
det (Ax, x) det(Ay, y) = ( - 1 ) Ixl det2(Ax, y).
No w w e a re r eady to p rove the fo l lowing :
THEOREM 18. If AAT)w,w
non-singular.
rank(AAT).
B y
Lemma 16, th is i s equal to rank(A) . Let Aw, u be any squa re submat r ix o f Aw, v o f
max ima l r ank . F rom the F roben ius t heo rem i t fo l lows tha t
A w, w
rank. []
14 M. Mucha and R Sankowski
The on ly ques t ion now i s , whe the r A A r always has a submatr ix ( A A r ) w , w (i.e. a
symmet r i ca l ly p l aced submat r ix ) o f max ima l r ank . The re a re many ways to p rove th i s
fac t, but we use the on e tha t leads to an a lgor i thm for ac tua l ly f inding th is subm atr ix .
LEMMA 19. l f ( AA r) i , i = O, then (AA T) i , j = (A Ar) j , i = Ofora l l j .
PROOF. Le t ei be the i th uni t vec tor . We have
0 = ( A A r ) i. i = ( e I A ) ( A T e i ) = ( A Y e i ) r ( A r e i ) ,
so A r e i = 0 . However , then ( A A r ) i , j = ( e f A ) ( A V e i ) = 0 for any j and the same fo r
(AA r)L i . []
THEOREM 20. A submatrix ( A A r ) w,w o f AA r of maximal rank always exis ts and can
be fou nd with 0 (n ~~ operations using the nested dissection algorithm.
PROOF. We perform the nes ted d issec t ion a lgor i thm on the matr ix A A r . At any s t age
of the compu ta t ions , the matr ix we are work ing on i s of the form B B r for some B. I t
fo l lows f rom Le mm a 19, tha t i f a d iagon al en t ry we w ant to e l iminate has va lue zero ,
then the row and the co lumn co r re spond ing to th i s en t ry cons i s t o f on ly ze ros , We ignore
these and proceed wi th the e l iminat ion . Th e matr ix (AA r ) we are looking for cons is t s
of a ll non - igno red rows and colum ns, ffl
COROLLARY 21. F o r a n y p t a n a r g r a p h G = V , E ) a t a r g e s t s u b s e t W c_ V , such that
G[ W] has a perfect matching, can be fou nd with 0 (n ~ /2) operations'.
We have thus a rgued tha t fo r p l ana r g raphs the max imum ma tch ing p rob lem can be
reduced to the per fec t matching problem wi th O(n /2) opera t ions . S ince we can so lve
the lat ter with O(n /2) opera t ions , we can so lve the former wi th in the same bounds .
6 . W or k i ng ov e r a F in i t e F i e ld . So f ar , we have shown an a lgo r i thm f ind ing a max-
imum matching in a p lanar graph us ing O( n ' ' /2) ope ra t ions i n Z (E) . Obv ious ly , t h i s
cannot be implemented ef f ic ient ly . We now show tha t , wi th h igh probabi l i ty , our match-
ing algori thms give the same results if performed using the f ini te f ield ari thmetic Z~, for
a r andomly chosen p r ime p = O n4).
Each r a t i onal func t ion comp u ted by ou r m a tch ing a lgo r i thm i s a quo t i en t o f two
po lynom ia l s f rom Z |E ] . Le t F = { f l , f 2 . . . . } be the s et o f a ll the se po lynomia l s . S ince
our a lgo r i t hm pe r fo rms O (n ~~ opera t ions , we have IF I = O 01 /2 ) . Fo r any po lyno mia l
f , le t I I - - t h e weight of f - -b e the sum o f t he abso lu t e va lues o f coe f f ic i en ts o f f . Not ice
tha t I fg l -5 I f [ I g l , I f + g l < [ f l + Ig l.
Our a lgor i thm p erform s ar ithmet ic opera t ions on the polyno mials in F and tes ts i f they
a re non-ze ro . We wou ld now l ike t o app ly the Z ippe l -Schwar t z l emma s imu l t anous ly
to a ll the polyno mials in F and argue tha t by subs ti tu t ing var iables in /7 wi th ran do m
numbers f rom a su i tab le f in i te f ie ld Zp, wi th h igh probabi l i ty a l l these tes ts g ive the
corre ct result .
Maximum Matchings in Planar Graphs via Gaussian Elimination 15
The proble m wi th th is reasonin g is tha t the coeff ic ients of som e f 6 F mig ht be a ll
mul t ip les of p and then f i s zero over Zp, even thoug h i t i s non -zero over Z . To ge t
around th is prob lem w e prove tha t the coeffic ients of al l f E F are smal l . I t fo l lows tha t
they have a smal l num ber o f pr ime d iv isors and thus , wi th h igh probabi l i ty , a ll f E F
a re non-ze ro modu lo a su f fi c ien t ly l a rge r andom p r ime p .
The fo l lowin g theo rem i s a fo rma l s t a t emen t o f t he above cons ide ra t ions .
THEOREM 22. Ass um e tha t a l l f E F have degrees o f o rder O n ) an d coe f fi c ien t s o f
order
O(n2" ) .
p = 6)( n 4)
be a random pr ime . I f we as s ign random va lues f rom the
se t { 1 . . . . p - 1 } to the var iables o f poly nom ials in F, then w i th h igh proba bi l i ty a l l
po lynom ia l s f E F have non- zero va lue over Zp .
PROOF. We f irs t prove tha t wi th h igh probabi l i ty a l l the polyn om ials a re not ident ica l ly
zero over Zp. Ever y f has a non -zero coeff ic ient of order O(n2n) . Th is coeff ic ient can
on ly have O n ) dis t inc t pr ime d iv isors o f order 6) n4). This g ives a t most O n n ~ =
O( n 3) d is t inc t pr ime d iv isors for a ll polyno mia ls s ince w e only co ns ider on e coeff ic ient
for each poly nom ial and IF] = O n~~ There are 6) (n4 / log n) d is t inc t pr imes o f order
O(n4 ) , so wi th h igh probabi l i ty a l l polynom ials in F have a non -zero coeff ic ient in Z v
fo r a r andom p r ime p o f o rde r 6) n4).
We can now use the Z ippe l -Schwar t z l emma. S ince a l l po lynomia l s f E F have
degrees O n ) , the probabi l i ty o f a fa lse zero for a s ingle p olyn om ial i s O n 9 4) =
O (n 3). Th e sum of these probab il i t ies ove r al l po lyn om ials . f E F is O (n I) . []
We now p rocee d to show tha t the assum pt ions of th is theore m are sa ti s fied .
Al l the ra t ional funct ion s we co ns ider a re the ent r ies of one of the fo l lowing matr ices :
t he skew symm et r i c ma tr ix ,4 = / t (G ) and its i nve rse ;
_ ~ r
- in termedia te result s of Gauss ian e l iminat ion p er fo rme d on the above;
The case o f / t and ,4 I has a l ready been analyse d in [18] and i t i s s igni f icant ly eas ier ,
so we only cons ider ~ 7 ' and i ts par t ia l ly e l iminated vers ions .
Not ice tha t the e lements of A A T have a very s imple form.
LEMMA 23. Non -zero e lemen ts o f f~ f~ v are polyn om ials cons is t ing o f a t mo st three
dif ferent mono mia ls with all coeff icients equ al to • I .
PROOF. This fo l lows f ro m the fac t tha t al l ver t ices of G have deg ree a t most 3 (see
reduct ion in Sect ion 2 .5) . [ ]
Th i s g ives t he fo l lowing bound fo r the de t e rminan t o f any subm at r ix o f AA T :
LEMMA 24.
The de t e rminan t o f any su bmat r i x o f f~ f~ r i s a po lyno mia l o f w e igh t a t
most 0 (3kk ).
PROOF. The de t e rminan t o f a k x k submat r ix o f ,~ v is t he sum o f a t mos t k p rod -
 
16 M. Mucha and R Sankow ski
de te rminan t g ives a t mos t 3kk mon omia l s w i th • coe f f ic i en ts , so t he we igh t o f t he
determin ant i s a t mo st O (3kk ) . [ ]
COROLLARY 25 . The entr ies o f the inverse of any submatr ix o f A A r are rat ional func -
t ions wi th both numerator a nd denominator having we ight o f order 0
(3~k ).
The fo l lowing we l l -known theo rem desc r ibes t he s t ruc tu re o f a par t ia l l y e l imina t ed
matrix:
Let B be an n x n matrix, and let
BI, I BI ,2)
B = \B 2 1 B2,2,] '
where B l I corresponds to the f i rs t k rows and k colum ns o f B. Then Gaussian e l iminat ion
of these rows and columns results in the matrix
o o )
/} = B 2 , 2 - B2,1B j, IB1,2 '
where D is the diagonal m atr ix f ro m the LDU factor izat ion of Bl , j .
The fo l lowing theo rem gua ran tees t ha t ou r ma tch ing a lgo r i t hm can be run ove r Zp.
THEOREM 2 7. At any s tage o f the Gaussian e l iminat ion pe r form ed on the matr ix f~ ~ v ,
the rational func tions corresponding to non-zero entries o f the unelim inate d part o f f~ A r
have numerators and denominators wi th weight o f order 0 (3nn ) = O(n2 n).
PROOF. As sum e tha t B = ~ r has a b lock st ruc ture as descr ibe d in the prev ious
theo rem. Wh en nes t ed d i s sect ion i s pe r fo rmed on B , we on ly need the e l emen t s f rom the
part o f the m atrix tha t was not y et el imin ated, i .e . the ele me nts of X = B2,2 - B2, l B ~, I B I, 2.
No n-ze ro po lyno mials in B2, j and
Bi,2
have we igh t s a t mos t 3 and non-ze ro en t r i e s o f
B~, I a re ra t ional funct ions wi th n umera tors and den om inato rs of weig ht O(3nn ). Thi s
g ives a we igh t bound o f O(n23n+2n ) fo r numera to r s and d enom ina to r s o f en t ri e s i n
I
B2,1Bl, I Bi,2, which can be fu r the r r educed to O(3 "+2n ) = O(3~n ) , i f we no t i ce t ha t
the re a r e at mos t n ine nonze ro e l emen t s i n eve ry row and co lum n o f B . Th i s bou nd ho lds
for X as wel l , beca use ent r ies of B2,2 have weigh ts a t mo st 3 . [ ]
S imi la r ly t o Theorem 27 , we can p rove the fo l lowing :
THEOREM 28.
The degrees o f a l l polynom ials f ~ F are O (n) .
7 Generating Ra ndo m Matchings In t h is s ec t ion we co ns ide r t he p rob lem o f gene r -
 
t he theo rem o f Kas t e l eyn [6 ], who sho wed how to com pu te t he num ber o f pe r f ec t ma tch -
ings in a p lana r g raph . S ince the reduc t ion used in t he p roo f o f Theo rem 11 ma in t a ins
the number o f pe r f ec t ma tch ings , we can a s sum e tha t ou r g raphs have deg ree bou nde d
by 3 .
7.1. Kastelyn Matrices. An or ienta t ion of a grap h G = (V, E) i s a d i rec ted grap h
Go = (V , E ' ) such that , for each e dge (u , v) ~ E, e xact ly one o f the edge s (u , v) ,
(v , u ) be longs to E .
The Kas te leyn matr ix K ( G o ) i s an adjac enc y matr ix o f the or ienta t ion G o def ined
as fo l lows:
1 i f ( u , v ) r E ,
K ( G o ) u , v = - -1 i f ( v , u ) r E ,
0 o therwise .
We denote by G (U) a subgra ph of G ind uced b y the se t of ver tices U _c V. Kas te leyn
proved the fo l lowing theo rem.
THEOREM 2 9. An orientation Go of a graph G such that fo r every V' c_ V,
det( K ( G o ( V') ) ) = ( of perfect matching s of G ( V ) ) 2
exists and can be fou nd in t ime linear in the size of the graph. The orientation G o is
called a pfaffian orientation of G.
7.2. The General Idea. The a lgo r i t hm fo r gene ra t ing pe r f ec t ma tch ings un i fo rm ly a t
r andom i s s imi l a r t o t he a lgo r i t hm fo r f i nd ing pe r fec t ma tch ings . The idea i s t o ma tch
separa tor ver t ices in such a way tha t the ran do m extens ion o f th is m atching wi l l g ive
a r andom ma tch ing . Le t M ( G ) be the num ber o f pe r f ec t ma tch ings con ta in ing M
as a submatch ing . We shou ld ma tch the s epa ra to r w i th a mach ing M wi th p robab i l i t y
M ( G ) / O ( G ) i n o rde r t o gene ra t e a pe r f ec t ma tch ing o f the wh o le g raph un i fo rm ly a t
random. The a lgor i thm is presented in Figure 6 .
I n t h e n e x t s u b s e c t i o n w e s h o w h o w t h e p r o c e d u r e G E N E R A T E - R A N D O M - S E P -
AR AT OR -M AT CH IN G can be imp lemen ted wi th O (n < /2) a r i thme t i c ope ra t ions . T he
matr ix (K (G o) -I)-r~T c a n b e c o m p u t e d w i t h O( n <~ ope ra t ions i n t he s ame way a s
in Sec t ion 4 .2 . Th i s g ives t he complex i ty bound o f O(n ~ ope ra t ions fo r t he who le
a lgor i thm as well .
GENERATE- RANDOM-PLANAR-PERFECT-MATCHING(G):
2. find pfaffian orientation Go of G;
3. let S be a small separator in G a nd let T be the correspon ding thick separator;
4. find (K(Go)- l ) r . r ;
5. using the GENER ATE-RAN DOM -SEPARAT OR-MAT CHINGprocedu re, find a matching M
incident on all vertices of S;
6. generate random perfect matchings in connected compon ents of G - V (M);
 
MATCH -SEPARATOR-VERTICES(M, X, p , q ) :
1 . i f q = p t h e n
match the pth vertex of the separator with one of i ts neighbors r with probabil i ty
(m U (p , r ) ) (G) / M(G ) ,
lazi ly el iminate the pth row and the r th column of X,
lazi ly el iminate the r th row and the pth column o f X,
r e t u r n
2. let m : -- I_(P + q) /2]
3. MATCH-SEPARATO R-VERTICES(M, X, p , m)
4. UPDA TE-AD JACEN T-VER TICES({m + 1 . . . . q}, {m + 1 . . . . n})
5. UPDATE-AD JACENT-VERTICES({q + 1 . . . . n}, {m + I . . . . . q})
6. MA TCH-SE PARA TOR-V ERTICE S(M, X, m + 1, q)
GENERATE-RANDO M-SEPARATOR-M ATCH ING((A- l ) r . r ) :
1 . M : = 0 ,
Fig. 7, An algorithm for random ly matching the separator.
7.3. Matching the Separator Ver t ices . W e n o w s h o w h o w t h e s e p a r a t o r v e r t i c e s c a n
b e m a t c h e d u s i n g a s l i g h tl y m o d i f i e d m a t c h i n g v e r i f ic a t i o n a l g o r i t h m . C o n s i d e r t h e
p r o c e d u r e p r e s e n t e d i n F ig u r e 7 .
T h e p r o c e d u r e U P D A T E - A D J A C E N T - V E R T I C E S ( p , q ) u p d a t e s t h e r o w s a n d c o l -
u m n s c o r r e s p o n d i n g t o t h e v e r t i c es o f S in th e r a n g e p . . . . . q a n d t o a l l n e i g h b o u r s
o f t h e s e v e rt i c es . L e t u s c o m p a r e t h e a l g o r i t h m w i t h t h e E L I M I N A T E p r o c e d u r e f r o m
Sec t i on 2 .4 . Each ve r t ex can have a t mos t t h r ee ne ig hbou r s . Thus t he s i z e o f the ma t r i c e s
i n u p d a t e s i n c r e a se s fo u r t i m e s c o m p a r e d w i t h A l g o r i t h m E L I M I N A T E f r o m S e c t i o n 2 . 4
a n d s o t h e a b o v e a l g o r i t h m w o r k s i n 0 (n C~ a r i t h m e t i c o p e r a t io n s . T h i s u p d a t i n g s c h e m e
g u a r a n t e e s t h at th e p t h a n d th e r t h r o w s a n d c o l u m n s a r e c o m p u t e d e x p l i c i t l y b e f o r e
l a z y e l i m i n a t i o n .
T h e l a s t r e m a i n i n g p r o b l e m i s h o w t o c o m p u t e t h e p r o b a b l i t y ( M U ( p , r ) ) ( G ) /
M ( G ) . F r o m t h e K a s t e l e y n t h e o r e m w e g e t
( ( M U ( p , r ) ) ( G ) ) z
( M ( G ) ) 2
d e t ( K ( G o ( V - V ( M ) - {p , r } ) ) )
d e t ( K ( G o ( V - V ( M ) ) ) )
T h e f o l l o w i n g l e m m a s h o w s h o w t h i s c a n b e c o m p u t e d .
LEMMA 30. Be fore ma tch ing the p th ve r t ex we have
d e t ( K ( G o ( V - V ( M ) - {p , r}) ) ) - I l l
= (A )p ,p(A )r ,r - (A - l )p ,r (A - ) r,p.
d e t ( K ( G o ( V - V ( M ) ) ) )
PROOF. I f we pe rmu te t he p th and r t h row to t he l e f t s i de o f t he ma t r i x and t he r t h and
 
Maximu m Matchings in Planar Graphs via Gaussian Elimination 19
w i l l b e o f t h e f o r m
A-l)p,r
A - l ) p , p
A - l ) r , p
N o t i c e t h a t th i s m a t r i x i s e x a c t l y t h e i n v e r s e o f th e m a t r i x
K G o V - V M ) ) ) .
T h i s
f o l l o w s f r o m T h e o r e m 7 . A f t e r th e e l i m i n a t i o n o f t he f ir st t w o r o w s a n d c o l u m n s w e
o b t a i n
i A l )r ,p - - A - 1 ) P , o A - l ) r , r / A - 1 ) p , r ) t ~ - I )TSp ,F ,T-P , r .
T h e m a t r i x ^ 1
A )T -p , r , r -p , r
i s t h e i n v e r s e o f t h e m a t r i x
K G o V - V M ) - { p ,
r } ) ) .
T h e e l i m i n a t i o n d o e s n o t c h a n g e t h e d e t e r m i n a n t o f th e m a t r i x a n d s o w e g e t
d e t ( A ~ , ~ ) = d e t A - l ) T _ p , r , T _ p , r A 1 ) p ,p A - l )r , r - A - l ) r , p A - l ) p , r ) ,
a n d s o
( d e t K G o V - V ( M ) ) ) ) - l
1 1 1 1 1
- - d e t K G o V V M ) - { p , r } ) ) ) A ) p, p A )r,r
- - - A
)r,p A )p,r). []
A c k n o w l e d g e m e n t s . T h e a u t h o rs t h a n k t h e ir f a v o u ri t e s u p e r v i s o r K r z y s z t o f D i k s f o r
n u m e r o u s u s e f u l d i s c u s s i o n s .
R e f e r e n c e s
[1] Blum, N.: A new approach to maximu m matching in general graphs. In:
Proc. 17th ICALP,
443 of LNCS, Springer-Verlag, Berlin, 1990, pp. 586-597.
[2] Bunch, J., Hopcroft, J.: Triangular factorization and inversion by fast matrix multiplication. Math.
Comp.
of the Nineteenth Annual ACM Conference on Theory of Computing,
ACM Press, New York, 1987,
pp. I-6.
Canad. J. Math,
17 (1965), 449-467.
[5] Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for general graph matching problems.
J. ACM
(1991), 815-853.
[6] Ha rar y, F., editor: Graph Theory and Theoretical Physics. Academ ic Press, Ne w York, 1967.
1992.
[8] Klein, P., Rao, S., Rauch, M,, Subraman ian, S.: Faster shortest-path algorithms fo r planar graphs. In:
Proceedings of the Twenty-Sixth Annual AC M Symposium on Theory of Computing,
ACM Press, New
[9] Kowalewski, G.:
Leipz ig Verlag von Veit Co, Leipzig,
1909.
20 M. Much a and E Sankowski
[10] Lipton, R.J., Rose, D.J,, Tarjan, R,: Gene ralized nested dissection . SIAM J. Numer Anal. 16 1979),
346-358.
[11] Lipton, R.J., Tarjan, R.E.: A separator theo rem for planar graphs.
SIAM J. Appl. Math.
177-189.
[12] Lipton, R.J., Tarjan, R.E.: Applica tions of a planar sep ~a to r theorem . SIAM J. Comput. 9 1980),
615~527.
[13] Lov~isz, L.: On determinants, matchings and random algorithm s. In Budach, L., ed.: Fundamentals of
Computation Theory Akadem ie-Verlag, Berlin, 1979, pp. 565-574 .
[14] Micali , S. , Vazirani, V.V.: An o ~ l e l) algori thm for f inding maxim um matching in general graphs.
In: Proceedings of the Twen~-First Annual IEEE Symposium on Foundations of Computer Science
1980, pp. 17-27.
[15] Miller, G.L., Naor, J.: F low in planar graphs with multiple sources and sinks. In:
Proceedings of the
30th IEEE Symposium on Foundations of Computer Science 1989, pp. 112-117.
[16] Mucha, M., Sankow ski, E: M axim um matchin gs via gaussian eliminatio n. In: Proceedings of the 45th
Annual IEEE Symposium on Foundations of Computer Science 2004, pp. 248-255.
[17] Pan, V.Y.,Reif, J.H.: Fast and efficient parallel solution of sparse linear system s. SIAMJ. Comput. 22
1993), 1227-1250.
[18] Rabin, M.O., Vazirani, V.V.: Max imu m matchin gs in general graphs throug h random ization. J. Algo-
rithms 10 1989), 557-567.
[19] Schwartz, J.: Fast probabilistic algorithm s for verification of polyn omia l identities. J. ACM 27 1980),
701-717.
[20] Strassen, V.: Gaussian elimination is not optima l. Numer. Math. 13 1969), 354-3 56.
[21] Tutte, W.T.: The factorization of linear graphs. J. London Math. Soc. 22 1947), 107-111.
[22] Wilson, D.B.: Determin ant algorithm s for random planar structures. In: Proceedings of the Eighth
Annual ACM-SIAM Symposium on Discrete Algorithms Society for Industr ial and Applied Mathe-
matics, Philadelphia, PA, 1997, pp. 258 -267.