Linear Time Approximation Algorithms for Degree Constrained

17
Linear Time Approximation Algorithms for Degree Constrained Subgraph Problems Stefan Hougardy Research Institute for Discrete Mathematics University of Bonn Lenn´ estr. 2 53113 Bonn, Germany [email protected] Abstract. Many real-world problems require graphs of such large size that polynomial time algorithms are too costly as soon as their runtime is superlinear. Examples include problems in VLSI-design or problems in bioinformatics. For such problems the question arises: What is the best solution that can be obtained in linear time? We survey linear time ap- proximation algorithms for some classical problems from combinatorial op- timization, e.g. matchings and branchings. Keywords. linear time algorithm, approximation algorithm, combinatorial optimization, matching algorithm, degree constrained subgraph problem 1 Introduction For many combinatorial optimization problems arising from real world appli- cations, efficient, i.e., polynomial time algorithms are known for computing an optimum solution. However, there exist several applications for which the input size can easily exceed 10 9 . In such cases polynomial time algorithms with a runtime that is quadratic or even higher are much too slow. It is there- fore desirable to have faster algorithms that not necessarily find an optimum solution. An approximation algorithm for a combinatorial optimization problem is an algorithm that for any possible input returns some feasible solution. An approximation algorithm has an approximation ratio of c if for any input it This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Transcript of Linear Time Approximation Algorithms for Degree Constrained

Page 1: Linear Time Approximation Algorithms for Degree Constrained

Linear Time Approximation Algorithms for

Degree Constrained Subgraph Problems

Stefan Hougardy

Research Institute for Discrete MathematicsUniversity of BonnLennestr. 253113 Bonn, Germany

[email protected]

Abstract. Many real-world problems require graphs of such large sizethat polynomial time algorithms are too costly as soon as their runtimeis superlinear. Examples include problems in VLSI-design or problems inbioinformatics. For such problems the question arises: What is the bestsolution that can be obtained in linear time? We survey linear time ap-proximation algorithms for some classical problems from combinatorial op-timization, e.g. matchings and branchings.

Keywords. linear time algorithm, approximation algorithm, combinatorialoptimization, matching algorithm, degree constrained subgraph problem

1 Introduction

For many combinatorial optimization problems arising from real world appli-cations, efficient, i.e., polynomial time algorithms are known for computingan optimum solution. However, there exist several applications for which theinput size can easily exceed 109. In such cases polynomial time algorithmswith a runtime that is quadratic or even higher are much too slow. It is there-fore desirable to have faster algorithms that not necessarily find an optimumsolution.

An approximation algorithm for a combinatorial optimization problem isan algorithm that for any possible input returns some feasible solution. Anapproximation algorithm has an approximation ratio of c if for any input it

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 2: Linear Time Approximation Algorithms for Degree Constrained

2 Stefan Hougardy

returns a solution with value at least c times the value of an optimum solution(in this paper we will consider maximization problems only).

For most reasonable problems the lowest possible runtime for a determinis-tic algorithm is linear, as at least the whole input must be read. In this paperwe are interested in approximation algorithms that achieve this linear run-time. Moreover, we are interested here only in approximation algorithms thatachieve a constant approximation ratio. The reason for the latter requirementis that in practice solutions that are far away from an optimum solution arequite useless. Thus, even an approximation ratio of 1/2 may be too bad for agiven application. However, as the approximation ratio is a guarantee for theworst case, in practice approximation algorithms with constant approxima-tion ratios usually deliver solutions that are very close to the optimum. Forexample the greedy algorithm for the Maximum Weight Matching Prob-

lem has an approximation ratio of 1/2 but its solutions are usually within 5%of the optimum solution [10].

Linear time approximation algorithms offer several benefits against exactalgorithms.

1. The most obvious benefit is its runtime: Exact algorithms even if theirruntime is polynomial may simply be too slow to be applicable.

2. Linear time approximation algorithms are usually simpler than their exactcounterparts. This not only means that the algorithms are simpler, butalso their proofs of correctness may be simpler.

3. The implementation of linear time approximation algorithms can be muchsimpler than for exact algorithms. This is the main reason why in manyapplications approximation algorithms are used, even though exact algo-rithms would be fast enough (see for example [2]).

4. There is another major reason, why in many applications approximationalgorithms are used for combinatorial optimization problems even thoughexact algorithms would be fast enough: If the algorithm is used as a sub-routine in some heuristic that does not give any performance guarantee,it may be a waste of time to compute exact solutions. In some cases onemight even observe the weird effect that an exact solution yields resultsthat are inferior to approximate solutions.

5. Finally, approximation algorithms can avoid problems with floating pointarithmetic. In [1] such a problem is analyzed for the maximum flow prob-lem using a preflow-push algorithm. These unexpected difficulties mayalways occur when using floating point arithmetic in exact algorithms.

Of course, an algorithm with linear runtime may turn out to be completelyuseless in practice. A famous such example is the algorithm of Bodlaender [7]for determining the treewidth of a graph. More precisely, if k is fixed, thenfor a given graph G the algorithm of Bodlaender finds in linear time a treedecomposition of width at most k, or decides that the treewidth of G exceedsk. A huge constant is involved in the linear runtime of Bodlaenders algorithm.Therefore, this algorithm is not feasible in practice, even not for k = 4.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 3: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 3

