3 October 1989
Info~ation Processing Letters 32 (1989) 297-300 North-Ho&rid
THE COMPLEXITY
OF MATCHING
WITH BONDS
Manfred PADBERG Graduate School of Business Administration, New York University, 100 Trinity Place 10006, New York, USA
Antonio SASSANO istituto di Analisi dei Sistemi ed Znformatica de/ CNR, Viale Manrotti 30, 00185 Roma, ita@ Co~u~cat~ by T, Lengauer Received 18 Jamxary 1989 Revised I June 1989
A borrd structure in a finite, undirected, loopless graph G = f V, Ef is a collection F of nonempty, disjoint subsets of E whose union is E. ~arf~~g with bonds (MB) is the problem of finding a m~mum-we~~t matching in G such that either all edges In a bond are selected or none of them. Other mat&kg problems with side constraints have been presented in the Literature, we show that they are special cases of (MB). Moreover we prove that (MB) is an NP-hurd problem even when the graph G is a cycle and every bond F E .F has cardinahty at most two.
Keywork
Computational
complexity, restricted matching problems
I. The complexity of matching with bonds Let G = (F, E) be a connected, undirected, finite graph with, possibly, multiple edges, but without loops. A matching M in G is a collection of edges such that each node in Y is met by at most one edge in M. A vertex packing in G is, sy~et~cally, a subset of S of V such that each edge in E has at most one endpoint in S. A graph G = (V, E) is the Ike graph of a graph H = (W, F) (the root graph of G) if the nodes of G are in one-to-one correspondence to the edges of H and two nodes in V are adjacent if and oniy if the corresponding edges of F are incident to the same node. If G is the line graph of N we write G = L(U). Clearly, the matchings in H are in one-to-one correspondence to the vertex packings in G=L(H). A bond structure in a graph G = (V, E) is a partition 9r of E, i.e. a finite collection of non-
disjoint subsets of E (bonds) whose union is E. Let c E 88f Ei be a vector of weights c, for all edges e of G. Matching with bonds is the problem of finding a maximum weight matching in G such that either all edges of a bond FE 9 are selected or none of them, i.e. the problem empty,
(MB)
max c c,x,, eEE
subject to x,gl z: e IneefS0 x, = x f
VVE v, ‘@e, .f~ VFEF
X,E {O, 1)
VeEE.
0.1) F, with
1FI >, 2,
(1.2). 0.3)
If all bonds FE S are singletons, we have the (usual) matching problem in G. If G is bipartite 297
Volume 32. Number 6
INFORMATION
and sy~et~c,
with node set Y = ( ui, . . . , u, 1 u and all bonds are of the form F = ((v,, u,), (ui, u,>), the problem (MB) is the symmetric assignment problem, see [5], which is equivalent to a matching problem on a nonbipartite graph. It will be conve~ent to abbreviate the problem {MB) by the triple (G, S, c). Without loss of generality we can make the blanket assumption that each bond FE 9 is itself a feasible matching, because, otherwise, all feasible solutions of {l.I), (1.2) and (1.3) satisfy x,== 0 for all f E F. But this means that the entire bond F can be deleted from G and from S. The problem (MB) can be reduced in potynomiai time to a ue~tex-packing problem (H, w) in a related graph H = (V,, EM) with node weights w,. for ail u E I$+ We simply associate a node u E V, with every bond F ES and assign to it the node weight (w I,‘..,
w,=
c
w, >,
cc?*
eezF
Two nodes I/ and u are joined by an edge if their co~espo~ding bonds F’ and F contain (at least) two edges e’ E F’ and e E F having a node in common. Clearly, if 1F 1 = 1 for all F ~~fl, then H is the line graph L(G) of 6. Furthermore, due to the choice of the weight vector w, to each matching M satisfying (l.l), (1.2) and (1.3) there corresponds a vertex packing 5’ of W having the same total weight and vice versa. To establish the NP-completeness of (MB} we will prove that every instance of the vertex packing problem in a connoted graph N can be reduced, in polynomial time, to an instance of the matc~ng with bonds problem on a simple cycle. A similar result was first proven in [6]. Theorem I.1. vertex-packing is poiy~omia~~y reducibfe to matching with bonds on cycles. PrfM Suppose we are given an instance of (VP) that is a connected graph H- (V,, EN) and a weight c, associated to each node u E I&. Denote by ?Z= ( u$%,ei,, t’;, . . . , ejm, Ui, rz Ui,) an optimal Chinese postman to& of H, i.e. a closed walk of ~nimum cardinality which uses every edge of H at least once. 298
PROCESSING
LETTERS
Construct (MB):
3 October 1989
the following instance (c, 3,
<> of
E= ((elk-$, eil,): h = 2 *..., m), P= (4:
i-
l,,.,,
1VH 1)
where _F;= {(e,*_,, etJ E .i?: vih = ui E YH), and for i=l,..., lIJ& J, z w=c 0, ZU= 0
for exactly one w E P;,, for uitw,
uE15;.
In other words, the graph c== (v, $) has the property that each node in p corresponds to an edge in EN and two nodes are adjacent in G if and only if the corresponding edges in EH have consecutive indices in +a-.Furthe~ore, the bond structure 3 has the following structure: each bond E; corresponds to a node ui in V, and contains an edge (e!,_,, e,,) of E if and only if the postman tour contams the sequence ( eik_,, Oi, ei* >. It follows that the graph c is a simple cycle and that if two nodes or, ui E VH are adjacent in H, then the corresponding bonds EJ and 4 contain two edges of g incident to the same node. Nence, a subset S= (ui,..., up) of YH is a vertex packing in H if and only if the edges in M = Uip_t& (the bond 4 corresponds to the node ui, for i = 1, . . . , p) define a matching with bonds in (t?, @>. Moreover, by the choice of the weight vector 2, we have that C, E sw, = &, E NC,, To conclude the proof observe that we can find an optimal Chinese postman tour v in polynomia1 time [Z] and that every edge is used at most twice by r. It follows that the above const~ction can be done in polyn.mial time and space since 1F 1 sg 2[E=,f and 1Ei <2/EHl. a Corallaw 1.2. hatching with bonds is W-complete on cycles with bonds having cardinal@ at most two. Proof. As observed above, the construction of Theorem 1.1 associates with each instance of the vertex packing problem (U, c) an instance of (MB>, say (e, @, Z), where c is a cycle and the maximum cardinality of a bond Fi ELP is equal to
Volume 32. Number 6
INFO~T~O~
PROCESStNG LETTERS
the number of occurrences of the node Ui in a minimal Chinese postman tour V. Denote by di the number of edges incident to a node O,E V,; it is well known that the node ui is traversed at most ldi/2f times by the optimal tour r, and, consequently
Thus, applying the construction of Theorem I.1 to a cubic graph, we obtain an instance of (MB) with bonds having cardinality at most two. Since the vertex packing problem is NP-complete on cubic graphs [31, it follows that (MB) is NP-complete on cycles with bonds having cardinality at most two. CI
We conclude this note by stating the relationship among (MB) and a related class of hard matching problems. In [4] (see also [7]), Itai et al., motivated by some applications in robotics, analysis of images and school scheduling, introduced a restricted matching proHem (RMP) defined as follows. Definition.
Restricted matching problem
property that 1M n E, ) G r, for i = 1,. . ., m. We denote by (G, 8. r, c) an instance of (GRMP). Evidently, the soiution of an instance (B, 8. r) of (RMP) can always be found by solving the associated instance of (GRMP) (B, 8, r, 1,X where 1, is the vector of m ones. In fact, if M* is an optimal solution of the latter problem and c( M * ) is the associated cost, we have that c( M * ) G 1x1 and that c(N*)= 1x1 if and only if (B, b, r) has a solution. In the following theorem we prove, by means of a construction which is similar to the reduction of the b-matching problem to a simple matching (see [I]), that (GRMP) is polynomially reducible to (MB). Theorem 2.1. Generaked RMP reducible to matching with bonds.
2. Restricted matching problems
(RMP):
Given a bipartite graph B = (X, Y, E) with 1X 1 & ]Yl,afamily&‘={E1,...,E,) ofsubsetsof E and a vector rE$I’: with r, d 1E, I: find, if it exists, a matching M c E that saturates the node set X (complete matc~ng) and has the property that 1Mf? E,I Q r, for i = 1, . . . . m. We denote by (B, b, r) an instance of (RMP). The problem (RMP) is shown in [4] to be NF-hard for m IS;2 and polynomially solvable for m = 1. Here we define a generalization of the problem (RMP) and prove that it can be polyno~ally reduced to (MB). Definition. Generalized RMP (GRMP): Given a graph G=(Y, E), a family 6= {E, ,..., Em) of subsets of E, a vector r E Zy with r, B 1E, 1 and a weight c, associated to each edge e f E, find a matc~~g M c E having maximum weight and the
3 October 1989
is po~nomia~~y
Proof. Suppose we are given an instance (G, d, r, c) of (GRMP), that is, a graph G =L (V, i5>, a partition &= ( E,, . . . , Em ), a vector r E Z!T and a weight c, for each e E E. Co~esponding to this instance we construct an instance (G’, 9’, c’) of (MB) defined as follows. The graph G’ is composed of m -f- 1 connected components, the original graph G and m tripartite graphs B,, &. . . . , B,,, associated to the m subsets of the family G. The node set Vs, of each subgraph Si consists of three node sets I$, L: and 2,. with lW;(=Irj:l=/E,I and IZjl=lEiI-rj. .The nodes of U: and Ui are in one-to-one correspondence to the edges of E,. Each node w, E K has degree one and is connected, by an edge e’ = (W,. u,), to the corresponding node U, E Ui. Furthermore, each node u, E U, is also connected to every node in the set 2,. The family 9 contains a bond F - ( e, e’> for each e E. Ei E d and bonds of cardinality one F = or each edge f of G’ not contained in any k!2: I
-
Finaily, the weight vector c’ coincides with c for the edges in E. For each subgraph B,, the weight is set equal to zero for the edges connecting the nodes of M/: to the nodes of Uj and it is set to a very iarge value A for the edges of the complete bipartite subgraph induced by the node sets 2, U 299
Volume 32. Number 6
~N~~~~I~N
PROCESSING LEffERS
V,. The value A equals, e.g., 1 + 1E 1cm,, where cnnx = max,,.fO* cp]. The basic idea of this construction is the following: due to the large value A, a matching with bonds 84 for (G’, F’, c’) contains 1Z,i = 1Ei f -q edges of the bipartite subgraph induced by Z, U 4. It follows that at most rj edges of the form (u,, we) with u, E Ui and w, E Wi, belong ta M. Cons~uentl~, since every edge e E Ei belongs to a bond F= (e, e’) with e”=(w,, u,), W,E V$ and u, E U;, it follows that at most ui edges of the subset Ei belong to M and hence that MO E is a feasible matching for (G, &, r_ c). Converse@, it is easy to show that each feasible matching of (G, 6, r, c) can be extended to a matching with bonds for (G’, S’, c’). As we are going to prove more formally, the above constructon allows us to prove that the problem (CRMP) is poiyno~ally reducible (in time and space) to the problem (MB). The graph G’ has 1 Y’ 1 = i Fi 1 +E%nrl (21&l--5) and lE’[ = lEl+C~n_l(lEil+lEjlZ - r;:j Ei 1) and, since q < f Ej 1, the transformation from (G, b. f, c) to (C’, S’, c’) is p~ly~o~~ in time and space. To complete the proof we show that each feasible solution of (G, &‘, r, c) ~o~esponds to a feasible solution of (G’, .F‘, c’) and that an optimal solution of the latter problem always corresponds to an optimal solution of the former. For this purpose consider a feasible solu~o~ Ncr: E of (6, &‘, r, c). The set &Z can be easily extended to a feasible matching with bonds for (G’, .F’, c’) by simply adding, for each edge e E M, all the edges belonging to the same bond as e, Moreover, since 1Mf7 Ei 1 c rj, it follows that at least 1E, 1-r, nodes are insaturated in L$ and thus we can add exactly ] E 1-r, edges connecting nodes in Ui to nodes in Zi. Thus, every feasible matching M g E for (G, b, T, c) can be extended to a matching with bonds for (G”, .F’, c’) that saturates the nodes in Uy=1Zi. Consider, next, an optimal solution M* for (G’. ,F’, c’), Since A = 1 + [ E 1cm,,, the set M * saturates the nodes of Z, for all i. As a consequence, 1M * f? Ei i c rj for all i and hence at = ri edges of the form (w,, u,), m~st(141-l~iI) with w, E tv;; and u, E E$_ for each subgraph 3, 300
3 Octczbef 1989
are included in M *. It follows that at most r, edges from each class Ej of the partition belong to I\rJ* and hence that N* n E is a feasible solution for (G, 8, rr c) and c’(N*)=c(M* nE) + AEYJ-“,, 1Zj I_ Since every solution of (G, G”, $$ c) corresponds to a solution of (G’, S’, C’S that saturates the nodes in UG 1Zi, M * n E is optimal for (G, b, r, c) and the theorem follows U
3. Conchisions In this paper we have discussed the ~ornple~ty of the matc~ng with bonds problem and proved that (MB) generalizes both the usual matching problem and some other rnatc~~g problems with side constraints proposed in the literature, In particular, the result of Theorem 2.1 suggests that the problem of characterizing those instances of (RMP) which are polyno~ally solvable (see [4,t]) can be considered as a special case of the more general problem of characterizing those bond structures for which (MB) is solvable in polynomial time.
The authors are indebted to the anonymous referee whose suggestions have improved the quality of the paper.
References ill C, Berge, Grc@s (North-Holland, Amsterdam, 1985). I21J. Edmonds and E. Johnson, Matching. Euler tours and the Cbinrse postman, iMn& ~r~r~rnrni~~ 5 (1973) 88-124. 131 M.R. Garey, D.S. Johnson and L. Stc&meyer, Some simp&&d NP-complete graph problems, Theurer. Cornput, Sci. 1 (1976) 237-267. I41 A. I%&, M. Rod& and S.L. Tanimoto, Some matching problems for bipartite graphs, 3. ACM 25 (4) (1978) 517-525. 151E. Bawler, Combinatorial Optimization: Network and Matroids (Holt. Rinehart and Winston, New York, 1976). 161M. Padberg and A. Sassano, Matc~mg with bonds I, IASICNR Tech&at report No. 85, 1984. (71 C.H, papadimitriou and M. Yannakakis, The complexity of restricted spanning tree problems, J. ACM 29 (2) (1982) 285-309.