Stable Marriage and Roommates problems with restricted edges: Complexity and approximability^{1}^{1}1A preliminary version of this paper appeared in the Proceedings of SAGT 2015: the 8th International Symposium on Algorithmic Game Theory.
Abstract
In the Stable Marriage and Roommates problems, a set of agents is given, each of them having a strictly ordered preference list over some or all of the other agents. A matching is a set of disjoint pairs of mutually acceptable agents. If any two agents mutually prefer each other to their partner, then they block the matching, otherwise, the matching is said to be stable. We investigate the complexity of finding a solution satisfying additional constraints on restricted pairs of agents. Restricted pairs can be either forced or forbidden. A stable solution must contain all of the forced pairs, while it must contain none of the forbidden pairs.
Dias et al. Dias et al. (2003) gave a polynomialtime algorithm to decide whether such a solution exists in the presence of restricted edges. If the answer is no, one might look for a solution close to optimal. Since optimality in this context means that the matching is stable and satisfies all constraints on restricted pairs, there are two ways of relaxing the constraints by permitting a solution to: (1) be blocked by as few as possible pairs, or (2) violate as few as possible constraints on restricted pairs.
Our main theorems prove that for the (bipartite) Stable Marriage problem, case (1) leads to hardness and inapproximability results, whilst case (2) can be solved in polynomial time. For nonbipartite Stable Roommates instances, case (2) yields an hard problem. In the case of hard problems, we also discuss polynomially solvable special cases, arising from restrictions on the lengths of the preference lists, or upper bounds on the numbers of restricted pairs.
keywords:
stable matching, restricted edge, approximation algorithmMsc:
05C70, 68W40, 05C851 Introduction
In the classical Stable Marriage problem (sm) Gale and Shapley (1962), a bipartite graph is given, where one colour class symbolises a set of men and the other colour class stands for a set of women . Man and woman are connected by edge if they find one another mutually acceptable. Each participant provides a strictly ordered preference list of the acceptable agents of the opposite gender. An edge blocks matching if it is not in , but each of and is either unmatched or prefers the other to their partner. A stable matching is a matching not blocked by any edge. From the seminal paper of Gale and Shapley Gale and Shapley (1962), we know that the existence of such a stable solution is guaranteed and one can be found in linear time. Moreover, the solutions form a distributive lattice Knuth (1976). The two extreme points of this lattice are called the man and womanoptimal stable matchings Gale and Shapley (1962). These assign each man/woman their best partner reachable in any stable matching. Another interesting and useful property of stable solutions is the socalled Rural Hospitals Theorem. Part of this theorem states that if an agent is unmatched in one stable matching, then all stable solutions leave him unmatched Gale and Sotomayor (1985).
One of the most widely studied extensions of sm is the Stable Roommates problem (sr) Gale and Shapley (1962); Irving (1985), defined on general graphs instead of bipartite graphs. The notion of a blocking edge is as defined above (except that it can now involve any two agents in general), but several results do not carry over to this setting. For instance, the existence of a stable solution is not guaranteed any more. On the other hand, there is a lineartime algorithm to find a stable matching or report that none exists Irving (1985). Moreover, the corresponding variant of the Rural Hospitals Theorem holds in the roommates case as well: the set of matched agents is the same for all stable solutions Gusfield and Irving (1989). We summarise this observation as follows:
Theorem 1.1 (Gusfield and Irving Gusfield and Irving (1989)).
Given an instance of sr, the same set of agents is matched in all stable matchings.
Both sm and sr are widely used in various applications. In markets where the goal is to maximise social welfare instead of profit, the notion of stability is especially suitable as an optimality criterion Roth (1984). For sm, the oldest and most common area of applications is employer allocation markets Roth and Sotomayor (1990). On one side, job applicants are represented, while the job openings form the other side. Each application corresponds to an edge in the bipartite graph. The employers rank all applicants to a specific job offer and similarly, each applicant sets up a preference list of jobs. Given a proposed matching of applicants to jobs, if an employer–applicant pair exists such that the position is not filled or a worse applicant is assigned to it, and the applicant received no contract or a worse contract, then this pair blocks . In this case the employer and applicant find it mutually beneficial to enter into a contract outside of , undermining its integrity. If no such blocking pair exists, then is stable. Stability as an underlying concept is also used to allocate graduating medical students to hospitals in many countries Roth (2008). sr on the other hand has applications in the area of P2P networks Gai et al. (2007).
Forced and forbidden edges in sm and sr open the way to formulate various special requirements on the sought solution. Such edges now form part of the extended problem instance: if an edge is forced, it must belong to a constructed stable matching, whilst if an edge is forbidden, it must not. In certain market situations, a contract is for some reason particularly important, or to the contrary, not wished by the majority of the community or by the central authority in control. In such cases, forcing or forbidding the edge and then seeking a stable solution ensures that the wishes on these specific contracts are fulfilled while stability is guaranteed. Henceforth, the term restricted edge will be used to refer either to a forbidden edge or a forced edge. The remaining edges of the graph are referred as unrestricted edges.
Note that simply deleting forbidden edges or fixing forced edges and searching for a stable matching on the remaining instance does not solve the problem of finding a stable matching with restricted edges. Deleted edges (corresponding to forbidden edges, or those adjacent to forced edges) can block that matching. Therefore, to meet both requirements on restricted edges and stability, more sophisticated methods are needed.
The attention of the community was drawn very early to the characterization of stable matchings that must contain a prescribed set of edges. In the seminal book of Knuth Knuth (1976), forced edges first appeared under the term arranged marriages. Knuth presented an algorithm that finds a stable matching with a given set of forced edges or reports that none exists, given an instance of sm. This method runs in time, where denotes the number of vertices in the graph. Gusfield and Irving Gusfield and Irving (1989) provided an algorithm for sm based on rotations that terminates in time, following preprocessing time, where is the set of forced edges. This latter method is favoured over Knuth’s if multiple forced sets of small cardinality are proposed.
Forbidden edges appeared only in 2003 in the literature, and were first studied by Dias et al. Dias et al. (2003). In their paper, complete bipartite graphs were considered, but the methods can easily be extended to incomplete preference lists. Their main result was the following (in the following theorem, and henceforth, is the total number of edges in the graph).
Theorem 1.2 (Dias et al. Dias et al. (2003)).
The problem of finding a stable matching in a sm instance with forced and forbidden edges or reporting that none exists is solvable in time.
While Knuth’s method relies on basic combinatorial properties of stable matchings, the other two algorithms make use of rotations. We refer the reader to Gusfield and Irving (1989) for background on these. The problem of finding a stable matching with forced and forbidden edges in an sm instance can easily be formulated as a weighted stable matching problem (that is, we seek a stable matching with minimum weight, where the weight of a matching is the sum of the weights of the edges in ). Let us assign all forced edges weight , all forbidden edges weight , and all remaining edges weight 0. A stable matching satisfying all constraints on restricted edges exists if and only if there is a stable matching of weight in the weighted instance, where is the set of forced edges. With the help of rotations, minimum weight stable matchings can be found in polynomial time Irving et al. (1987); Feder (1992); Rothblum (1992); Feder (1994) (see the final paragraph of Section 2 for more detail on the role played by each of these references).
Since finding a weightminimal stable matching in sr instances is an hard task Feder (1992), it follows that solving the problem with forced and forbidden edges requires different methods from the aforementioned weighted transformation. Fleiner et al. Fleiner et al. (2007) showed that any sr instance with forbidden edges can be converted into another stable matching problem involving ties that can be solved in time Irving and Manlove (2002) and the transformation has the same time complexity as well. Forced edges can easily be eliminated by forbidding all edges adjacent to them, therefore we can state the following result.
Theorem 1.3 (Fleiner et al. Fleiner et al. (2007)).
The problem of finding a stable matching in an sr instance with forced and forbidden edges or reporting that none exists is solvable in time.
As we have seen so far, answering the question as to whether a stable solution containing all forced and avoiding all forbidden edges exists can be solved efficiently in the case of both sm and sr. We thus concentrate on cases where the answer to this question is no. What kind of approximate solutions exist then and how can we find them?
Our contribution
Since optimality is defined by two criteria, it is straightforward to define approximation from those two points of view. In case BP, all constraints on restricted edges must be satisfied, and we seek a matching with the minimum number of blocking edges. In case CV, we seek a stable matching that violates the fewest constraints on restricted edges. The optimisation problems that arise from each of these cases are defined formally in Section 2.
In Section 3, we consider case BP: that is, all constraints on restricted edges must be fulfilled, while the number of blocking edges is minimised. We show that in the sm case, this problem is computationally hard and not approximable within for any , unless . We also discuss special cases for which this problem becomes tractable. This occurs if the maximum degree of the graph is at most 2 or if the number of blocking edges in the optimal solution is a constant. We point out a striking difference in the complexity of the two cases with only forbidden and only forced edges: the problem is polynomially solvable if the number of forbidden edges is a constant, but by contrast it is hard even if the instance contains a single forced edge. We also prove that when the restricted edges are either all forced or all forbidden, the optimisation problem remains hard even on very sparse instances, where the maximum degree of a vertex is 3.
Case CV, where the number of violated constraints on restricted edges is minimised while stability is preserved, is studied in Section 4. It is a rather straightforward observation that in sm, the setting can be modelled and efficiently solved with the help of edge weights. Here we show that on nonbipartite graphs, the problem becomes hard. As in case BP, we also discuss the complexity of degreeconstrained restrictions and establish that the hardness results remain intact even for graphs with degree at most 3, while the case with degree at most 2 is polynomially solvable.
A structured overview of our results for general sm and sr instances is contained in Table 1.
Stable Marriage  Stable Roommates  








