 # Bipartite Envy-Free Matching

Bipartite Envy-Free Matching (BEFM) is a relaxation of perfect matching. In a bipartite graph with parts X and Y, a BEFM is a matching of some vertices in X to some vertices in Y, such that each unmatched vertex in X is not adjacent to any matched vertex in Y (so the unmatched vertices do not "envy" the matched ones). The empty matching is always a BEFM. This paper presents sufficient and necessary conditions for the existence of a non-empty BEFM. These conditions are based on cardinality of neighbor-sets, similarly to Hall's condition for the existence of a perfect matching. The conditions can be verified in polynomial time, and in case they are satisfied, a non-empty BEFM can be found by a polynomial-time algorithm. The paper presents some applications of BEFM as a subroutine in fair division algorithms.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Hall’s marriage theorem has numerous applications in mathematics, computer-science and economics. Given a bipartite graph with , Hall’s theorem gives a necessary and sufficient condition for the existence of a perfect matching, in which all vertices in both sides are matched. In case , the same conditions are necessary and sufficient for the existence of an -saturated matching, in which all vertices in are matched. Since a saturated matching does not always exist, the following relaxation may be useful.

###### Definition 1.

In a bipartite graph , an -bipartite-envy-free matching is a matching between a subset and a subset such that every unmatched vertex in is not adjacent to any matched vertex in , i.e.:

 ∀x∈X∖XM:  ∀y∈YM:  (x,y)∉E.

For brevity, instead of “-bipartite-envy-free matching” we just say “bipartite envy-free matching” or BEFM. The term “envy-free” is inspired by thinking of the vertices of as people and the vertices of as items, where an edge between a person and an item means that the person likes the item. In a BEFM, an unmatched person does not envy any matched person , because he does not like any matched item anyway.

Any -saturated matching is also a BEFM, since all members of are matched. But while the former may not exist, the latter always does: the empty matching is vacuously envy-free.

In some graphs, only the empty matching is envy-free. For example, here:

 x1→y1 x2↗y2

in any non-empty matching, some envies the other one. This raises the question: when does a non-empty BEFM exist?

Our first result is a simple sufficient condition. For every subset , denote by its neighborhood in , i.e.: .

###### Theorem 2.

In a bipartite graph , if , then there exists a non-empty bipartite-envy-free matching, and it can be found in polynomial time.

The sufficient condition is a relaxation of Hall’s condition, which requires to hold for any subset . A short proof of existence was already presented by Luria (2013). A constructive proof, that implies a polynomial-time algorithm for finding a BEFM when the condition holds, is presented in Section 2

Leveraging the sufficient condition of Theorem 2, our second result provides a different condition, which is both sufficient and necessary. It is based on the existence of a small-neighborhood subset (SNS).

###### Definition 3.

In a bipartite graph , a small-neighborhood subset is a subset for which .

###### Theorem 4.

Given a bipartite graph , it can be decided in polynomial time whether contains a non-empty small-neighborhood subset, and if so, find such subset.

For finding a BEFM, we can remove, without loss of generality, all vertices that are disconnected (have a degree of 0), since such vertices cannot participate in any matching.

###### Theorem 5.

Let be a bipartite graph with no disconnected vertices. Then contains a non-empty bipartite envy-free matching, if and only if contains a non-empty small-neighborhood subset.

Given a SNS, it is possible to find a BEFM in polynomial time.

Together, the theorems provide an efficient algorithm that finds a non-empty BEFM if-and-only-if it exists. The proofs and related algorithms are presented in Section 3.

BEFM is not entirely a new invention: we have seen similar ideas in previous papers. However, they were “hidden” inside much more complex algorithms. Our goal in presenting a stand-alone algorithm for BEFM is to make the concept more visible and easily usable as a subroutine in future algorithms. As an illustration, some old and new algorithms for fair division using BEFM as a subroutine are presented in Section 4.

## 2 Sufficient Condition

This section presents an algorithmic proof to Theorem 2.

The main idea of the algorithm is as follows. First, try to find a saturated matching in the graph. If it exists, return it. Otherwise, by Hall’s theorem, there exists a Hall violator — a vertex set that violates Hall’s condition.111 The term “Hall violator” is from Barman et al. (2018), Appendix B. Use this Hall-violator to construct a BEFM.

