5
Information Processing Letters 76 (2000) 13–17 Parallel approximation algorithms for maximum weighted matching in general graphs Ryuhei Uehara a,* , Zhi-Zhong Chen b a Komazawa University, Faculty ofNatural Sciences, Komazawa 1-23-1, Setagaya-ku, Tokyo 154-8525, Japan b Department ofMathematical Sciences, Tokyo Denki University, Tokyo, Japan Received 21 February 2000; received in revised form 15 July 2000 Communicated by K. Iwama Abstract The problem of computing a matching of maximum weight in a given edge-weighted graph is not known to be P-hard or in RNC. This paper presents two parallel approximation algorithms for this problem. The first is an RNC-approximation scheme, i.e., an RNC algorithm that computes a matching of weight at least 1 - ε times the maximum for any fixed constant ε> 0. The other is an NC approximation algorithm achieving an approximation ratio of 1/(2 + ε) for any fixed constant ε> 0. 2000 Elsevier Science B.V. All rights reserved. Keywords: Graph algorithms; Maximum weighted matching; Approximation algorithms; Parallel algorithms 1. Introduction Throughout this paper, a graph means an edge- weighted graph, unless explicitly specified otherwise. A matching in a graph G is a set M of edges in G such that no two edges in M share an endpoint. The weight of a matching M is the total weight of the edges in M. The maximum weighted matching (MWM) problem is to find a matching of maximum weight of a given graph. The maximum cardinality matching (MCM) problem is the special case of the MWM problem where all edges of the input graph have the same weight. For the MWM problem, Edmonds’ algorithm [2] has stood as one of the paradigms in the search of * Corresponding author. E-mail addresses: [email protected] (R. Uehara), [email protected] (Z.-Z. Chen). polynomial-time algorithms for integer programming problems (see also [5]). Some sophisticated imple- mentations of his algorithm have improved its time complexity: for example, Gabow [4] has given an al- gorithm using O(n(m + n log n)) time and O(m) space. The parallel complexity of the MWM problem is still open; Galil asks if the MWM problem is P-com- plete [5]. The best known lower bound is the CC-hard- ness result pointed out in [6] (see [12] for the definition of the class CC). On the other hand, the best known upper bound is the RNC algorithm of Karp, Upfal, and Wigderson [10] for the special case where the weights on the edges of the input graph G are bounded from above by a fixed polynomial in the number of vertices in G. We call this case the polynomial-weight case of the MWM problem. From the practical point of view, Edmonds’ algo- rithm is too slow. Faster algorithms are required, and heuristic algorithms and approximation algorithms 0020-0190/00/$ – see front matter 2000 Elsevier Science B.V. All rights reserved. PII:S0020-0190(00)00128-9

Parallel approximation algorithms for maximum weighted matching in general graphs

Embed Size (px)

Citation preview

Page 1: Parallel approximation algorithms for maximum weighted matching in general graphs

Information Processing Letters 76 (2000) 13–17

Parallel approximation algorithms for maximum weightedmatching in general graphs

Ryuhei Ueharaa,∗, Zhi-Zhong Chenba Komazawa University, Faculty of Natural Sciences, Komazawa 1-23-1, Setagaya-ku, Tokyo 154-8525, Japan

b Department of Mathematical Sciences, Tokyo Denki University, Tokyo, Japan

Received 21 February 2000; received in revised form 15 July 2000Communicated by K. Iwama

Abstract

The problem of computing a matching of maximum weight in a given edge-weighted graph is not known to be P-hard or inRNC. This paper presents two parallel approximation algorithms for this problem. The first is an RNC-approximation scheme,i.e., an RNC algorithm that computes a matching of weight at least 1− ε times the maximum for any fixed constantε > 0. Theother is an NC approximation algorithm achieving an approximation ratio of 1/(2+ ε) for any fixed constantε > 0. 2000Elsevier Science B.V. All rights reserved.

Keywords:Graph algorithms; Maximum weighted matching; Approximation algorithms; Parallel algorithms

1. Introduction

Throughout this paper, a graph means an edge-weighted graph, unless explicitly specified otherwise.A matching in a graphG is a setM of edges inG such that no two edges inM share an endpoint.The weight of a matchingM is the total weight ofthe edges inM. The maximum weighted matching(MWM) problem is to find a matching of maximumweight of a given graph. Themaximum cardinalitymatching(MCM) problem is the special case of theMWM problem where all edges of the input graphhave the same weight.

For the MWM problem, Edmonds’ algorithm [2]has stood as one of the paradigms in the search of

* Corresponding author.E-mail addresses:[email protected] (R. Uehara),

[email protected] (Z.-Z. Chen).