All linear time algorithms that we present in this paper have constants intheir runtime that are small, which means that they are at least not larger thanthe constants involved in the runtime of exact algorithms for the problem.

In this survey we will cover linear time deterministic algorithms only. Thereare related subjects as for example nearly linear time algorithms, sublineartime algorithms, or linear time randomized algorithms which we will not dis-cuss in this paper. In the following the notion linear time algorithm alwaysmeans a deterministic linear time algorithm.

1.1 A Technique for Obtaining Linear Runtime

There exists one general approach for obtaining linear time approximationalgorithms for combinatorial optimization problems. Several exact algorithmsfor these problems work in phases , where each phase has linear runtime. Ex-amples are the matching algorithm of Micali and Vazirani [35] which needsO(

√n) phases, each phase can be accomplished in O(m), or the algorithm of

Ford and Fulkerson [17] for computing a flow of maximum value, where ineach phase one flow augmenting path is computed in O(m).

A simple way to turn such algorithms into linear time approximation algo-rithms is to simply stop after executing a constant number of phases. We willcall this approach the phase bounding approach. This approach clearly resultsin linear time approximation algorithms, however, it is not at all clear whatapproximation ratio it achieves. One can prove for example (see below) thatthe phase bounding approach applied to the matching algorithm of Micali andVazirani [35] achieves an approximation ratio, that can be arbitrarily close to1. However, the phase bounding approach applied to Ford and Fulkerson’smaximum flow algorithm cannot guarantee any constant approximation ratiolarger than 0.

The phase bounding approach while it can produce linear time approxima-tion algorithms with constant approximation ratio misses one of the advan-tages that we listed above, namely to be much simpler than exact algorithms.Nevertheless, in cases where no other approach is known to yield similar re-sults we do at least know what approximation ratio can be achieved in lineartime. Such a result should be considered as a stimulation to look for simpleralgorithms that do not use the phase bounding approach.

2 Matchings

A matching M in a graph G = (V, E) is a subset of the edges of G such thatno two edges in M are incident to the same vertex. A perfect matching in Gis a matching M such that each vertex of G is contained in an edge of M .Computing a (perfect) matching that is optimal with respect to certain sideconstraints is one of the fundamental problems in combinatorial optimization.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 4: Linear Time Approximation Algorithms for Degree Constrained

4 Stefan Hougardy

The first polynomial time matching algorithms date back to the papers ofKonig and Egervary from 1931 [18] which resulted in the famous HungarianMethod for bipartite graphs due to Kuhn [32]. A major breakthrough wasEdmonds’ polynomial time algorithm for the Maximum Weight Matching

Problem [13]. Edmonds introduced in his paper for the first time the notionof a ’good’ algorithm which led to the definition of the class P of polynomiallytime solvable problems.

Given a matching M in a graph G = (V, E), we say that a vertex x ismatched if {x, y} ∈ M for some y ∈ V and free otherwise. An M -augmenting

path is a simple path P = v0, v1, . . . , vk such that the endpoints v0 and vk

are free, {vi, vi+1} ∈ E(G) and the edges of P are alternately in E(G) \ Mand M . The length of a path is defined as the number of edges containedin it. As the endpoints of an augmenting path are free this implies that anaugmenting path has odd length. Given an augmenting path, one can augmentthe matching M by deleting from M the edges on the path that are in M , andadding all of the other edges on the path to M . This results in a matchingwith one more edge. A well known result that is the basis of many matchingalgorithms says that the absence of an augmenting path implies optimalityof the current matching. This result was proved by Petersen [38] in 1891 andfirst formulated in the language of modern graph theory by Berge [4].

Theorem 1 ([38][4]). A matching M has maximum size if and only if there

exists no M -augmenting path. �

2.1 Maximum Cardinality Matchings

The maximum cardinality matching problem simply asks for a matching ofmaximum size in an unweighted undirected graph. As a special case it containsthe question whether a given graph has a perfect matching.

Cardinality Matching Problem

Input: An undirected graph G.

Output: A maximum cardinality matching in G.

The fastest known deterministic algorithm for the Cardinality Match-

ing Problem is due to Goldberg and Karzanov [25] and has runtimeO(

√nm log(n2/m)/ logn) (see also [19]). It makes use of graph compression

techniques that have been developed by Feder and Motwani [15]. For densegraphs Mucha and Sankowski [37] presented a faster randomized algorithmwhich has been simplified by Harvey [26].

We will show that the phase bounding approach can be used to get a lineartime approximation algorithm for the Cardinality Matching Problem

with approximation ratio arbitrarily close to 1. The next lemma is the key toprove such a result. It says that if a matching does not admit short augmentingpaths then its cardinality must be close to the cardinality of a maximum

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 5: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 5

cardinality matching. This result is due to Hopcroft and Karp [28] but hasbeen rediscovered several times, e.g., [16] or [27].