Algorithm 1 is a sub-routine that finds either a saturated matching or a Hall violator. Step 3 uses Koenig’s theorem for finding a minimum vertex cover in a bipartite graph. Koenig’s theorem has a constructive proof showing how to efficiently construct a minimum vertex cover from a maximum matching (Bondy and Murty, 1976)

[Lemma 5.3 in page 74]. Alternatively, a linear program can be used to simultaneously find both a maximum matching and a minimum vertex cover of the same size

(Matousek and Gärtner, 2007)[pages 144-147].

Algorithm 2 is the main routine that finds a BEFM.

Most steps in Algorithm 2 are straightforward. The only thing that needs proof is that the algorithm finishes. Indeed, whenever step 3 does not return an -saturated matching, strictly increases since we add to it the non-empty set . Therefore, eventually step 3 must return an -saturated matching for some non-empty . This matching is the required BEFM.

###### Remark 6.

When the condition does not hold, Algorithm 2 still finishes and returns a BEFM, but it might be empty: in Step 1, Algorithm 1 might return the entire set as the Hall-violator , so in Step 2, becomes , and Step 3 returns as the -saturated matching.

## 3 Full Characterization

This section proves Theorems 4 and 5.

Recall that a small-neighborhood subset (SNS) is a subset for which . We prove Theorem 4 by providing an algorithm that finds a non-empty SNS iff it exists. The algorithm is based on the following linear program.

 maximize ∑j∈Yyj−∑i∈Xxi (1) subject to yj−xi≤0 ∀(i,j)∈E 0≤xi≤1,  0≤yj≤1 ∀i∈X,j∈Y xi∈Z,  yj∈Z ∀i∈X,j∈Y

In this program, there is a variable for each node in , and a variable for each node in . Let be the subset of defined by , and the subset of defined by .

The constraints ensure that, if some vertex is in , then all its neighbors are in , so . The objective is to maximize the difference . If the value of the optimal solution is at least , then , so is the required SNS. On the other hand, if the optimal solution is negative, there is no SNS.

In general, integer linear programs are hard to solve. But in LP (1), the matrix of constraints is totally unimodular, since it satisfies the Hoffman-Gale conditions: every entry in the matrix is one of ; every row in the matrix contains at most two nonzero entries; and if there are two nonzero entries, they have opposite signs. Therefore, we can solve LP (1) without the integrality constraints, and we are guaranteed to get an integral solution that can be converted to a SNS.

The only problem is that the LP (1) does not guarantee that is non-empty. In fact, setting all variables to gives a feasible solution in which the objective value is .222We could add a constraint such as , but this would invalidate the argument of total unimodularity This issue can be handled by solving different linear programs: for each vertex , solve the LP with the constraint replaced by the constraint . If for some the objective is at least , we have found a non-empty as required. Otherwise, such does not exist. The procedure is summarized in Algorithm 3.

###### Remark 7.

(a) The definition of a SNS is similar but not identical to the definition of a Hall-violator, which is . Therefore Algorithm 1 cannot be used to find a SNS.

(b) In the bipartite expansion problem, we are given an integer and have to find a subset with such that is as small as possible. The SNS problem could easily be solved by solving bipartite expansion for all . Unfortunately, the bipartite expansion problem is NP-hard and hard to approximate (Khot and Saket, 2016; Chlamtáč et al., 2017). However, the SNS problem is easier since we are not trying to minimize . As shown above, it can be solved efficiently.

We now prove Theorem 5, which we restate shortly below:

Let be a bipartite graph with no disconnected vertices.
contains a non-empty BEFM iff contains a non-empty SNS.

###### Proof.

: Suppose contains a non-empty BEFM. Denote the matched subsets by and . By definition of a matching, . By definition of envy-freeness, , since no vertex in is a neighbor of any vertex in . By definition of a matching again, . Hence: , so is a non-empty SNS.