polynomial-time algorithms for integer programmingproblems (see also [5]). Some sophisticated imple-mentations of his algorithm have improved its timecomplexity: for example, Gabow [4] has given an al-gorithm using O(n(m+n logn)) time and O(m) space.

The parallel complexity of the MWM problem isstill open; Galil asks if the MWM problem is P-com-plete [5]. The best known lower bound is the CC-hard-ness result pointed out in [6] (see [12] for the definitionof the class CC). On the other hand, the best knownupper bound is the RNC algorithm of Karp, Upfal, andWigderson [10] for the special case where the weightson the edges of the input graphG are bounded fromabove by a fixed polynomial in the number of verticesin G. We call this case thepolynomial-weight caseofthe MWM problem.

From the practical point of view, Edmonds’ algo-rithm is too slow. Faster algorithms are required, andheuristic algorithms and approximation algorithms

0020-0190/00/$ – see front matter 2000 Elsevier Science B.V. All rights reserved.PII: S0020-0190(00)00128-9

Page 2: Parallel approximation algorithms for maximum weighted matching in general graphs

14 R. Uehara, Z.-Z. Chen / Information Processing Letters 76 (2000) 13–17

have been widely investigated. A survey of heuristicalgorithms can be found in [1], and some approxi-mation algorithms can be found in [14]. In particu-lar, a 1

2-approximation algorithm can be obtained bya greedy strategy that picks up the heaviest edgee anddeletese and its incident edges, and repeats this untilthe given graph becomes empty. Recently, Preis [13]gave a linear-time implementation of this greedy algo-rithm.

For the MCM problem, several NC approximationalgorithms are known (see [11] for comprehensivereference). In particular, Fischer et al. [3] showedan NC algorithm that computes a matching withcardinality at least 1− ε times the maximum forany fixed constantε > 0. This NC approximationalgorithm is based on essential properties of the MCMproblem that do not belong to the MWM problem.

Our first result is an RNC approximation schemefor the MWM problem, i.e., an RNC algorithm whichcomputes a matching of weight at least 1− ε times themaximum for any fixed constantε > 0. This schemeuses the RNC algorithm for the polynomial-weightcase of the MWM problem due to Karp et al. as asubroutine.

Our second result is an NC approximation algo-rithm for the MWM problem. This algorithm can beviewed as a parallelized version of the greedy strategy.For any fixed constantε > 0, this algorithm computesa matching of weight at least 1/(2+ ε) times the max-imum. The work done by the algorithm is optimal upto a polylogarithmic factor.

2. Preliminaries

We will deal only with graphs without loops ormultiple edges. LetG be a graph. For each edgee ofG, wG(e) denotes the weight ofe in G. We assumethat each weight is positive. For a subsetF of edges ofG, wG(F) denotes the total weight of the edges inF ,i.e.,

wG(F)=∑e∈F

wG(e).

A maximal matchingof G is a matching ofGthat is not properly contained in another matching.A maximum weighted matchingof G is a matchingwhose weight is maximized over all matchings ofG.

Note that a maximum weighted matching must bemaximal.

The model of parallel computation used here is theCRCW ARBITRARY PRAM where the processorsoperate synchronously and share a common memory,both simultaneous reading and simultaneous writingto the same cell are allowed; in case of simultane-ous writing, we do not care which processor actu-ally writes. An NCalgorithm (respectively, RNCal-gorithm) is one that can be implemented to run in poly-logarithmic time (respectively, expected polylogarith-mic time) using a polynomial number of processors onan CRCW ARBITRARY PRAM. More details aboutthe model, NC algorithms and RNC algorithms can befound in [8,9].

An algorithmA for the MWM problemachievesa ratio of ρ if for every graphG, the matchingMfound byA on inputG has weight at leastρ ·wG(M∗),whereM∗ is a maximum weighted matching ofG. AnRNC approximation schemefor the MWM problemis a family {Ai : i > 2} of algorithms such that forany fixed integeri > 2,Ai is an RNC algorithm andachieves a ratio of 1− 1/i.

3. Approximation algorithms

3.1. Common preprocess

Throughout the rest of this paper, letG be the inputgraph,M∗ be a maximum weighted matching ofG,andn andm be the number of vertices and edges inG, respectively. Letwmax be the maximum weight ofan edge inG. Let k be a fixed positive integer andσbe a fixed positive rational constant with 1> σ > 0;the actual values ofk andσ will become clear later.

For each edgee of G, we define an integerr(e) asfollows:• If (kn/wmax) ·wG(e)6 1, then letr(e)= 0.• Otherwise, letr(e) be the smallest integeri such

that(kn/wmax) ·wG(e)6 (1+ σ)i .We callr(e) therank of e. Note thatr(e) ∈ {0,1, . . . ,dlog1+σ kne}.