Lemma 1 ([28]). If M is a matching in a graph G such that every M -

augmenting path has length at least 2k − 1 then

|M | ≥ k − 1

k· |M∗|,

where M∗ denotes a maximum cardinality matching in G.

Proof. Suppose the matching M does not admit augmenting paths of lengthless than k. Consider the symmetric difference between M and M∗. It contains|M∗| − |M | vertex disjoint M -augmenting paths. Since each of these pathscontains at least k − 1 edges of M, we have

|M | ≥ k − 1

k· |M∗|.

For the phase bounding approach one can make use of the maximum car-dinality matching algorithm due to Micali and Vazirani [35], see also [42, 5]and [23]. Their algorithm constructs in each phase a maximal set of vertexdisjoint augmenting paths. Each phase can be implemented in O(m) time.The size of the shortest augmenting path strictly increases from a phase tothe next. Thus, by applying Lemma 1 one gets the following result which wasfirst observed by Gabow and Tarjan [22].

Theorem 2 ([22]). For every fixed ǫ > 0 there exists an algorithm that com-

putes a matching of size at least (1 − ǫ) · |M∗| in linear time. �

The number of phases needed to obtain a maximum cardinality matchingis O(

√n). One can easily construct instances where this number of phases is

needed. In practice it turns out that usually a much fewer number of phasessuffices to find a maximum cardinality matching in a graph. This observationcan be proved for certain graph instances rigorously. A first such result isdue to Motwani [36]. It has been improved by Bast, Mehlhorn, Schafer, andTamaki [3] who proved the following statement.

Theorem 3 ([3]). In Gn, 33

n

the algorithm of Micali and Vazirani terminates

with high probability after O(log n) phases. �

Here, Gn, 33

n

denotes a random graph on n vertices where each edge is in

the graph with probability 33n .

Theorem 2 shows that one can find in linear time a matching whose cardi-nality is arbitrarily close to the cardinality of a maximum cardinality match-ing. However, as we used the phase bounding approach to get this result, thealgorithm is not simpler than the exact one. Therefore we will consider herealternative approaches to compute large matchings in linear time.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 6: Linear Time Approximation Algorithms for Degree Constrained

6 Stefan Hougardy

One such approach is to simply compute a maximal matching. A matchingM is called maximal if for all e ∈ E(G)\M the set M ∪{e} is not a matching.For maximal matchings we get the following simple result in the special casek = 2 of Lemma 1.

Lemma 2. If M is a maximal matching and M∗ a maximum cardinality

matching then |M | ≥ 12 · |M∗|. �

Fig. 1. An example where a maximum matching is twice as large as a maximalmatching (bold edges).

Maximal matchings can easily be computed in linear time: start withM = ∅ and for each e ∈ E(G) add e to M if both endpoints of e are free.Therefore, Lemma 2 immediately implies a very simple linear time approxi-mation algorithm for the Cardinality Matching Problem with approxi-mation ratio 1/2. It is easily seen that this approximation ratio is tight (seeFigure 1).

Figure 1 suggest that it should be a good idea to consider the degreeswhen computing a maximal matching: First sort in linear time the verticesin increasing order by their degrees and then compute a maximal matchingby choosing as the next edge one that is incident to a vertex of currentlylowest degree. This approach is often used in practice [30] and usually yieldsbetter results. But as Figure 2 shows this approach does not improve theapproximation ratio.

A better approximation ratio than 1/2 can be achieved by a simple algo-rithm that results from an algorithm of Drake Vinkemeier and Hougardy [12]for the Maximum Weight Matching Problem by specializing it to theunweighted case. The slightly complicated computation of ’good’ augmen-tations that is needed in their algorithm becomes completely trivial in theunweighted case. This way one obtains a simple linear time approximation al-gorithm for the Cardinality Matching Problem with an approximationratio arbitrarily close to 2/3.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 7: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 7

2k2k-1654321

Fig. 2. An example where a maximum matching is asymptotically twice as large asa maximal matching (bold edges) that considers vertex degrees.

However, one can obtain even an approximation ratio of 4/5 in the un-weighted case. For this we will make use of the following result of Hopcroftand Karp [28].

Lemma 3 ([28]). Let M be a matching in a graph G such that every M -

augmenting path has length at least k. If P is a maximal set of vertex disjoint

M -augmenting paths of length k then after augmenting all paths in P the

shortest augmenting path in the new matching has length at least k + 2. �

A maximal set of vertex disjoint M -augmenting paths of length k can befound in linear time for small k.

Lemma 4. Let M be a matching in a graph G. For k ≤ 7 a maximal set of

vertex disjoint M -augmenting paths of length k can be found in linear time.

Proof. We prove the result here for k = 7 only. The proof shows that thestatement also holds for smaller k. Let M be a matching in G such that eachM -augmenting path has length at least 7. We then scan all edges in M andcheck whether such an edge is the middle edge of an M -augmenting path oflength 7 in G.