2 Preliminaries and techniques
In this section, we introduce the notation used in the remainder of the paper and also define the key problems that we investigate later. An instance of the Stable Marriage problem (sm) consists of a bipartite graph with vertices and edges, and a set : the set of strictly ordered, but not necessarily complete preference lists. These lists are provided on the set of adjacent vertices at each vertex. The Stable Roommates problem (sr) differs from sm in one sense: the underlying graph need not be bipartite. In both sm and sr, a matching in is sought, assigning each agent to at most one partner. If a vertex is matched in , we denote by the partner of in . An edge blocks , or forms a blocking pair of if either is unmatched or prefers to , and either is unmatched or prefers to . A matching that is not blocked by any edge is called stable.
As already mentioned in the Introduction, an sr instance need not admit a stable solution. The number of blocking edges is a characteristic property of every matching. The set of edges blocking is denoted by . A natural goal is to find a matching minimising ; following the consensus in the literature, such a matching is called almost stable. This approach has a broad literature: almost stable matchings have been investigated in sm Khuller et al. (1994); Hamada et al. (2009); Biró et al. (2010) and sr Abraham et al. (2006); Biró et al. (2012) instances.
All problems investigated in this paper deal with at least one set of restricted edges. The set of forbidden edges is denoted by , while stands for the set of forced edges. We assume throughout the paper that . A matching satisfies all constraints on restricted edges if and .
In Figure 1, a sample sm instance on four men and four women can be seen. The preference ordering is shown on the edges. For instance, vertex ranks best, then , and last. The set of forbidden edges is marked by dotted grey edges. The unique stable matching contains both forbidden edges. Later on, we will return to this sample instance to demonstrate approximation concepts on it.
The first approximation concept (case BP described in Section 1) is to seek a matching that satisfies all constraints on restricted edges, but among these matchings, it admits the minimum number of blocking edges. This leads to the following problem definition.
Problem 2.1.
min bp sr restricted
Input: comprising an sr instance , a set of forbidden edges and a set of forced edges .
Output: A matching such that , and for every matching in satisfying , .
Special attention is given to two special cases of min bp sr restricted: in min bp sr forbidden, , while in min bp sr forced, . Note that an instance of min bp sr forced or min bp sr restricted can always be transformed into an instance of min bp sr forbidden by forbidding all edges that are adjacent to a forced edge. This transformation does not affect the number of blocking edges.
According to the other intuitive approximation concept (case CV described in Section 1), stability constraints need to be fulfilled, while some of the constraints on restricted edges are relaxed. The goal is to find a stable matching that violates as few constraints on restricted edges as possible.
Problem 2.2.
sr min restricted violations
Input: comprising an sr instance , a set of forbidden edges and a set of forced edges .
Output: A stable matching such that for every stable matching in .
Just as in the previous approximation concept (referred to as case BP in Section 1), we separate the two subcases with only forbidden and only forced edges. If , sr min restricted violations is referred as sr min forbidden, while if , the problem becomes sr max forced. If or then that set is omitted from an instance of min bp sr restricted or sr min restricted violations as appropriate.
When considering the decision versions of the problems defined in this section, we append dec to the problem name and add a positive integer to the problem instance. The problem is then to decide whether a feasible solution exists with measure at most . For example, in the case of the optimisation problem min bp sr forbidden, an instance of the decision problem min bp sr forbidden dec comprises a tuple , where is as per the definition of min bp sr forbidden and is a positive integer. The question is whether there is a matching such that and .
In all discussed problems, is the number of vertices and is the number of edges in the graph underlying the particular problem instance. When considering the restriction of any of the above problems to the case of a bipartite graph sr is replaced by sm in the problem name.
In case BP, the subcase with only forced edges can be transformed into the other subcase, simply by forbidding edges adjacent to forced edges. This straightforward transformation is not valid for case CV. Suppose a forced edge was replaced by an unrestricted edge, but all of its adjacent edges were forbidden. A solution that does not contain the original forced edge might contain two of the forbidden edges, violating more constraints than the original solution. Yet most of our proofs are presented for the problem with only forbidden edges, and they require only slight modifications for the case with forced edges.
A powerful tool used in several proofs in our paper is to convert some of these problems into a weighted sm or sr problem, where the goal is to find a stable matching with the lowest total edge weight, taken over all stable matchings. Irving et al. Irving et al. (1987) were the first to show that weighted sm can be solved in polynomial time, giving an algorithm if the weight function is monotone in the preference ordering, nonnegative and integral. Feder Feder (1992, 1994) showed a method to drop the monotonicity requirement. He also presented the best known bound for the running time of an algorithm for finding a minimum weight stable matching in sm: , where is the weight of an optimal solution. Redesigning the weight function to avoid the monotonicity requirement using Feder’s method can radically increase . Fortunately, linear programming techniques allow the conditions to be dropped while retaining polynomialtime solvability. A simple and elegant formulation of the sm polytope is known Rothblum (1992) and using this, a minimum weight stable matching can be computed for all realvalued weight functions in polynomial time via linear programming. For weighted sr, finding an optimal matching is hard, but 2approximable with combinatorial methods, under the assumption of monotone, nonnegative and integral weights Feder (1992). With the help of LP methods, a 2approximation can be found for every nonnegative weight function that satisfies a special monotonicity constraint Teo and Sethuraman (1997, 1998).
3 Almost stable matchings with restricted edges
In this section, constraints on restricted edges must be fulfilled strictly, while the number of blocking edges is minimised. Our results are presented in three subsections, and most of the results are given for min bp sm restricted. Firstly, in Section 3.1, basic complexity results are discussed. In particular, we prove that the studied problem min bp sm restricted is in general hard and very difficult to approximate. Thus, restricted cases are analysed in Section 3.2. First we assume that the number of forbidden, forced or blocking edges can be considered as a constant. Due to this assumption, two of the three problems that naturally follow from imposing these restrictions become tractable, but surprisingly, not all of them. Then, degreeconstrained cases are discussed. We show that the hardness result for min bp sm restricted holds even for instances where each preference list is of length at most 3, while on graphs with maximum degree 2, the problem becomes tractable. Finally, in Section 3.3 we consider the problem min bp sr restricted and briefly elaborate on whether the results established for the bipartite case carry over to the sr case.
3.1 General complexity and approximability results
When minimising the number of blocking edges, one might think that removing the forbidden edges temporarily and then searching for a stable solution in the remaining instance leads to an optimal solution. Such a matching can only be blocked by forbidden edges, but as the upcoming example demonstrates, optimal solutions are sometimes blocked by unrestricted edges exclusively. In some instances, all almost stable solutions admit only nonforbidden blocking edges. Moreover, a man or womanoptimal almost stable matching with forbidden edges does not always exist.
Let us recall the sm instance in Figure 1. In the graph with edge set , a unique stable matching exists: . Matching is blocked by both forbidden edges in the original instance. On the other hand, matching is blocked by exactly one edge: . Similarly, matching is blocked only by . Therefore, and are both solutions to min bp sm forbidden on this instance. One can easily check that and are the only matchings with the minimum number of blocking edges. They both are blocked only by unrestricted edges. Moreover, is better for and , whereas is preferred by and .
In Theorems 3.1 and 3.5 we present two results demonstrating the hardness and inapproximability of special cases of min bp sm restricted.
Theorem 3.1.
min bp sm forbidden dec and min bp sm forced dec are complete. The result holds even if all preference lists are complete.
Proof.
Clearly both problems belong to . We show the hardness of both problems by giving a reduction from the following problem:
Problem 3.2.
min bp psmi dec
Input: comprising an sm instance and a positive integer .
Output: A perfect matching such that .
min bp psmi denotes the minimisation version of min bp psmi dec, in which we seek a perfect matching with the minimum number of blocking pairs, taken over all perfect matchings in . min bp psmidec is complete, and unless , min bp psmi is not approximable within a factor of , for any Biró et al. (2010).
We firstly show hardness of min bp sm forbidden dec and then indicate how to adapt the proof to show a similar result for min bp sm forced dec. We reduce from min bp psmi dec as mentioned above. Given an instance of this problem we define an instance of min bp sm forbidden dec as follows. Let where and are the two colour classes of . Let ; then . Let and let . Add the vertices in to . In addition, new vertices representing women are added to . They are denoted by . Similarly, new men are added to . Thus, each colour class of consists of vertices.
In the preference lists of vertices already in are structured in three blocks. Each man in the original instance keeps his preference list in at the top of his new list in . After these vertices, the entire set of newlyintroduced women in follows, in arbitrary order. Finally, the rest of the women in , not already in ’s list follow, in arbitrary order. A similar ordering is used when defining the preference list of each . The original list in is followed by the vertices in , and then the rest of the men in follow.
The added newlyadded vertices in have different preference orderings. Man ’s list consists of the women in in arbitrary order, followed by , and then the women in in arbitrary order. Similarly ranks all men in first in arbitrary order, followed by , and then the men in in arbitrary order. The preference lists of the vertices in are shown in Figure 2.
:  ’s list in  rest of women in  