Let Ei be the set of edges ofG with rank i. LetM∗i =M∗ ∩ Ei . The following lemma shows that thetotal weight of edges inM∗0 is significantly small.

Lemma 1.∑e∈M∗0 wG(e)6

12kwG(M

∗).

Page 3: Parallel approximation algorithms for maximum weighted matching in general graphs

R. Uehara, Z.-Z. Chen / Information Processing Letters 76 (2000) 13–17 15

Proof. For each edgee ∈ E0, wG(e) 6 wmax/kn.Thus,∑e∈M∗0

wG(e)6n

2

wmax

kn= wmax

2k6 1

2kwG(M

∗). 2

LetG′ be the graph obtained fromG by deleting alledges of rank 0 and modifying the weight of each restedgee to be(1+ σ)r(e).3.2. RNCapproximation scheme

In this section, we present the RNC approximationscheme for the MWM problem. It is based on thefollowing result due to Karp et al.

Lemma 2 [10]. There is anRNC algorithm for thepolynomial-weight case of the MWM problem.

Theorem 3. There exists anRNC approximationscheme for the MWM problem.

Proof. Let ` be an integer larger than 1. Suppose wewant to compute a matchingM of G with wG(M) >(1− 1/`) · wG(M∗). Then, we fixσ = 1/` andk =d`2/2e, and constructG′ as in Section 3.1. Note thatthe weight of each edge ofG′ is polynomial inn. So,we use the RNC algorithm in Lemma 2 to computea maximum weighted matchingM ′ of G′. Note thatM ′ is also a matching ofG. It remains to show thatwG(M

′)> (1− 1/`)wG(M∗).For eachi > 1, letM ′i =M ′ ∩ Ei . SinceM ′ is a

maximum weighted matching ofG′ and⋃i>1M

∗i is

a matching ofG′, we have∑i>1

∑e∈M∗i

wG′(e) 6 wG′(M′)

=∑i>1

∑e∈M ′i

wG′(e)

=∑i>1

∣∣M ′i∣∣(1+ σ)i.On the other hand, sinceM∗ is a maximum weighted

matching ofG, we have

wG(M∗) >

∑i>1

∑e∈M ′i

wG(e)

>∑i>1

∣∣M ′i ∣∣wmax

kn(1+ σ)i−1

since(wmax/kn)(1+ σ)i−1 < wG(e) if e ∈M ′i withi > 1.

Thus,

wG(M′) =

∑i>1

∑e∈M ′i

wG(e)

> wmax

kn·∑i>1 |M ′i |(1+ σ)i(1+ σ)

> wmax

kn(1+ σ)∑i>1

∑e∈M∗i

wG′(e)

> wmax

kn(1+ σ)∑i>1

∑e∈M∗i

kn

wmaxwG(e)

= wG(M∗ −M∗0)

1+ σ .

Now, by Lemma 1,

wG(M′) >

wG(M∗ −M∗0)

1+ σ> 1

1+ σ(

1− 1

2k

)wG(M

∗).

Clearly, 11+σ (1− 1

2k ) > 1− 1/`. This completes theproof. 23.3. NC algorithm

In this section, we parallelize the greedy algorithmto obtain an NC approximation algorithm for theMWM problem that achieves a ratio of 1/(2+ ε) forany fixedε > 0.

The NC approximation algorithm will work ongraphG′ defined in Section 3.1. Recall that eachedgee of G′ inherits a rankr(e) from G. Let ` =dlog1+σ kne. The highest rank is̀ . The algorithmworks as follows:

NC Algorithm

1. For eachi = `, `− 1, . . . ,1, perform the followingsteps:1.1. Find a maximal matchingMi inG′i = (V ,Fi),

whereFi is the set of edges ofG′ with ranki.1.2. Remove all edgese fromG′ such thate ∈Mi

or e is incident to an endpoint of an edge inMi .

2. Output⋃

16i6`Mi .

Page 4: Parallel approximation algorithms for maximum weighted matching in general graphs

16 R. Uehara, Z.-Z. Chen / Information Processing Letters 76 (2000) 13–17

Let M =⋃16i6`Mi . By steps 1.1 and 1.2,M isclearly a maximal matching ofG′.

Lemma 4. wG(M)> 12(1+σ)wG(M

∗ −M∗0).

Proof. The idea is to distribute the weights of alledges ofM∗ −M∗0 to the edges ofM. Lete be an edgein M∗ −M∗0 . Let i = r(e). We distribute the weightwG(e) of e as follows:(1) e ∈Mi . Then, we distributewG(e) to e itself.(2) e /∈Mi but one or both endpoints ofe are incident

to an edge ofMi . Then, we distributewG(e) to anarbitrary edgee′ ∈Mi such thate ande′ share anendpoint. Note that

1

1+ σ 6wG(e)

wG(e′)6 1+ σ.

(3) Cases (1) and (2) do not occur. Then, by thealgorithm,e must share an endpoint with at leastone edgee′ ∈Mj such thatj > i. We distributewG(e) to an arbitrary such edgee′. Note thatwG(e)6 (1+ σ)i 6 (1+ σ)j−1<wG(e

′).Consider an edgee′ ∈ M. Since M∗ − M∗0 is amatching, at most two edgese ∈ M∗ − M∗0 candistribute their weights toe′. Moreover, by cases (1)through (3), the total weight newly distributed toe′ isat most 2(1+ σ)wG(e′). Thus,∑e′∈M

2(1+ σ)wG(e′)>wG(M∗ −M∗0

).

Consequently,

wG(M)>1

2(1+ σ)wG(M∗ −M∗0

). 2

Thus we have the following theorem.

Theorem 5. There is anNC approximation algo-rithm for the MWM problem that achieves a ratio of1/(2+ ε) for any fixedε > 0. It runs inO(log4n) timeusingn+m processors on the CRCW PRAM.

Proof. Fix a positive rational constantε. Suppose wewant to compute a matchingM of G with

wG(M)>1

2+ ε ·wG(M∗).

Then, we fixσ = ε/3 andk = d3/ε + 1.5e, constructG′ as in Section 3.1, and run the above NC algorithm

on inputG′ to obtain a matchingM. By Lemmas 1and 4,

wG(M) >1

2(1+ σ)(

1− 1

2k

)·wG(M∗)

> 1

2+ ε ·wG(M∗).

We next analyze the complexity needed to com-puteM. G′ can be constructed fromG in O(1) timeusing n + m processors.M can be computed fromG′ in O(log1+σ (kn) · (logn + T (n,m))) time us-ing max{n + m,P(n,m)} processors on the CRCWPRAM, provided that a maximal matching of a givenn-vertexm-edge graph can be computed inT (n,m)usingP(n,m) processors on the CRCW PRAM. Ac-cording to [7],T (n,m) = O(log3n) andP(n,m) =n+m. So,M can be computed in O(log4n) time us-ing n+m processors on the CRCW PRAM.2

References

[1] D. Avis, A survey of heuristics for the weighted matchingproblem, Networks 13 (1983) 475–493.

[2] J. Edmonds, Paths, trees and flowers, Canad. J. Math. 17(1965) 449–467.

[3] T. Fischer, A.V. Goldberg, D.J. Haglin, S. Plotkin, Approxi-mating matchings in parallel, Inform. Process. Lett. 46 (1993)115–118.

[4] H.N. Gabow, Data structures for weighted matching andnearest common ancestors with linking, in: Proc. 1st Ann.ACM-SIAM Symp. on Discrete Algorithms, 1990, pp. 434–443.

[5] Z. Galil, Efficient algorithms for finding maximum matchingin graphs, Comput. Surveys 18 (1) (1986) 23–38.

[6] R. Greenlaw, H.J. Hoover, W.L. Ruzzo, Limits to ParallelComputation, Oxford University Press, 1995.

[7] A. Israeli, Y. Shiloach, An improved parallel algorithm formaximal matching, Inform. Process. Lett. 22 (1986) 57–60.

[8] D.S. Johnson, A catalog of complexity classes, in: J. vanLeeuwen (Ed.), The Handbook of Theoretical Computer Sci-ence, Vol. I: Algorithms and Complexity, Elsevier, Amster-dam, 1990, pp. 69–161.

[9] R.M. Karp, V. Ramachandran, Parallel algorithms for shared-memory machines, in: J. van Leeuwen (Ed.), The Handbookof Theoretical Computer Science, Vol. I: Algorithms andComplexity, Elsevier, Amsterdam, 1990, pp. 870–941.

[10] R.M. Karp, E. Upfal, A. Wigderson, Constructing a perfectmatching is in random NC, Combinatorica 6 (1) (1986) 35–48.

[11] M. Karpinski, W. Rytter, Fast Parallel Algorithms for GraphMatching Problems, Clarendon Press, Oxford, 1998.

Page 5: Parallel approximation algorithms for maximum weighted matching in general graphs

R. Uehara, Z.-Z. Chen / Information Processing Letters 76 (2000) 13–17 17

[12] E.W. Mayr, A. Subramanian, The complexity of circuit valueand network stability, J. of Comput. System Sci. 44 (1992)302–323.

[13] R. Preis, Linear time12-approximation algorithm for maxi-

mum weighted matching in general graphs, in: STACS ’99,

Lecture Notes in Comput. Sci., Vol. 1563, Springer, Berlin,1999, pp. 259–269.

[14] S.M. Venkatesan, Approximation algorithms for weightedmatching, Theoret. Comput. Sci. 54 (1987) 129–137.