Let e = {x, y} ∈ M be such an edge. Then we scan all matched neighborsof y. For each such neighbor, say y′, we scan its incident edge {y′, y′′} ∈ M .This can be done in time proportional to the degree of y. Similarly, we scan allpossible neighbors x′ and incident edges {x′, x′′} ∈ M of x in time proportionalto the degree of x (see Figure 3).

Now we simply have to look for a vertex y′′ that has a free neighbor y′′′

and a vertex x′′ that has a free neighbor x′′′. This clearly can be done in timeproportional to the sum of the degrees of vertex x and y. However, we need tobe a bit more careful, as the vertices y′, y′′, y′′′ and x′, x′′, x′′′ need not to bedistinct. Therefore we proceed as follows: If there is a vertex y′′ that has atleast two free neighbors and there is an edge {x′, x′′} different from {y′, y′′}such that x′′ has a free neighbor then we have found an M -augmenting pathof length 7 in time proportional to the sum of the degree of x and y. If all y′′

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 8: Linear Time Approximation Algorithms for Degree Constrained

8 Stefan Hougardy

x y

x′ y′x′′ y′′

Fig. 3. How to find a maximal set of vertex disjoint augmenting paths of length 7in linear time.

have only one free neighbor, we check whether there are at least two differentsuch neighbors. If so, we can find an M -augmenting path of length 7 as soonas there is a vertex x′′ on the other side. If all vertices y′′ are adjacent to thesame free vertex we also can easily check whether an M -augmenting path oflength seven can be found.

Therefore we can find an M -augmenting path of length 7 with the edge{x, y} in the middle in time proportional to the sum of the degrees of x andy. Thus, a maximal vertex disjoint set of such paths can be found in lineartime. �

As a consequence of Lemma 3 and Lemma 4 we get a linear time algorithmwith approximation ratio 4/5 for the Cardinality Matching Problem.

Theorem 4. If M∗ is a maximum cardinality matching then a matching Mwith |M | ≥ 4

5 |M∗| can be computed in linear time. �

Better approximation algorithms can be obtained in the special case ofbounded degree graphs. In this case one easily can check for all augmentingpaths up to a fixed length k containing a given vertex x in constant time. Moreprecisely: if all vertex degrees are bounded by a constant B, then there canexist at most Bk paths of length k containing a given vertex. Therefore, onegets a simple linear time approximation algorithm for bounded degree graphswith approximation ratio arbitrarily close to 1. However, as this approachinvolves the constant Bk in the runtime it is not useful in practice.

2.2 Maximum Weight Matchings

Given a graph G = (V, E) and a weight function c : E(G) → R, the weightof a matching M ⊆ E is defined as w(M) :=

e∈M w(e). The maximumweight matching problem now asks for a matching of maximum weight. The

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 9: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 9

Cardinality Matching Problem is a special case of this problem whereall weights are equal.

Maximum Weight Matching Problem

Input: An undirected graph G and edge weights c : E(G) → R.

Output: A maximum weight matching in G.

The fastest known algorithm for the Maximum Weight Matching

Problem is due to Gabow [21] and has runtime O(nm + n2 log n). How-ever, this algorithm involves rather complicated data structures that preventit from being useful in practice. The fastest implementations known todayfor solving the Maximum Weight Matching Problem are due to Cookand Rohe [9] respectively Mehlhorn and Schafer [33]. These algorithms have aworst case runtime of O(n3) respectively O(nm log n). Under the assumptionthat all edge weights are integers in the range [1...N ] Gabow and Tarjan [23]presented an algorithm with runtime O(

n log nα(m, n)m log(Nn)), where αis the inverse of Ackermanns function.

The greedy algorithm for the weighted matching problem is a very sim-ple approximation algorithm that achieves an approximation ratio of 1/2 [29,31, 2]. This algorithm simply sorts the edges by decreasing weight and thencomputes a maximal matching using this ordering. The runtime of the greedyalgorithm is O(m log n) as sorting the edges requires this amount of time.Surprisingly, for long time no linear time approximation algorithm for theMaximum Weight Matching Problem was known that achieves a con-stant approximation ratio strictly larger than zero. The first such algorithmwas presented by Preis in 1999 [40]. The idea of this algorithm is that in-stead of using the heaviest edge in each step it is enough to consider a locallyheaviest edge, i.e., an edge that is heavier than all adjacent edges. Using thisapproach it is easy to see that the algorithm achieves an approximation ratioof 1/2. However, it is quite complicated to prove that its runtime is indeedlinear.

In 2003 Drake and Hougardy [10] presented a much simpler linear timeapproximation algorithm for the Maximum Weight Matching Problem

with approximation ratio 1/2. This algorithm is called the Path GrowingAlgorithm and is shown in Figure 4. Its idea is to simultaneously compute twomatchings and for the heavier of these two matchings the algorithm guaranteesthat its weight is at least half the weight of a maximum weight matching.

It is easily seen that the runtime of the Path Growing Algorithm is lin-ear [10]. The next result shows the correctness of the algorithm.

Theorem 5 ([10]). The Path Growing Algorithm has a performance ratio of

1/2.

Proof. For the analysis of the performance ratio we will assign each edge ofthe graph to some vertex of the graph in the following way. Whenever a vertex

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 10: Linear Time Approximation Algorithms for Degree Constrained