:  ’s list in  rest of men in  
:  women in  ()  
:  men in  () 
Having described and completely, all that remains is to specify the set of forbidden edges . Each man has forbidden edges adjacent to him, namely, all edges to the newlyintroduced vertices. Similarly, edges between every and all vertices are also forbidden. In total, has forbidden edges.
Claim 3.3.
If is a perfect matching in admitting at most blocking edges, then there is a matching in with admitting also at most blocking edges.
The construction of begins with copying to . Since is a perfect matching, all vertices in are matched to vertices in and thus, no forbidden edge can be in . The remaining vertices and are paired with each other: each is added to .
is a perfect matching in , not containing any of the forbidden edges. Next, we show that no edge in blocks that did not block already. First of all, the forbidden edges do not block , because the preference lists of the vertices already in were constructed in such a way that the vertices on preference lists in are better than the vertices in , and all vertices were matched in the perfect matching . The first choices of any newlyadded vertex in are thus not blocking edges. At the same time, all these new vertices are matched to their firstchoice partners among the newlyadded vertices. Therefore no edge incident to them can block . All that remains is to observe that edges blocking in already blocked in , because is the restriction of to . Therefore, the edges blocking and are identical.
Claim 3.4.
If is a matching in with admitting at most blocking edges, then its restriction to is a perfect matching in admitting at most blocking edges.
First, we discuss some essential structural properties of . The forbidden edges are not in , and at most of them can block it. Suppose that there is a man not married to any woman in matching . Since ranks exactly forbidden edges after its listed partners in , and forbidden edges are the first choices of their other end vertex, all of them block , regardless of the remaining edges in . Having derived a contradiction to our assumption that at most edges block in total, we can state that each man is matched in to a vertex in . Thus, the restriction of to is a perfect matching with at most blocking edges.
hardness can be obtained for min bp sm forced dec by simply forcing all edges of the form in the above reduction. ∎
We now strengthen Theorem 3.1 by giving strong lower bounds for the approximability of min bp sm forbidden and min bp sm forced. The reduction given in the proof of the next theorem builds on the reduction given in the proof of Theorem 3.1.
Theorem 3.5.
Each of min bp sm forbidden and min bp sm forced is not approximable within a factor of , for any , unless . The result holds even if all preference lists are complete.
Proof.
We will give a reduction from the following complete problem:
Problem 3.6.
exact maximal matching
Input: comprising a bipartite graph and a positive integer .
Question: Is there a maximal matching in such that ?
exact maximal matching is complete even for graphs where all vertices representing men have degree two, while all vertices of the other colour class have degree three O’Malley (2007). We show that if there were a polynomial approximation algorithm within a factor of to min bp sm forbidden, then it would also find an exact maximal matching in .
In our proof, every instance of exact maximal matching is transformed into an instance of min bp sm forbidden. We later show how to adapt the proof for min bp sm forced. Let and denote the size of each colour class in , such that .
We show that if there were a polynomial approximation algorithm with a performance guarantee of for min bp sm forbidden (where is the number of vertices in ), then it would solve exact maximal matching in polynomial time. To do so, another transformation is used, involving , an instance of min bp psmi. In Biró et al. (2010), an instance of min bp psmi is created from with special properties. One of them is that if has a maximal matching of cardinality , then has a perfect matching admitting exactly blocking edges. Otherwise, if has no maximal matching of cardinality , then any perfect matching in is blocked by at least edges, where is a huge number. To be more precise, let and (in Biró et al. (2010), the value of was the same to that used here, but the value of was slightly different). The number of vertices in each colour class of is .
Now we describe how is transformed into . Note that this method is very similar to the one we used in the proof of Theorem 3.1. Denote by and the set of men and women in , and let and denote an arbitrary man and woman in respectively. Add these vertices to and then introduce new men, namely , and new women, namely . Then each colour class in consists of vertices. The preference lists of the vertices in are shown in Figure 3.
:  ’s list in  rest of women in  ()  

