Diverse Pairs of Matchings

We initiate the study of the Diverse Pair of (Maximum/ Perfect) Matchings problems which given a graph $G$ and an integer $k$, ask whether $G$ has two (maximum/perfect) matchings whose symmetric difference is at least $k$. Diverse Pair of Matchings (asking for two not necessarily maximum or perfect matchings) is NP-complete on general graphs if $k$ is part of the input, and we consider two restricted variants. First, we show that on bipartite graphs, the problem is polynomial-time solvable, and second we show that Diverse Pair of Maximum Matchings is FPT parameterized by $k$. We round off the work by showing that Diverse Pair of Matchings has a kernel on $\mathcal{O}(k^2)$ vertices.


Introduction
Matching is one of the most fundamental notions in graph theory whose study can be traced back to the classical theorems of Kőnig [19] and Hall [13].The first chapter of the book of Lovász and Plummer [21] devoted to matching contains a nice historical overview on the development of the matching problem.The problem of finding a maximum size or a perfect matching are the classical algorithmic problems; an incomplete list of references covering the history of algorithmic improvements on these problems is [8,16,18,20,23,27,31,22], see also the book of Schrijver [28] for a historical overview of matching algorithms.
In this paper we initiate the algorithmic study of the diverse matching problem.In this problem, we are to find a pair of matchings which are different from each other as much as possible.More formally, we want the size of their symmetric difference to be large.Recall that the symmetric difference of two sets X, Y is defined as We study the following problem.