10 Stefan Hougardy

PathGrowingAlgorithm (G = (V, E), w : E → R+)

1 M1 := ∅, M2 := ∅, i := 12 while E 6= ∅ do begin3 choose x ∈ V of degree at least 1 arbitrarily4 while x has a neighbor do begin5 let {x, y} be the heaviest edge incident to x6 add {x, y} to Mi

7 i := 3 − i8 remove x from G9 x := y

10 end11 end12 return max(w(M1), w(M2))

Fig. 4. The Path Growing Algorithm for finding maximum weight matchings.

is removed in line 8 of the algorithm all edges which are currently incident tothat vertex x are assigned to x. This way each edge of G is assigned to exactlyone vertex of G. Note that there might be vertices in G that have no edgesassigned to them.

Now consider a maximum weight matching M in G. As M must not containtwo incident edges, all edges of M are assigned to different vertices of G. Ineach step of the algorithm the heaviest edge that was currently incident tovertex x is chosen in line 5 of the algorithm and added to M1 or M2. Thereforethe weight of M1 ∪ M2 is at least as large as the weight of M . As

max(w(M1), w(M2)) ≥ 1

2w(M1 ∪ M2) ≥ 1

2w(M)

the weight returned by the Path Growing Algorithm is at least half the weightof the optimal solution. �

It turns out that the greedy algorithm, the algorithm of Preis, and thePath Growing Algorithm of Drake and Hougardy are in practice much betterthan the approximation factor of 1/2 suggests. In [10] it is shown that thesolution found by these algorithms is typically about 5% away from the weightof an optimum solution. For the Path Growing Algorithm one even can geta guarantee that the solution found by the algorithm is strictly larger thanthe approximation ratio of 1/2. This is due to the fact that this algorithmcomputes two different matchings for which it guarantees that the sum ofthe weights of these two matchings is at least as large as the weight of anoptimum solution. Therefore we have the following observation which allowsto get a better guarantee how far the solution returned by the Path GrowingAlgorithm is away from an optimum solution.

Lemma 5. The matching M returned by the Path Growing Algorithm has

weight at least

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 11: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 11

max{w(M1), w(M2)}w(M1) + w(M2)

· w(M∗),

where M∗ is a maximum weight matching.

Note that we have 12 ≤ max{w(M1),w(M2)}

w(M1)+w(M2)≤ 1. This means that the Path

Growing Algorithm might even return a matching M and a guarantee thatthis matching M is a maximum weight matching.

In 2005 Drake-Vinkemeier and Hougardy [12] improved on the Path Grow-ing Algorithm by presenting a linear time approximation algorithm for theMaximum Weight Matching Problem that achieves an approximationratio arbitrarily close to 2/3. This approximation ratio is the best that iscurrently known to be achievable in linear time.

Theorem 6 ([12]). For every fixed ǫ > 0 there exists a linear time algorithm

that computes a matching of weight at least (2/3− ǫ) · w(M∗) where M∗ is a

maximum weight matching. �

Pettie and Sanders [39] improved on this result by presenting another lineartime 2/3−ǫ approximation algorithm for the Maximum Weight Matching

Problem whose runtime has a better dependence on ǫ.

2.3 Minimum Weight Perfect Matchings

Computing a perfect matching of maximum or minimum weight is a problemthat appears quite often in applications. The maximum and minimum perfectmatching problem can easily be transformed into each other by just negatingthe edge weights.

Minimum Weight Perfect Matching Problem

Input: An undirected graph G and edge weights c : E(G) → R.

Output: A minimum weight perfect matching in G or a proof thatG has no perfect matching.

There is a simple reduction that allows to formulate the Maximum

Weight Matching Problem as a Maximum Weight Perfect Match-

ing Problem. Take a copy G′ of the input graph G and connect each vertexin G by an edge of weight 0 with its copy in G′. Then a maximum weight per-fect matching in the new graph corresponds to a maximum weight matchingin G (the weights differ exactly by a factor of 2).

This is a simple reduction that can be performed in linear time, unfortu-nately it does not preserve approximation ratios. However, we cannot expectto find any such reduction as every algorithm that finds an approximate so-lution to the Minimum Weight Perfect Matching Problem must atleast be able to decide whether the graph has a perfect matching. The fastestalgorithm for doing so has runtime O(

√nm log(n2/m)/ logn) [25]. Therefore

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 12: Linear Time Approximation Algorithms for Degree Constrained

12 Stefan Hougardy

linear time approximation algorithms with constant approximation ratios donot exist for the Minimum Weight Perfect Matching Problem unlessone can decide in linear time whether a given graph has a perfect matching.

3 Degree Constrained Subgraphs

