The weighted bipartite matching problem, or assignment problem, is a classical problem in graph theory: how can we find a matching with the maximum total weight (maximum matching for short) in a bipartite graph? There is a direct connection between a maximum matching and a socially optimal allocation of products to buyers in a matching market. In this market, there are buyers and product. Each product can be allocated to at most one buyer, and each buyer wants at most one product. Let be a matrix of valuations where buyer thinks product is worth dollars. Clearly, valuations constitute a complete weighted bipartite graph with left nodes representing buyers, right nodes representing products, and edges where is the weight of edge . A valid allocation of products to buyers correspond to a matching of . The weight or social welfare of a matching is the sum of over the buyer-product pair in it. So, how can we find a matching that maximizes the social welfare?
Duality and matching market
A standard approach to the maximum matching problem is the duality of linear programming. Let denote whether gets . First write down our goal in a linear program:
|(or replace by , which does not affect the solution).|
Then derive its dual program:
Many algorithms for the maximum matching problem, including the famous Hungarian algorithm proposed in the seminal work  of Kuhn in 1955, are based on duality. Those algorithms update the dual variables and dynamically to obtain a solution to the dual program which can then be converted to a maximum matching in the original linear program.
Furthermore, there is a natural economic interpretation of the duality approach. Dual variables on the product side, , can be regarded as prices. If buyer buys product , she pays and obtains a payoff of . Dual variables on the buyer side, , then become the maximum payoff buyer can obtain by selecting her most favorable product. This connection between dual variables and prices and payoffs has been discovered by Shapley and Shubik in 1971  and some following works, e.g., .
Although the duality approach and its economic interpretation are standard, a beginner who is not familiar with linear programming still cannot understand those complicated duality-based algorithms like Hungarian easily. Can we solve the maximum matching problem with simpler techniques? Fortunately, an intuitive version of Hungarian algorithm has been discussed in the textbook Networks, Crowds, and Markets by Easley and Kleinberg , solely in the language of prices and payoffs, without mentioning dual variables at all. Once we focus on prices and payoffs, the picture becomes vivid: The algorithm in  increases the price of a product when too many buyers want it, so the payoffs of that product to buyers decrease accordingly. Adding an edge to a matching corresponds to a buyer buying a product.
Moreover, when the above algorithm ends, the resulting prices obtain a nice property called market-clearing (Definition 1
). For such a price vector, the market clears in the sense that each buyer is able to buy her most favorable product (the product that maximizes her payoff ), without conflicting with other buyers. Thus, a market-clearing price vector induces a socially optimal allocation of products to buyers, exactly maximizing the weight of the matching (Property 1). In order words, finding a maximum matching in a weighted bipartite graph boils down to finding a clearing price vector in a matching market.
The market-clearing price vector may not be unique. Actually, as argued in , the set of all market-clearing price vectors is exactly the -part of the solution set to the dual linear program mentioned above, and thus has some properties like convexity. What other properties do market-clearing prices have? Can we show those properties without the help of duality?
We ask two questions concerning market-clearing prices:
If there are multiple market-clearing price vectors, what properties does the set of market-clearing price vectors have?
If there are multiple matchings with the maximum weight in a bipartite graph, can each and every maximum matching be induced by some market-clearing price vector?
We give the following answers:
Our proofs are elementary and do not involve the duality of linear programming at all. Instead, our arguments rely on a key lemma (Lemma 1) which states that all market-clearing price vectors induce a same set of maximum matchings. Then our first theorem follows almost immediately. The proof of our second theorem requires some additional knowledge of graph theory. We believe that Lemma 1 is of independent interest. We also believe that our arguments can be taught in related courses, or assigned as exercises, even at an undergraduate level, because of their appropriate level of difficulty.
Section 10 in  is an easy-to-read introduction to the bipartite matching problem. It provides a detailed description of how to update prices to satisfy the market-clearing property. One can refer to  for the duality approach and many algorithms for the bipartite matching problem.  provides a large list of variants of the assignment problem.
A matching market
There are buyers and products. Each product can be allocated (sold) to at most one buyer, and each buyer wants at most one product. Let be a matrix of valuations where buyer values product at . Valuations constitute a complete weighted bipartite graph which has left nodes representing buyers, right nodes representing products, and edges where the weight of edge is . Let be the price of product . If a buyer buys product , she pays and obtains a payoff of .
Allocation and social welfare
Clearly, a valid allocation of products to buyers correspond to a matching of , which is a subset of edges that do not share any common node with each other. Given a matching , we can define the social welfare (or the weight of ) as the sum of the valuations over all buyers for their received products,
We will focus mainly on matchings that maximize the social welfare (maximum matchings). Since we have assumed , it is never worse to choose a perfect matching, which means that the size of matching , i.e., each buyer buys some product (and all products are sold). So, we assume that maximum matchings are always perfect.
Given a set of prices , if buyer wants to maximize her payoff, she will buy a product that maximizes . Assume that she can choose any product if there are multiple products with the maximum payoff. We can describe the set of products each buyer is willing to buy by another bipartite graph, named preferred-product graph. Given a price vector , define the following sub-graph of
as the preferred-product graph of .
Preferred-product graphs have a useful property:
A perfect matching (a matching of size ) in the preferred-product , if exists, is a matching in that maximizes the social welfare.
Let be a perfect matching in . For any other matching in , if is not perfect, we complete it to be a perfect matching by allocating unsold products to unmatched buyers arbitrarily. Note that because . Then:
where the inequality follows from the fact that each is in . ∎
Definition 1 (Market-clearing prices).
A price vector is market-clearing, if its preferred-product graph contains a perfect matching.
For convenience, we say induces a matching if is a perfect matching in . For a price vector , let denote the set of matchings induced by . And we use to denote the set of all maximum (perfect) matchings in . By Definition 1, together with Fact 1, we immediately have:
Property 1 (Market-clearing prices induce maximum matchings).
For any market-clearing price vector ,
3 Space of Market-Clearing Prices
In this section we answer the first question: if there are multiple market-clearing price vectors, what properties does the space of all such price vectors have?
Theorem 1 (Closure of space).
Suppose price vectors and are market-clearing. Let be another price vector obtained by transforming and in the following four ways:
Diagonal shifting: , for any . That is, moving in the diagonal direction forward or backward.
Convex combination: , for any .
Element-wise maximum: where for each .
Element-wise minimum: where for each .
Then is also market-clearing.
Now we prove Theorem 1. The first item follows from the definition of preferred-product graph :
Proof for diagonal shifting. Note that if all prices are increased or decreased by a same amount , the quantitative relation between the payoffs of any two products remains unchanged for each buyer, so , and is market-clearing as is.
For the other three items, let be the set of all market-clearing price vectors. The second item in Theorem 1 states that is closed under convex combination. This property is also called the convexity of . For readers who are familiar with the duality approach, the convexity of may seem trivial: given that the space of market-clearing prices is exactly (a projection of) the solution set of the dual program, must be convex because the programming is linear.
However, the above argument cannot be easily generalized to prove that is also closed under element-wise maximum and minimum. In order to prove Theorem 1 without duality, we first prove the following key lemma which implies that all market-clearing price vectors induce a same set of matchings.
Lemma 1 (Same set of induced matchings).
For any two market-clearing price vectors and ,
Recall that are the sets of perfect matchings in the preferred-product graphs .
Let be a perfect matching in , we will show that is also a perfect matching in . To do this, we only need to prove that the all the edges are in .
Prove by contradiction. Suppose that edge is not in . Since is a market-clearing, there exists a perfect matching in . Because , must be matched to a product other than in . Without loss of generality, assume is matched to ; then cannot be matched to , and we assume is matched to ; …; until some , where is matched to , and must be matched back to in . Now, .
Consider and . Because is preferred in , we have . Because is preferred in and is NOT preferred in , we have: . Subtracting the two inequalities gives:
Consider other edges: is preferred in while is preferred in , we have:
Summing up the above inequalities, we have , a contradiction.
Thus, is a perfect matching in . Symmetrically, each perfect matching in is a perfect matching in . Thus . ∎
Lemma 1 is quite interesting in itself. It implies that any two preferred-product graphs, as long as they have at least one perfect matching respectively, must share the same set of all perfect matchings, even though the two graphs can be different.
Now we are ready to prove that the space is closed under all transformations besides diagonal shifting.
Element-wise maximum. For any , let where . By Lemma 1, and induce at least one common perfect matching, denoted by . Suppose is matched to in , then for any , we have:
Thus, is in , for any . As a result, is in , so .
Element-wise minimum. This can be proved by switching “” and “” in the above argument for element-wise maximum. Here we present an alternative proof which uses the closure property under diagonal shifting and convex combination. Consider the intersection between the diagonal line passing , , and line . One can easily verify that lies between and , i.e., , thus is market-clearing. Then must be market-clearing because it can be obtained by shifting diagonally.
4 Any Market-Clearing Prices Induce All Maximum Matchings
In this section we answer the second question: if there are multiple matchings with the maximum weight in a bipartite graph, can each and every maximum matching be induced by some market-clearing price vector?
Mathematically, we ask: whether for any , there exists , such that ? Clearly, this question is in the opposite direction of Property 1 () which says that the matching induced by market-clearing prices must be a maximum matching. Our Theorem 2 gives a positive answer, and even a stronger answer, saying that an arbitrary market-clearing price vector satisfies our purpose of finding all maximum matchings.
Theorem 2 (One versus all).
For any market-clearing price vector ,
In the rest of this section we prove Theorem 2.
Note that given Lemma 1 (saying for any market-clearing ), all we need to do is to find one specific market-clearing price vector such that for any given . For convenience, we re-label the nodes in such that .
We need to solve the the following system of difference constraints:
This is a classic problem and can be solved via shortest paths. Consider a directed graph with nodes . The source node has an directed edge with length to each node . Add an edge from to with length , for all , .
Now we compute the length of the shortest path from to each node . We allow a path to go through an edge multiple times. So, if there is a cycle with negative total length in this directed graph, then there must be some that can be because we can follow that negative cycle infinite times. On the contrary, if there is no such negative cycle, all , must be finite, and satisfy all the constraints because there is an edge from to with length . Setting gives an solution.
So, it remains to prove that in the directed graph constructed above, there is no negative cycle. Suppose on the contrary, there is an cycle with negative total length:
Rearranging, we get:
Thus, if we replace the sub-matching in by the sub-matching
then the social welfare of is strictly increased, contradicting the assumption that . This concludes the proof.
-  (2012) Assignment problems, revised reprint. Vol. 106, Siam. Cited by: §1.
-  (2010) Networks, crowds, and markets. Vol. 8, Cambridge university press Cambridge. Cited by: §1, §1.
-  (1955) The hungarian method for the assignment problem. Naval research logistics quarterly 2 (1-2), pp. 83–97. Cited by: §1.
-  (2007) Assignment problems: a golden anniversary survey. European Journal of Operational Research 176 (2), pp. 774–793. Cited by: §1.
Handbook of game theory with economic applications1, pp. 485–541. Cited by: §1.
-  (1971) The assignment game i: the core. International Journal of game theory 1 (1), pp. 111–130. Cited by: §1, §1.