Input:
Graph G, integer k Question: Does G contain two (maximum/perfect) matchings M 1 , M 2 such that Diverse Pair of (Maximum/Perfect) Matchings Diversity-enhancing is one of the key goals in developing professional social matching systems [25].For example, consider the problem of assigning agents to perform various tasks (say, bus drivers to bus routes or cleaners to different locations).To avoid monotony, which is one of the declared enemies of happiness at work, the practice is to reassign agents to new tasks.In this case, we would be very much interested in designing a schedule with diverse assignments.To give another illustration, assume that a teacher should give a series of assignments to students that are expected to work in pairs.From one side, the teacher wishes to follow the preferences of the students given by a graph, but from the other side, it is preferable to facilitate collaboration between different students.This leads to the problem of finding diverse perfect matchings in the preference graph.
We now briefly motivate why finding a diverse set of maximum/perfect matchings in a graph would be of interest.From a graph-theoretic point of view, in the simplest model, one maximum/perfect matching is as good as the other.But in a practical setting this is rarely the case since there is a large amount of side information that determines how an assignment (for instance agents to tasks) is received.Some side information is modeled by maximum weight matchings, or via notions from social choice theory such as stable or envy free matchings [4].Nevertheless, this approach has its natural limitations; some side information may complicate the model, rendering it intractable, while some side information may even be impossible to include in a model.
For instance, if we allow agents to have incomplete preference lists or ties, then the corresponding maximum stable matching problem is NP-hard, even in severely restricted cases [26].Other side information may be a priori unknown, and only once presented with a number of alternatives, we may be able to decide which assignment is the most desirable.In that case it is key that the presented alternatives are diverse, otherwise the insight we gain is comparable to that of having a single fixed assignment and is therefore negligible.Similar motivations for finding diverse solution sets in combinatorial problems can be found in [2,3].
Our results and methods.While a perfect or a maximum matching in a graph can be found in polynomial time, this is not true anymore for the diverse variant of the problem, even in graphs of maximum degree three.Matching problems are often considered on bipartite graphs, and we show that Diverse Pair of Maximum Matchings remains polynomial-time solvable in this case.
The intractability of the problem in the general case also suggests to look at it from the perspective of parameterized complexity [7,5] and kernelization [11].We show that the problem is FPT parameterized by k, by giving a randomized 4 k • n O (1) time algorithm, and we give a derandomized version of this algorithm that runs in time 1) .Finally, we show that the problem asking for a diverse pair of (not necessarily maximum) matchings admits a kernel on O(k 2 ) vertices.
The randomized algorithm for Diverse Pair of Maximum Matchings is obtained via a combination of color-coding [1] and the polynomial-solvability of finding a minimum cost maximum matching in a graph [12].We derandomize this algorithm via universal sets [24].The kernelization algorithm for Diverse Pair of Matchings first finds a maximal matching M in the graph.If M is large enough, then we can conclude that we are dealing with a Yes-instance by splitting M into two matchings.Otherwise, the endpoints of M form a vertex cover of the input graph which allows us to shrink the graph without changing the answer to the problem.Related work.A well-studied generalization of matchings in graphs is that of a b-matching, where b is an integer; see for instance [21].Given a graph G and an integer b, a b-matching is an assignment of an integer µ(e) to each edge e of G, such that for each vertex v, the sum over all its incident edges e v of µ(e v ) is bounded by b.The size of a b-matching is the sum over all edges e in G of µ(e).The 1-matchings of a graph precisely correspond its matchings (via the edges e with µ(e) = 1).However, a 2-matching is not always the union of two matchings: take for instance a triangle.Then, assigning a value of 1 to all its edges gives a 2-matching; while any matching can have at most one edge from a triangle.Therefore, finding diverse pairs of matchings is not the same as finding 2-matchings.
Finding q pairwise disjoint matchings of large total size corresponds to finding large subgraphs that can be q-edge colored, each matching constitutes a color class.The Maximum q-Edge Colorable Subgraph problem asks for the largest edge-subgraph that can be properly colored with q colors.This problem is known to be hard to approximate [9].
Let G be a graph with edge set E and maximum degree ∆.Any proper edge coloring requires at least ∆ colors.On the other hand, Vizing's Theorem [32] asserts that every graph can be properly edge-colored with ∆ + 1 colors.A consequence of this result is that (any) graph G contains a ∆-colorable subgraph with at least ∆ ∆+1 |E| edges; which is tight when ∆ is even as witnessed by the complete graph K ∆+1 .This motivated research in improving the lower bound when ∆ is odd, or when ∆ is even and K ∆+1 is excluded.Kamiński and Kowalik [17] gave several improved lower bounds for the cases when ∆ ≤ 7.
The difference with Maximum 2-Edge Colorable Subgraph is that in Diverse Pair of Maximum Matchings, we require matchings (or: color classes) to be of maximum size, while in the former problem, we only want to maximize the total number of edges in the two color classes.
A recent manuscript due to Fellows [10] initiated the study of finding diverse sets of solutions to NP-hard combinatorial problems from the viewpoint of parameterized complexity [2,3].Concretely, Baste et al. [2] showed that a large class of vertex subset problems that are FPT parameterized by treewidth have FPT algorithms in their diverse variant, parameterized by treewidth plus the number of requested solutions.Moreover, Baste et al. [3] showed analogous results for hitting set problems parameterized by solution size plus number of requested solutions.Our work contrasts this in that the classical variant of the problem we consider is polynomial-time solvable, while its diverse variant becomes NP-hard, even when asking for only two solutions.
Very recently, Hanaka et al. [14] gave efficient algorithms for finding diverse sets of solutions to several other combinatorial problems.This includes an FPT-algorithm for finding diverse sets of matchings in a graph.However, their result is different from ours.We give an FPT-algorithm for finding a diverse pair of maximum or perfect matchings, and our parameter is the size of the symmetric difference between the matchings, in other words, the diversity measure.In [14], the parameter is the size of the matchings plus the number of requested solutions, and the matchings do not need to be of maximum cardinality.Note that in this setting, the maximum possible diversity is bounded in terms of the parameter as well.In the case that we drop the maximum cardinality requirement on the matchings, we even obtained a polynomial kernel for finding a diverse pair of matchings.By the same arguments given in the proof of Theorem 7, we can derive that the problem of finding a diverse set of r matchings of size k parameterized by k + r considered in [14] is not only FPT but has a polynomial kernel.