: Suppose contains a non-empty subset with . Define . Since the graph has no disconnected vertices, is non-empty. Define as the subset of containing only the edges between and . In the sub-graph , , so . Applying Theorem 2 to the sub-graph implies that contains a non-empty BEFM. This matching is envy-free even in the original graph , since by definition of , no vertex in is adjacent to any vertex in . ∎

Based on all the above theorems, Algorithm 4 finds a non-empty BEFM if-and-only-if it exists.

## 4 Related Work and Applications

This section surveys two classes of related works: works that present similar concepts but do not give it a name, and works that present different concepts with a similar name.

### 4.1 BEFM in fair cake-cutting

The earliest similar concept that we are aware of was presented in a lemma of Kuhn (1967, page 31). He presents the lemma in matrix notation. In graph terminology, his lemma says that a BEFM exists whenever and there is a vertex for whom . This is a special case of Theorem 2. Kuhn uses this lemma to extend a method of Steinhaus (1948) for fair cake-cutting.

In a fair cake-cutting problem, there is a heterogeneous and continuous resource (“cake”), usually thought of as the real interval . There are agents and each agent has a nonatomic value-measure on . A proportional division of is a partition into pairwise-disjoint pieces, , such that . There are various algorithms for proportional cake-cutting. One of them is now called the lone divider method. Steinhaus presented it for agents. Kuhn (1967) extended it to any number of agents. The cases and are described in detail by Brams and Taylor (1996, pages 31-35), and the general case is described in detail by Robertson and Webb (1998, pages 83-87). To demonstrate the usefulness of BEFM, we use it to present the lone divider method in a simpler way; see Algorithm 5.

###### Remark 8.

For standard cake-cutting, there are many other algorithms besides Lone Divider. However, the present author has found BEFM useful in solving a variant of it called archipelago division. In this problem, is made of disconnected islands, and we need to give each agent a subset of that overlaps at most islands, so that an agent does not have to jump between too many different islands to get from one side of his plot to the other side. The case is easy to solve, but the case is more challenging. It can be solved optimally using BEFM as a subroutine; see Segal-Halevi (2018).

### 4.2 BEFM in fair item allocation

In Procaccia and Wang (2014, subsection 3.1), we found another BEFM-like concept, hiding inside proofs of lemmas related to fair allocation of indivisible goods.333 This paper has a journal version (Kurokawa et al., 2018) where these lemmas do not appear. This problem involves a finite set of goods. There are agents. Each agent has a value measure on subsets of .

Since the goods are indivisible, a proportional allocation of the goods among the agents may not exist. Hence, the following relaxation is used. For every agent and integers , define the -out-of- maximin-share of from as:

 Mi(ldG):=  maxY∈\textscPartitions(G,d)  minZ∈\textscUnion(Y,l)  Vi(Z)

where the maximum is over all partitions of into subsets, and the minimum is over all unions of subsets from the partition. is the largest value that agent can get by dividing into piles and getting the worst piles. Obviously , with equality holding iff can be partitioned into subsets with the same value. Thus, can be thought of informally as “rounded down to the nearest good”.

The maximin share (with ) was introduced by Budish (2011). The generalization to any was introduced by Babaioff et al. (2017).

Budish (2011) asked whether there always exists a partition of in which the value of each agent is at least . For , the answer is yes — such allocation can easily be found by divide-and-choose: Alice divides using her 1-out-of-2 MMS partition, Bob chooses the pile he prefers and Alice receives the other pile.444 To find her 1-out-of-2 maximin partition, Alice has to solve the NP-hard problem Partition. However, this is not the problem of the division manager. In fact, if Alice is computationally bounded and provides a sub-optimal partition, this makes life even easier for the division manager — he can give Alice a smaller value and she cannot complain.

For , Procaccia and Wang (2014); Kurokawa et al. (2018) prove that such allocation might not exist. They present a multiplicative approximation algorithm, by which each agent receives a bundle whose value is a certain fraction . Their approximation fraction is for , and approaches when .

They then consider an ordinal approximation — a partition in which the value of each agent is at least . They say that

“We have designed an algorithm that achieves this guarantee for the case of three players (it is already nontrivial). Proving or disproving the existence of such allocations for a general number of players remains an open problem.”