:  ’s list in  rest of men in  ()  
:  all women in  women in  ()  
:  all men in  men in  () 
The set of forbidden edges comprises all edges of the form or . For min bp sm forced, the set of forced edges consists of all edges of the form . Due to this construction, and as in the proof of Theorem 3.1, if is a matching in in which there is a man not matched to a woman in , then is blocked by at least edges.
It follows that if has a maximal matching of size at most then has a matching with at most blocking pairs. On the other hand if has no maximal matching of size at most then any matching in has at least blocking pairs. Hence an approximation algorithm for min bp sm restricted or min bp sm forced could be used to solve exact maximal matching in polynomial time.
To complete the proof it remains to show that if is the number of vertices in , then . Using Inequalities 17 we give an upper bound for , whilst with Inequalities 810 we establish a lower bound. Then, combining these two in Inequalities 1114, we derive that . Explanations for the steps are given as necessary after each of the three sets of inequalities.
(1)  
(2)  
(3)  
(4)  
(5)  
(6)  
(7) 
In (2) we use that , whilst in (3) we use that by definition. To obtain (4) we omit whilst in (5) we assume that and increase all coefficients to the highest coefficient of 14. In (6) we assume that , since .
(8)  
(9)  
(10) 
In (8) we keep only from the righthand side of the equality above and use the fact that , whilst in (10) we assume without loss of generality that so (recall that ).
(11)  
(12)  
(13)  
(14) 
Here (12) follows by (1)(7); (13) follows by (8)(10) and (14) uses the fact that . ∎
3.2 Bounded parameters
Our results presented so far show that min bp sm restricted is computationally hard even if or . Yet if certain parameters of the instance or the solution can be considered as a constant, the problem can be solved in polynomial time. Theorem 3.7 firstly shows that this is true for min bp sm forbidden.
Theorem 3.7.
min bp sm forbidden is solvable in time, where , which is polynomial if is a constant.
Proof.
We firstly show how to solve min bp sm forbidden dec in polynomial time. We assume that, for the purposes of this proof, the problem definition is modified so that, given an instance , we are required to find a matching in such that and , or report that no such matching exists.
Our first observation is that this problem is trivially solvable if the target value satisfies . In this case, deleting the forbidden edges from and finding a stable matching in the remaining graph delivers a matching that is blocked in the original instance by only a subset of the removed edges (if any). Thus, a matching with and always exists.
Now assume that . Suppose firstly that there is a matching with and . If those blocking edges are deleted from , then is a stable matching in the remainder of , and contains none of the forbidden edges. Note that we did not specify which edges block : they can be both forbidden and unrestricted.
Hence to solve min bp sm forbidden dec we generate all subsets of potential blocking edges, where . After deleting the edges in from , we try to find, in the remaining graph, a matching such that and is stable, or we report that no such matching exists. By Theorem 1.2, this step can be accomplished in in time. If such a matching exists, then it admits at most blocking edges in .
Thus subsets are generated to determine whether the desired matching exists. The number of rounds is thus , while each round takes time to complete. The overall running time is .
We now show how to use the above approach in order to solve min bp sm forbidden. If we find a solution during the course of this process then admits a matching such that and . In order to minimise it suffices to use the technique in the previous paragraph in combination with a binary search procedure on values of . This requires invocations of the algorithm for the decision problem, which is a constant, and hence the overall time complexity remains . ∎
In sharp contrast to the previous result on polynomial solvability when the number of forbidden edges is small, we state the following theorem for min bp sm forced dec.
Theorem 3.8.
min bp sm forced dec is complete even if .
Proof.
The complete problem we reduce to min bp sm forced dec is exact maximal matching. As previously mentioned, this problem is complete even for graphs where all vertices representing men have degree two, while all vertices of the other side have degree three O’Malley (2007). Hence suppose we are given an instance of this restriction, where in , and are the two colour classes and is the edge set.
In this proof, we construct a min bp sm forced dec instance with a single forced edge in such a way that there is a maximal matching of cardinality in if and only if there is a matching containing the forced edge and admitting exactly blocking edges in . Our construction is based on ideas presented in Biró et al. (2010).
All vertices in rank their edges in an arbitrary but fixed order. We will refer to these labels when constructing . We now describe . The vertex set of graph in can be partitioned into seven sets: , , , , , , and , where are the men and are the women. Specific subgraphs of are referred to as gadgets, gadgets, together with a special gadget containing the forced edge; see Figure 4. Aside from these, also contains some extra vertices, the socalled garbage collectors, partitioned into two sets: and . Later we will see that these garbage collectors are paired to the vertices not covered by the matching in . To that end, and . The whole construction is illustrated in Figure 5.
Each gadget replaces a vertex in . It is defined on five vertices: and . Its edges and the preferences on them are shown in Figure 4. Two interconnecting edges connect the special gadget to , and an interconnecting edge connects the special gadget to each of and . These edges are ranked last in the case of and , and ranked as the last two edges by . It is described later which vertices of the special gadget are incident to these interconnecting edges. The gadget also has edges to all gadgets representing vertices in to which was adjacent. After describing the gadget, we elaborate on the position of these edges, referred to as relevant edges. Aside from these, every has edges to all garbage collectors in . These edges are all worse than the relevant edges of and they are ranked arbitrarily at the bottom of ’s list. The vertices in also rank all vertices arbitrarily.
The gadgets are structured similarly. Each gadget consists of seven vertices: and . Aside from the edges within the gadget, it has two interconnecting edges between and vertices in the special gadget (described in detail later), and three relevant edges between and vertices of gadgets. These are the edges drawn in accordance with the edge labels. Suppose in , edge was ranked th by and th by , where and . Then in , in the gadget is connected to in the gadget. Therefore, each edge in is transformed into a single edge in and each , and , , has exactly one relevant edge. All of these edges are second choices of both of their end vertices. In addition to these, if , but the corresponding  and a gadgets are not yet connected by , we add , which is referred as an adjacency edge. This edge is ranked by both and after their relevant edges, but ahead of their edges to garbage collectors. Similar to gadgets, gadgets are also connected to garbage collectors. Each vertex has edges to the vertices in , ranked arbitrarily at the bottom of ’s preference list. Also the vertices in rank the vertices arbitrarily.
The special gadget is defined on only six vertices in the set , where and . The unique forced edge in the entire instance is . Apart from and , they are connected to  and gadgets. In each gadget, is adjacent to and , and each of and is adjacent to . In each gadget, is adjacent to and , and each of , and is adjacent to . Moreover, and are connected to all garbage collectors of the opposite side via additional interconnecting edges. These edges are ranked last by the vertices in and . The four vertices prefer their interconnecting edges to their edges inside of the special gadget.
Claim 3.9.
Corresponding to each maximal matching in of cardinality there is a matching in with and .
Proof. First, the set of relevant edges in corresponding to is chosen. They cover exactly of the vertices of , and analogously, exactly of the vertices in .
In gadgets, where either of and has a relevant edge in , the other vertex in is matched to its copy in . The remaining two vertices of the gadget are then paired to each other. In the other case, if was unmatched in , then , and . Given the set of vertices to pair with the garbage collectors in , we find any stable matching in this subgraph and add it to . Note that this step matches the vertices to the garbage collectors in .
The strategy is similar for the gadgets. Suppose that some is already matched to a vertex in , because that relevant edge corresponds to a matching edge in . In we then match with and pair the remaining two vertices in with their partners in . Otherwise, if was unmatched in , then in , is matched to a garbage collector, and . In the subgraph induced by the garbage collectors in and the vertices corresponding to unmatched vertices we construct a stable matching and add it to . This step matches the vertices to the garbage collectors in .
In the special gadget, and are chosen.
Now we investigate the number of blocking edges incident to at least one vertex in any gadget. The edges running to garbage collectors cannot block, because restricted to that subgraph is a stable matching and vertices not matched to garbage collectors have better relevant edges in . Since all vertices are matched to their first or second choices, their edges to the special gadget do not block either. Consider now a relevant edge . Since was a maximal matching, either or is matched in . By construction of , if is matched in then prefers to , whilst if is matched in then prefers to . Regarding the adjacency edges, they only block if both of their end vertices are matched to garbage collectors. But they both are then unmatched and adjacent in , which contradicts to the fact that is maximal. The only edges remaining are in the gadgets. In each gadget, exactly one edge blocks : if was matched to its th ranked edge in , then blocks , otherwise blocks . Therefore, up to this point, we have exactly blocking edges.
Analogous arguments prove that among the edges incident to vertices in all gadgets, are blocking. In the previous paragraph we discussed that no relevant or adjacency edge blocks . The subgraph induced by the garbage collectors and vertices does not contain any blocking edge, because a stable matching was chosen and the vertices not matched to garbage collectors are all matched in to a better vertex. Edges connecting vertices and the special gadget are last choice edges of the matched vertices. In the gadget, exactly one edge blocks : if was matched and therefore , then , otherwise .
It is easy to see that in the special gadget, none of the four nonmatching edges blocks .
Claim 3.10.
Corresponding to each matching in with and there is a maximal matching in of cardinality .
Proof. First we show that if , then each  and gadget is adjacent to at least one blocking edge. Since prefers all its edges to , if is not matched in to its first or second choice edge then blocks . But then if for , it follows that blocks . The same argument applies to and . If , then has a blocking edge, otherwise blocks . Therefore, if , then each  and gadget is incident to exactly one blocking edge.
If for some gadget then each of blocks and blocks . Thus , a contradiction. Thus for any gadget. By a similar argument we can establish that for any gadget. If is unmatched in for some gadget then each of and blocks , since for any gadget. Again that would imply that , a contradiction. By a similar argument, is matched in for each gadget.
We have established that, for each gadget, exactly one of blocks for some , and for each gadget, exactly one of blocks for some , and these are the only blocking pairs of in . Hence in each gadget, is matched in for , for otherwise blocks . Similarly in each gadget, is matched in for . It also follows by a similar argument that each member of is matched in . Finally we can observe that for otherwise blocks , and for otherwise blocks .
Thus in each gadget, for some whilst