Preliminaries
We assume the reader to be familiar with basic notions in graph theory and parameterized complexity and refer to [6] and [7,5,11], respectively, for the necessary background.
All graphs considered in this work are finite, undirected, simple, and without self-loops.For a graph G we denote by V (G) its set of vertices and by E(G) its set of edges.For an edge uv ∈ E(G), we call u and v its endpoints.
The subgraph induced by X, denoted by G[X], is the graph set can be partitioned into two nonempty independent sets.NP-Completeness.We briefly argue the NP-completeness of Diverse Pair of Maximum/Perfect Matchings on 3-regular graphs which was observed in [29].Membership in NP is clear.To show NP-hardness, we reduce from 3-Edge Coloring on 3-regular graphs which is known to be NP-complete [15].Let G be a 3-regular graph on n vertices (note that this implies that n is even), and consider (G, n) as an instance of Diverse Pair of Matchings.Suppose that G has a proper 3-edge coloring.Since G is 3-regular, all three colors appear on an incident edge of each vertex.Therefore, a color class is a perfect matching of G, and we can take two color classes as our solution to (G, n).Conversely, a solution (M 1 , M 2 ) to (G, n) forms two disjoint matchings of size n/2 each.This implies that both M 1 and M 2 are perfect, and therefore maximum matchings.Since each vertex in G has degree three, this means that M 3 . .= E(G) \ (M 1 ∪ M 2 ) also forms a perfect matching in G, and therefore (M 1 , M 2 , M 3 ) is a proper 3-edge coloring of G.

A Polynomial-Time Algorithm for Bipartite Graphs
In this section we show that Diverse Pair of Maximum Matchings is solvable in polynomial time on bipartite graphs via a reduction to the 2-Factor problem.
Theorem 2. Diverse Pair of Maximum Matchings is polynomial-time solvable on bipartite graphs.
Proof.Let (G, k) be a given instance of Diverse Pair of Maximum Matchings, where G is bipartite.We show how to reduce this instance to an equivalent instance of the problem of finding maximum-weight 2-factor of a larger graph G .A 2-factor of G is a subgraph of G in which the degree of each vertex is equal to 2. Equivalently, 2-factor of G is a vertex-disjoint cycle cover of G .The problem of finding a maximum-weight factor of a graph is well-known to be solvable in polynomial time using the Tutte's reduction to the problem of finding a maximum-weight perfect matching [21,30].Our graph G is an edge-weighted graph with parallel edges.We note that the algorithm of finding a maximum-weight factor works fine with such graphs.
We also assume that the two parts of G are of equal size.If that is not true, introduce isolated vertices to the smaller part of G.This does not change the matching structure in G, so the obtained instance is equivalent to the initial one.Denote the number of vertices in each part of G by n, so |V (G)| = 2n.
We now show how to construct G given G.The graph G is defined on the same vertex set as G is, i.e.V (G ) = V (G).For each edge uv of G, G has two parallel edges between u and v.One of these edges is assigned weight 1, and the other is assigned weight 0. In other words, edges of G are doubled in G .Additionally, for each pair of vertices u, v from distinct parts of G that are not adjacent in G, G has two parallel edges of weight −n between u and v. Thus, G is a complete bipartite graph with doubled edges, and weights of these edges depend on what edges are present in G.This finishes the construction of G .
Claim 2.1.Let M 1 and M 2 be a pair of maximum matchings in G that maximize the value of Proof.We first show that G has a 2-factor of weight at least There are n−|M 1 | vertices in each part of G that are not saturated by M 1 .Take these 2(n−|M 1 |) vertices and take an arbitrary matching between them in G .All edges of this matching are of weight −n, otherwise M 1 is not maximum in G. Add the edges of this matching into F .Repeat the same for M 2 , i.e. take an arbitrary matching in G between vertices that are not saturated by M 2 and add all its edges into F .The edges of weight −n of the matchings for M 1 and M 2 may coincide.If an edge of weight −n is presented in both matchings, take both its parallel copies into F .It is easy to see that F is now a 2-factor of G , as it consists of edges of two perfect matchings between two parts.The weight of It is left to show that F is indeed a maximum-weight 2-factor of G .To see this, take a maximumweight factor F of G and assume that the weight of F is greater than the weight of F .Note that F consists of 2n edges.As discussed above, F forms a disjoint union of simple cycles on the vertices of G , where each vertex belongs to exactly one cycle.Note that some of these cycles may consist of two parallel edges.Since G is bipartite, all of these cycles have even length.Color the edges of F with two colors so that no two consecutive edges have the same color on a cycle.Then the edges of the same color form a perfect matching in G .Denote these matchings by F 1 and F 2 .Let M 1 be the set of original edges of G which copies are present in F 1 .Let M 2 be the set of edges of G obtained analogously from F 2 .Copies of edges in M 1 and M 2 have weights 0 or 1 in G .All other edges in F 1 and F 2 are of weight −n.
Observe that if an edge of G is present in both M 1 and M 2 , then one of its copies in F has weight 0, and the other has weight 1.Thus, the total weight of 0-and 1-weighted edges in F is at most We assumed that the weight of F is greater than the weight of F .From this we get that Recall that M 1 and M 2 are matchings in G. Suppose M 1 and M 2 are maximum matchings in G. Then the right hand side of Equation 1 evaluates to zero, and-by the definition of M 1 and M 2 -the left hand side is at most zero.Hence Equation 1 does not hold, a contradiction.So at least one of M 1 and M 2 is not a maximum matching.Thus we get that holds; equivalently, that By construction we have that the size of any matching in G is at most n.In particular |M 1 | ≤ n, and so we have that holds.Equation 2 can be restated as holds.Substituting Equation 4in Equation 1 we get that holds.Observe now that is the maximum among all pairs of maximum matchings.Then we have that the maximum value of |M 1 M 2 |, over all pairs of maximum matchings, equals