Let G = (V, E) be an undirected graph and b : V (G) → N a degree constraintfor every vertex. A subgraph H of G is a degree constrained subgraph for Gwith respect to b, if the degree of each vertex x in H is at most b(x). Weconsider here the problems of finding a degree constrained subgraph with thelargest possible number of edges and a weighted version of this problem. Adegree constrained subgraph is also known as b-matching. A subset M ⊂ Eis called a b-matching if for all v ∈ V (G) the number of edges in M incidentto v is at most b(v). For the special case that b(v) = 1 for all v ∈ V (G)the b-matching is a matching. Therefore, the degree constrained subgraphproblems are generalizations of matching problems. As the connections tomatching problems are quite strong, we prefer here the notion of b-matchingsinstead of degree constrained subgraphs.

Cardinality b-Matching Problem

Input: An undirected graph G and b : V (G) → N.

Output: A maximum cardinality b-matching in G.

The Cardinality b-Matching Problem can be reduced to the Car-

dinality Matching Problem by the following reduction which is due toShiloach [41]: Replace each vertex v of degree d(v) by d(v) copies, such thateach edge incident to v uses another copy of v. Then add additional b(v) ver-tices for each vertex v that are completely connected to the d(v) copies of v.Figure 5 shows an example for this reduction.

b = 2 b = 2

b = 2b = 3

b = 1

Fig. 5. An example illustrating the reduction of a b-matching problem to a matchingproblem.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 13: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 13

Let G be an arbitrary graph with n vertices and m edges and let G′

be the graph that results from this reduction. Then it is not difficult toprove that a matching in G′ of size α + m corresponds to a b-matchingin G of size α [41]. The graph G′ has O(m) vertices and O(Bm) edges,where B = maxv∈V (G){b(v)}. For constant B this reduction leads to a b-

matching algorithm with runtime O(m3/2) by using the algorithm of Micaliand Vazirani [35]. For non-constant B the fastest known algorithm for theCardinality b-Matching Problem has runtime O(nm log n) and is dueto Gabow [20].

Unfortunately the above reduction does not preserve approximation ratios.Therefore, even for constant B we cannot use the constant factor approx-imation algorithms for the Cardinality Matching Problem to obtainsuch algorithms for the Cardinality b-Matching Problem. Instead, wedirectly have to adapt the approximation algorithms to the Cardinality

b-Matching Problem. A b-matching M in a graph G = (V, E) is calledmaximal if M ∪ {e} is not a b-matching for all e ∈ E \ M . A maximal b-matching can easily be computed in linear time: Start with M = ∅ and foreach e ∈ E(G) add e to M if this does not violate the degree conditions. Thefollowing result shows that this already gives a linear time 1/2-approximationalgorithm for the Cardinality b-Matching Problem.

Theorem 7. The Cardinality b-Matching Problem can be solved in lin-

ear time with approximation ratio 12 .

Proof. As observed above a maximal b-matching can be computed in lineartime. Thus we simply have to prove that if M∗ is a maximum cardinalityb-matching and M is a maximal b-matching then |M | ≥ 1

2 · |M∗|. By S wedenote all vertices v such that there are exactly b(v) edges of M incident tov. Then every edge in M∗ must have at least one endpoint in S as otherwiseM is not maximal. As for each vertex v ∈ S there are at most b(v) edges ofM∗ incident to v and each edge in M is incident to at most two vertices in Swe have:

|M∗| ≤∑

v∈S

b(v) ≤ 2 · |M |

which proves the approximation ratio of 1/2. �

We now also consider a weighted version of the b-maching problem.

Maximum Weight b-Matching Problem

Input: An undirected graph G and edge weights c : E(G) → R.

Output: A maximum weight b-matching in G.

For the weighted version of the b-matching problem one can use the abovementioned reduction of Shiloach [41] to get a Maximum Weight Match-

ing Problem. Again, faster algorithms are possible by adapting algorithms

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 14: Linear Time Approximation Algorithms for Degree Constrained

14 Stefan Hougardy

for the Maximum Weight Matching Problem directly to the Maxi-

mum Weight b-Matching Problem. This has been done by Gabow [20]who obtained the currently fastest algorithm for the Maximum Weight b-Matching Problem. His algorithm has runtime O(m2 log n). It is easily seenthat the Greedy algorithm for the Maximum Weight b-Matching Prob-

lem achieves an approximation ratio of 1/2 and has runtime O(m log n) [2].Linear time approximation algorithms for the Maximum Weight b-

Matching Problem are known only for the case that b(x) is bounded bysome constant for all x ∈ V (G). In this case Mestre [34] obtained the followingresult by adapting an algorithm of Drake and Hougardy [11] for the Maxi-

mum Weight Matching Problem to the Maximum Weight b-Matching

Problem.

Theorem 8 ([34]). If b(x) is bounded by some constant for all x ∈ V (G)then the Maximum Weight b-Matching Problem can be solved in linear

time with approximation ratio 12 . �

4 Branchings

A branching is a directed graph without circuits such that each vertex hasindegree at most one. Computing branchings of maximum weight is one of theclassical problems in combinatorial optimization.

Maximum Weight Branching Problem

Input: A directed graph G and edge weights c : E(G) → R.

Output: A maximum weight branching in G.

