There are already many polynomial sequential algorithms that can be used for matching, but we can make use of Polynomial Identity Testing to come up with a randomized, parallelizable algorithm (Mulmuley, Vazirani and Vazirani algorithm)
Edmond’s Matrix
Given a graph G=(L,R,E), we define a matrix XG with entries defined as follows.
Xij={xij0ifexists an edge (i,j),i∈L,j∈Rotherwise
This matrix is known as Edmond’s matrix. xij is not some constant, they are distinct variables (hence there are n2 variables possible)
We define the determinant of the matrix as
Det(X)=σ∈Sn∑sgn(σ)i∈[n]∏xiσ(i)
Here, σ is a permutation that belongs to the set Sn, the set of all permutations of length n.
When is Det(X)=0?
If the determinant of the matrix is not 0, then we know that there exists some permutation σ∈Sn such that each xiσ(i)=0. Remember that no two terms can cancel each other out since all the variables are distinct, which is why this condition is sufficient.
Theorem - Graph G has a perfect matching ⟺Det(XG)=0
G has PM ⟹Det(XG)=0
Suppose G has a perfect matching, then we essentially have a bijection mapping every li∈L to a unique ri∈R, and bijections can be seen as a permutation, hence we know that
i=1∏nXiσ(i)=i=1∏nxiσ(i)
is a non-zero monomial in the polynomial, and since we know that the monomials can’t cancel each other out, we have a non-zero determinant.
G has PM ⟸Det(XG=0)
Suppose Det(XG)=0, this means that there exists at least one permutation σ such that all terms Xiσ(i) are not 0. This indicates that each vertex li∈L got matched to vvertex rσ(i)∈R. Since σ is a bijection, we know that matching is perfect.
Using this theorem, we can come up with a sequential algorithm
Sequential Algorithm for Bipartite Matching
M←{}
For each e=(i,j)∈E,
G′=(L\{i},R\{j},E\{e})
If Det(XG)=0
G←G′
M←M∪{e}
Return M
The running time of this algorithm is m into the time complexity for computing the determinant, O(mn3)
Note that depending upon the order of edges we take, we could get different perfect matchings.
Theorem - If A is an n×n matrix, then Det(A),adj(A),A−1 can all be computed in O(log2n) time over O(n3.5) processors.
Using this theorem, we devise a parallel randomized algorithm for perfect matching.
Parallel Algorithm for Perfect Matching
Theorem - There is a randomized algorithm that finds a perfect matching in O(log2n) time using O(mn3.5) processors with probability 21.
Key Idea - We randomly assign edge weights in the graph, and show that if a perfect matching exists, there is a unique minimum perfect matching.
Isolation Lemma
Let S be a finite subset of R. Let T1,T2,…,Tk be some subsets of {1,2,…,m}. For each i∈{1,2,…,m} assign a weight uniformly and randomly from S. We define the weight of Tj as
wt(Tj)=i∈Tj∑wt(i)
The Isolation Lemma states that
P[∃js.tTj has unique min wt]≥1−∣S∣m
Proof
Suppose ∃j,j′ such that Tj and Tj′ attain the minimum weight
This implies that
i∈Tj∑wt(i)=i′∈Tj′∑wt(i′)
Let e∈Tj\Tj′, we can take wt(e) out to write the above equation as
wt(e)+i=e,i∈Tj∑wt(i)=i′∈Tj′∑wt(i)
To calculate the probability of having two non minimum matchings when using randomized values, we can use the Principle of Deferred Decisions.
Since we know that no matter what the sum of weights are in Tj\{e},Tj′, there is at most one value of wt(e) that can satisfy the equation, hence we can say that the probability is upper bounded by ∣S∣1.
We define a bad case as 2 sets Tj,Tj′ that have the same weight.
We define an event Ei such that
jmin{wt(Tj)∣i∈Tj}=j′min{wt(Tj′)∣i∈Tj′}
If Ei occurs, it implies there exists two unique matchings that achieve the minimum.
If ⋂i=1mEˉi occurs, then ∃ a unique minimum wt of Tj. (Sufficient, but not necessary condition).
We denote the matrix where row i and column j is removed as W(i,j).
Let M0 be the unique minimum weight perfect matching in G, let r=wt(M0), then
(i,j)∈M0⟺2rDet(W(i,j))2wt(i, j) is odd
The significance of this lemma is that if we know r, we can figure out if some edge e∈E belongs to the matching independently of the other edges, allowing us to parallelize the processing of edges.
(i,j)∈M0⟹2rDet(W(i,j))2wt(i, j) is odd
First, we show that if M0 is the unique minimum weight perfect matching, then 2wt(M0)Det(W) is odd.
We’ve seen earlier that we can write the determinant as
Det(W)=2wt(M0)[sgn(M0)+rest]
we know that sgn(M0) is either −1 or 1, both of which are odd. We also know that the rest of the terms are all even as they all have the coefficient 2wt(Mi)−wt(M0) (or is just 0 if σ∈M), and unique minimum weight guarantees wt(Mi)−wt(M0)>0. Therefore [sgn(M0)+rest] is odd, hence
2wt(M0)Det(W)
is odd.
Now, if we have (i,j)∈M0, we claim that M0\{(i,j)} forms a unique minimum weight perfect matching for the graph G′=(L\{i},R\{j},E′).
This can be proven using proof by contradiction -
If this isn’t the minimum weight matching, say there is some M′ perfect matching for subgraph G′ such that it’s weight is less than that of M0\{(i,j)}, we can get a better minimum perfect matching than M0 by using M′∪{(i,j)}, contradicting that M0 is the minimum weight PM.
If there doesn’t exist a unique minimum perfect matching, say there’s M′′ such that it has the same weight as M0\{(i,j)}, we can then construct another minimum matching for graph G, using M′′∪{(i,j)}, contradicting the assumption that M0 is a unique minimum PM.
If the minimum weight matching of G is 2r, then for G′ it’ll be 2r−wt(i,j).
Since we know there exists a unique minimum PM for G′, we can use the earlier claim to say that
2r−wt(i,j)Det(W(i,j))=2rDet(W(i,j))2wt(i,j)
is odd as well.
(i,j)∈M0⟸2rDet(W(i,j))2wt(i, j) is odd
We can instead show that if (i,j)∈M0, then 2rDet(W(i,j))2wt(i, j) is even.
Det(W)=σ∈Sn∑sgn(σ)i=1∏nWiσ(i)
We now break this summation into two terms, the permutations that contain σ(i)=j and those where σ(i)=j (Signify if that edge is picked or not).
We know that the LHS and the second term in the RHS are both odd. Therefore, the first term must be even.
Hence, if (i,j)∈M0, then
2rDet(W(i,j))2wt(i,j)
is even.
We then use this lemma to make the parallel algorithm
Algorithm
Compute Det(W). The determinant is bounded by n!×2max{S}⋅n≈2nlogn±O(n)×2max{S}⋅n. Hence the bit complexity is polynomial as ∣S∣=O(m).
We then binary search on r, to find the largest value such that 2r divides Det(W).
For all edges (i,j)∈E, we parallely and independently
Compute 2rDet(W(i,j))2wt(i,j)
If the result is odd, then (i,j)∈M0, else not.
We know that each edge requires O(n3.5) processors to compute the determinant in O(log2n) time, hence we require O(mn3.5) processors to compute in O(log2n) time.