FPT-Algorithm for Diverse Pair of Maximum Matchings
In this section we give an FPT-algorithm for Diverse Pair of Maximum Matchings parameterized by k.We first give a randomized algorithm based on the color-coding technique of Alon, Yuster and Zwick [1] in Theorem 3, and then derandomize this algorithm at the cost of a slightly slower runtime in Corollary 6.
Theorem 3. Diverse Pair of Maximum Matchings parameterized by k is FPT.More precisely, there is a randomized algorithm that in time 4 k •n O(1) finds a solution with constant probability, if it exists, and correctly concludes that there is no solution otherwise, where n denotes the number of vertices of the input graph.
Proof.Let G be the graph of the given instance.First, we compute a maximum matching M in G in polynomial time [8,12,23].We check if there is a solution using M as one of the two matchings.Proof.The algorithm is as follows.Let c : E(G) → {0, 1} be a cost function of the edges of G, defined as Let M be a minimum cost maximum matching in G using the cost function c.Such a matching M can be found in polynomial time [12].Due to the cost function c, a minimum cost maximum matching in G is one that minimizes the number of edges from M .Therefore, M maximizes the symmetric difference with M , over all maximum matchings of G.We verify whether |M M | ≥ k, and if so, return M .Otherwise, we correctly conclude that there is no matching satisfying the conditions of the claim.
Due to Claim 3.1, we may now assume that for each maximum matching M of G, |M M | ≤ k.We will exploit this property to give an algorithm using color coding (see e.g.[5,Chapter 5]).We color the edges of G uniformly at random with colors red and blue.For ease of exposition, we also use the notation 'red' and 'blue' to denote the set of edges that received color red and blue, respectively.
Suppose that there is a solution (M 1 , M 2 ).We say that a coloring as above is good for (M 1 , M 2 ), if the edges in M 1 \ M 2 and M 2 \ M 1 are colored red and blue, respectively.We call an edge coloring good, if it is good for some solution.To be able to show that trying 4 k colorings to achieve constant success probability suffices, we bound the size of these sets.
By Claim 3.1, we know that |M M r | ≤ k for all r ∈ {1, 2}.Since |M 1 M 2 | is the Hamming distance between sets, by the triangle inequality, This leads to the following observation.Observation 3.2.Let G be a graph, let M be a maximum matching of G, and suppose that for all maximum matchings M of G, |M M | ≤ k.Suppose the edges of G are colored uniformly at random with colors red and blue.Suppose there is a solution (M 1 , M 2 ).Then, with probability at least 2 −2k , the edge coloring is good for (M 1 , M 2 ).
Suppose that our instance is a Yes-instance, and that the edges of G are colored with a good coloring.We show how to obtain the solution in polynomial time from the edge-colored graph.Claim 3.3.Let G be a graph, M a maximum matching of G, and suppose that the edges of G are colored uniformly at random with colors red and blue.There is an algorithm that runs in polynomial time, and if the edge-coloring is good, finds two maximum matchings M 1 and M 2 in G such that |M 1 M 2 | ≥ k, and reports No otherwise.
Proof.The idea is similar to the one given in the algorithm of Claim 3.1.To find M 1 , we define the following cost function c 1 : E(G) → {0, 1}: Then, we find a minimum-cost maximum matching M 1 of G with the cost function c 1 in polynomial time [21].
1 , and M * 2 are maximum matchings of G, they have the same size.Therefore, we have that Because Notice that c Combining ( 6)-( 8), we obtain that However, c 1 (M 1 ) ≤ c 1 (M * 1 ) and c 2 (M 2 ) ≤ c 2 (M * 2 ) by the definition of these matchings and contradicting (9).We conclude that The outline of the procedure is given in Algorithm 1.It is well-known that a maximum matching of a graph can be found in polynomial time, therefore line 1 takes polynomial time.By Claims 3.1 and 3.3, lines 2 and 7, respectively, take polynomial time.Moreover, by Observation 3.2, if there is a solution, then with probability at least 2 −2k an edge-coloring as constructed in line 7 is good, in which case the algorithm finds the solution by Claim 3.3.It is clear that repeating this step 2 2k times yields a constant success probability.
The algorithm of Theorem 3 can be derandomized by standard tools (see, e.g., [5,Chapter 5]).To do so, we use the following notion of (Ω, k)-universal sets, which will replace the random coloring step in the above algorithm by deterministic choices of colorings.