Edmonds [14] and independently Chu and Liu [8] and Bock [6] gave thefirst polynomial time algorithms for computing a maximum weight branching.Later Gabow, Galil, Spencer, and Tarjan [24] showed that Edmond’s algorithmcan be implemented in O(m + n log n) time. This is already quite close to alinear time algorithm but from a practical point of view one is still interestedin simpler linear time approximation algorithms for the Maximum Weight

Branching Problem.One such algorithm is given by the following greedy approach: Start with

an empty branching B and sort the edges by decreasing weight. Now checkfor each edge one by one whether its addition violates the degree condition. Ifnot then add it to B. Now one can destroy each circuit that might appear byremoving the lightest edge from each circuit. This can be done in linear time.As each circuit has at least two edges, the algorithm has an approximationratio of 1/2. The total runtime is linear, as sorting of the edges is actually notrequired: simply take the heaviest incoming edge for each vertex.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 15: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 15

This result can be improved by applying the phase bounding approachto Edmond’s algorithm. This has been observed recently by Ziegler [43]. Heobtained the following result.

Theorem 9 ([43]). For every ǫ > 0 there exists a linear time approximation

algorithm for the Maximum Weight Branching Problem that has an

approximation ratio of 1 − ǫ.

Acknowledgment

I am grateful to an anonymous referee for several useful comments.

References

1. Ernst Althaus and Kurt Mehlhorn. Maximum network flow with floating pointarithmetic. Information Processing Letters, 66(3):109–113, May 1998.

2. David Avis. Two greedy heuristics for the weighted matching problem. Con-gressus Numerantium, XXI:65–76, 1978. Proceedings of the Ninth SoutheasternConference on Combinatorics, Graph Theory, and Computing (1978).

3. Holger Bast, Kurt Mehlhorn, Guido Schafer, and Hisao Tamaki. Matching al-gorithms are fast in sparse random graphs. Theory of Computing Systems,39(1):3–14, 2006.

4. Claude Berge. Two theorems in graph theory. Proceedings of the NationalAcademy of Sciences of the United States of America, 43(9):842–844, 1957.

5. Norbert Blum. A new approach to maximum matching in general graphs. In17th ICALP (1990), volume 443 of Lecture Notes in Computer Science, pages586–597. Springer Berlin / Heidelberg, 1990.

6. Frederick Bock. An algorithm to construct a minimum directed spanning tree ina directed network. In Benjamin Avi-Itzhak, editor, Developments in OperationsResearch, Proceedings of the Third Annual Israel Conference on Operations Re-search, July 1969, volume 1, pages 29–44. Gordon and Breach, 1971. Paper1-2.

7. Hans L. Bodlaender. A linear-time algorithm for finding tree-decompositions ofsmall treewidth. SIAM J. Comput., 25(6):1305–1317, 1996.

8. Yoeng-Jin Chu and Tseng-Hong Liu. On the shortest arborescence of a directedgraph. Scientia Sinica, 14(10):1396–1400, 1965.

9. William Cook and Andre Rohe. Computing minimum-weight perfect matchings.INFORMS Journal on Computing, 11(2):138–148, 1999.

10. Doratha E. Drake and Stefan Hougardy. Linear time local improvements forweighted matchings in graphs. In Klaus Jansen et al., editor, InternationalWorkshop on Experimental and Efficient Algorithms (WEA) 2003, volume 2647of Lecture Notes in Computer Science, pages 107–119. Springer, 2003.

11. Doratha E. Drake and Stefan Hougardy. A simple approximation algorithm forthe weighted matching problem. Information Processing Letters, 85(4):211–213,2003.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 16: Linear Time Approximation Algorithms for Degree Constrained

16 Stefan Hougardy

12. Doratha E. Drake Vinkemeier and Stefan Hougardy. A linear-time approxi-mation algorithm for weighted matchings in graphs. ACM Transactions onAlgorithms, 1(1):107–122, July 2005.

13. Jack Edmonds. Paths, trees, and flowers. Canadian Journal of Mathematics,17(3):449–467, 1965.

14. Jack Edmonds. Optimum branchings. Journal of Research of the NationalBureau of Standards — B.Mathematics and Mathematical Physics, 71B(4):233–240, 1967.

15. Tomas Feder and Rajeev Motwani. Clique partitions, graph compression andspeeding-up algorithms. Journal of Computer and System Sciences, 51(2):261–272, 1995.

16. Ted Fischer, Andrew V. Goldberg, David J. Haglin, and Serge Plotkin. Approx-imating matchings in parallel. Information Processing Letters, 46(3):115–118,1993.

17. L. R. Ford and D. R. Fulkerson. Maximal flow through a network. CanadianJournal of Mathematics, 8:399–404, 1956.

18. Andras Frank. On Kuhn’s hungarian method — a tribute from hungary. NavalResearch Logistics, 52(1):2–5, 2005.

19. Christian Fremuth-Paeger and Dieter Jungnickel. Balanced network flows. VIII.A revised theory of phase-ordered algorithms and the O(

√nm log(n2/m)/ log n)

bound for the nonbipartite cardinality matching problem. Networks, 41(3):137–142, 2003.