They do not present the algorithm for .555 Perhaps they wanted to write it in the margin but the margin was too narrow ☺ Using BEFM as a subroutine, we could design such an algorithm. It is presented in Algorithm 6. It is very similar to the Lone Divider method for cake-cutting.

Only Step 4 requires explanation. By envy-freeness, each remaining agent values each allocated pile as less than . When , there is one remaining agent and he values the remaining goods as at least .

For , we need to show that for each remaining agent, the 1-out-of-2 maximin share of the remaining goods is at least . So we need to show that each agent can partition the remaining goods into two piles with value at least . Let be a remaining agent. Let be his 1-out-of-4 maximin partition of . For , let be the subset of that Alice took in Step 3, and the remaining subset. Now . Similarly, . Hence, the 2-partition shows that the 1-out-of-2 MMS of is at least . The same is true for both agents. Hence, divide-and-choose on the remaining goods guarantees each agent at least .

Algorithm 6 can be modified to give various other fairness guarantees. For example, it can guarantee to each agent at least his 2-out-of-7 maximin share, i.e., . In some cases, this guarantee may be better than the 1-out-of-4 MMS. For example, if contains 7 items and agent values all of them as 1, then while . Alternatively, Algorithm 6 can guarantee a multiplicative approximation, giving each agent a value of at least . It can even make different guarantees to different agents. The only required change is that in step 2, in the bipartite graph, each agent should be adjacent to pile iff is above the fairness threshold chosen by agent (e.g. or ). For each fairness criterion, we have to prove that, in step 4, if a subset whose value is below the threshold was taken, then the remaining goods can be partitioned into two subsets both of which are above the threshold. The proof for each criterion is similar to the one for and we omit it.

While there are now algorithms that attain better multiplicative approximation factors (e.g. Barman and Krishna Murthy (2017); Ghodsi et al. (2018)), it is interesting that the same simple algorithm, using BEFM, can attain both a multiplicative approximation and an ordinal approximation.

### 4.3 EFM in markets

The term envy-free matching (EFM) is used, in a somewhat more specific meaning, in the context of markets, both with and without money.

In a market with money, there are several buyers and several goods, and each good may have a price. Given a price-vector, an EFM is an allocation of bundles to agents in which each agent weakly prefers his bundle over all other bundles (given their respective prices). An EFM is a relaxation of a

Walrasian equilibrium (WEQ). A WEQ is an EFM in which every item with a positive price is allocated to some agent. In a WEQ, the seller’s revenue might be low. This motivates its relaxation to EFM, in which the seller may set reserve-prices in order to increase his expected revenue. See, for example, Guruswami et al. (2005); Alaei et al. (2012).

In a market without money, there are several people who should be assigned to positions. For example, several doctors have to be matched for residency in hospitals. Each doctor has a preference-relation on hospitals (ranking the hospitals from best to worst), and each hospital has a preference relation on doctors. Each doctor can work in at most one hospital, and each hospital can employ at most a fixed number of doctors (called the capacity of the hospital). A matching has justified envy if there is a doctor and a hospital , such that prefers over his current employer, and prefers over one of its current employees. An EFM is a matching with no justified envy. An EFM is a relaxation of a stable matching (SM). A SM is an EFM which is also non-wasteful — there is no doctor and a hospital , such that prefers over his current employer and has some vacant positions (Wu and Roth, 2018). When the hospitals have, in addition to upper quotas (capacities), also lower quotas, a SM might not exist. This motivates its relaxation to EFM, which always exists and can be found efficiently (Yokoi, 2017).

We use the term bipartite envy-free matching to differentiate it from the above market-related concepts and emphasize that it is defined for an arbitrary bipartite graph.

## 5 Future Work

In this paper we focused on finding a non-empty BEFM. For the fair division algorithms presented in Section 4, this is sufficient. However, it may be more useful to find a maximum-cardinality BEFM. The similarity to the bipartite-expansion problem hints that finding a maximum BEFM might be hard, but its exact hardness is open.

Another direction for future research is generalizing bipartite envy-free matchings to envy-free matchings in general graphs.

## 6 Acknowledgments

This paper benefited a lot from answers by Zur Luria, Yuval Filmus and Elad Horev.