For each
Let X denote the set constructed according to the two previous steps.We show that (G[X], k) is equivalent to (G, k).
the above marking algorithm added a set of 2k neighbors of u in V (G) \ V (M ) to X, denote that set by X u .For an illustration see Figure 1.Now, since X u ⊆ V (G)\V (M ), and since V (M ) is a vertex cover of G, we have that E(G[X u ]) = ∅.This means in particular that each edge in M 1 ∪ M 2 has at most one endpoint in X u .Therefore, if all vertices in X u are the endpoint of some edge in either M 1 or in M 2 , then |M 1 ∪M 2 | ≥ 2k, which implies that at least one of M 1 and M 2 contains at least k edges.Suppose w.l.o.g. that |M 1 | ≥ k.As above, any 2-partition (M 1 , M 2 ) of M 1 is such that is a solution to (G[X], k).Otherwise, there is a vertex x ∈ X u that is not the endpoint of any edge in M 1 ∪ M 2 .We obtain M r by removing uv and adding ux.Then, (M r , M 3−r ) is still a solution to (G, k), and it uses one more edge in G[X].Repeatedly applying this argument shows that (G[X], k) is a Yes-instance.
The previous claim asserts the correctness of the procedure.Since |V (M )| < 2k, and for each vertex in V (M ), we added at most 2k more vertices to X, we have that |X| = O(k 2 ).A maximal matching can be found greedily, and it is clear that the marking procedure runs in polynomial time.This yields the result.