20. Harold N. Gabow. An efficient reduction technique for degree-constrained sub-graph and bidirected network flow problems. In STOC ’83: Proceedings of thefifteenth annual ACM symposium on Theory of computing, pages 448–456, NewYork, NY, USA, 1983. ACM Press.

21. Harold N. Gabow. Data structures for weighted matching and nearest commonancestors with linking. In SODA ’90: Proceedings of the first annual ACM-SIAMsymposium on Discrete algorithms, pages 434–443, Philadelphia, PA, USA, 1990.Society for Industrial and Applied Mathematics.

22. Harold N. Gabow and Robert E. Tarjan. Algorithms for two bottleneck opti-mization problems. Journal of Algorithms, 9(3):411–417, 1988.

23. Harold N. Gabow and Robert E. Tarjan. Faster scaling algorithms for generalgraph-matching problems. Journal of the ACM, 38(4):815–853, 1991.

24. H.N. Gabow, Z. Galil, T. Spencer, and R.E. Tarjan. Efficient algorithms for find-ing minimum spanning trees in undirected and directed graphs. Combinatorica,6(2):109–122, 1986.

25. Andrew V. Goldberg and Alexander V. Karzanov. Maximum skew-symmetricflows and matchings. Mathematical Programming, 100(3):537–568, 2004.

26. Nicholas J.A. Harvey. Algebraic structures and algorithms for matching andmatroid problems. In Proceedings of the 47th Annual IEEE Symposium onFoundations of Computer Science (FOCS’06), pages 531–542. IEEE ComputerSociety Washington, DC, USA, 2006.

27. Refael Hassin and Shlomo Lahav (Haddad). Maximizing the number of unusedcolors in the vertex coloring problem. Information Processing Letters, 52(2):87–90, 1994.

28. John E. Hopcroft and Richard M. Karp. An n5/2 algorithm for maximummatchings in bipartite graphs. SIAM Journal on Computing, 2(4):225–231,1973.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200

Page 17: Linear Time Approximation Algorithms for Degree Constrained

Title Suppressed Due to Excessive Length 17

29. Thomas A. Jenkyns. The efficacy of the greedy algorithm. Congressus Nu-merantium (Proceedings of the 7th Southeastern Conference on Combinatorics,Graph Theory, and Computing, Utilitas Mathematica, Winnipeg), 17:341–350,1976.

30. George Karypis and Vipin Kumar. Multilevel k-way partitioning scheme forirregular graphs. Journal of Parallel and Distributed Computing, 48(1):96–129,1998.

31. Bernhard Korte and Dirk Hausmann. An analysis of the greedy heuristic forindependence systems. Annals of Discrete Mathematics, 2:65–74, 1978.

32. H.W. Kuhn. The hungarian method for the assignment problem. Naval ResearchLogistics Quarterly, 2:83–97, 1955.

33. Kurt Mehlhorn and Guido Schafer. Implementation of O(nm log n) weightedmatchings in general graphs: the power of data structures. Journal of Experi-mental Algorithmics, 7:4, 2002.

34. Julian Mestre. Greedy in approximation algorithms. In Y. Azar and T. Erlebach,editors, ESA 2006, volume 4168 of Lecture Notes in Computer Science, pages528–539. Springer, 2006.

35. Silvio Micali and Vijay V. Vazirani. An O(√

|v|·|E|) algorithm for finding maxi-mum matching in general graphs. In 21st Annual Symposium on Foundations ofComputer Science (21st FOCS, Syracuse, New York, 1980), pages 17–27, 1980.

36. Rajeev Motwani. Average-case analysis of algorithms for matchings and relatedproblems. Journal of the ACM, 41(6):1329–1356, 1994.

37. Marcin Mucha and Piotr Sankowski. Maximum matchings via gaussian elimi-nation. In Proceedings of the 45th Annual IEEE Symposium on Foundations ofComputer Science (FOCS’04), pages 248–255. IEEE Computer Society Wash-ington, DC, USA, 2004.

38. Julius Petersen. Die Theorie der regularen Graphs. Acta Mathematica,15(1):193–220, 1891.

39. Seth Pettie and Peter Sanders. A simpler linear time 2/3 − ε approximationfor maximum weight matching. Information Processing Letters, 91(6):271–276,2004.

40. Robert Preis. Linear time 1

2-approximation algorithm for maximum weighted

matching in general graphs. In C. Meinel and S. Tison, editors, Symposiumon Theoretical Aspects in Computer Science (STACS), number 1563 in LectureNotes in Computer Science, pages 259–269, 1999.

41. Yossi Shiloach. Another look at the degree constrained subgraph problem. In-formation Processing Letters, 12(2):89–92, 1981.

42. Vijay V. Vazirani. A theory of alternating paths and blossoms for provingcorrectness of the O(

√V E) general graph maximum matching algorithm. Com-

binatorica, 14(1):71–109, 1994.43. Valentin Ziegler. Approximating optimum branchings in linear time. Technical

report, Humboldt-Universitat zu Berlin, Institut fur Informatik, 2008.

This paper appeared in: Research Trends in Combinatorial Optimization, W.J.Cook, L.Lovász, J.Vygen (Eds.), Springer 2008, 185-200