Conclusion
In this work, we initiated the study of algorithmic problems asking for diverse pairs of (maximum/perfect) matchings, where diverse means that their symmetric difference has to be at least some value k.These problems are NP-complete on 3-regular graphs, and we showed that on bipartite graphs, they become polynomial-time solvable; while parameterized by k, they are FPT, and the problem asking for two diverse (not necessarily maximum) matchings admits a polynomial kernel.
The notion of diverse matchings opens up many natural further research directions.In this work, we considered the complexity of finding pairs of diverse matchings.What happens when we ask for a larger number of matchings?In [2,3], the measure of diversity of a set of solutions is the sum over all pairs of their symmetric difference.In this setting, we can obtain an FPTalgorithm parameterized by the number of requested matchings plus the 'diversity target' using the same approach as in our FPT-algorithm for Diverse Pair of Maximum Matchings.However, if we ask for a set of matchings M such that for each pair M 1 , M 2 ∈ M, |M 1 M 2 | ≥ k, then the situation is much less clear, even asking for three solutions.Call the corresponding problem Diverse Triples of Maximum Matchings.Is it FPT parameterized by k?
While the symmetric difference is a natural measure of diversity of two matchings, one might consider other measures as well.The diversity measure at hand may affect the complexity of the problem, so it would be interesting to see if there is an (easily computable) diversity measure under which Diverse Pair of Maximum/Perfect Matchings becomes W[1]-hard.

this 2 -
factor by F .It is constructed as follows.For each edge of M 1 take the corresponding edge of weight 1 in G into F .Then, for each edge in M 2 \ M 1 take the corresponding edge of weight 1 into F .For each edge in M 1 ∩ M 2 , take the corresponding edge of weight 0 in G into F .Clearly, F is now of weight |M 1 ∪ M 2 |, but it is not yet a 2-factor of G , unless M 1 and M 2 are perfect matchings.
Substituting these in Equation 5 we get that ((|M 1 | + |M 2 |) − |M 1 |) > n holds, which contradicts Equation 3. Now let M 1 , M 2 be two arbitrary maximum matchings of G, and let µ(G) denote the size of a maximum matching of G. Thus |M 1 | = |M 1 | = µ(G).By the definition of symmetric difference we have that |M 1

From 2 .
1 we get that we can compute the value |M 1 ∪ M 2 |-though not the matchings M 1 and M 2 -in polynomial time, by computing the weight of a maximum 2-factor in a derived graph.We can find the maximum matching size µ(G) of G in polynomial time as well.So we can compute the number 2(|M 1 ∪ M 2 | − µ(G)) in polynomial time.By the arguments in the previous paragraph, checking whether 2(|M 1 ∪M 2 |−µ(G)) ≥ k suffices to solve the bipartite instance (G, k) of Diverse Pair of Maximum Matchings.

Claim 3 . 1 .
Let G be a graph and M a maximum matching of G.One can determine in polynomial time whether G has a maximum matching M such that |M M | ≥ k, and construct such a matching if it exists.

Figure 1 :
Figure 1: Illustration of the situation in the proof of Claim 7.1.The existence of v implies that |X u | ≥ 2k, and since V (M ) is a vertex cover of G, the vertices in X u are pairwise non-adjacent.

Claim 7 . 1 .
Let G, k, M , and X be as above.Then, (G, k) is a Yes-instance of Diverse Pair of Matchings if and only [21], to find M 2 , we consider the cost function c 2 : E(G) → {0, 1}, wherec 2 (e) ..= 1, if e ∈ red 0, if e ∈ blue ∀e ∈ E(G),and find a minimum-cost maximum matching M 2 of G with cost function c 2 in polynomial time[21].Now, if |M 1 M 2 | ≥ k, then we return (M 1 , M 2 ), and we say No, otherwise.We now argue the correctness of the algorithm in the case that the edge-coloring of G was good.