Perfect matching detection
We consider the following problem: Given a bipartite graph where is a bi-partition and , our goal is to decide whether has a perfect matching.
Digression: Matching
Let us try to understand a bit the structure of the problem through a set of exercises. A matching in is a set of edges that are vertex-disjoint (i.e., for all distinct , we have ). A matching is perfect if the union of edges in (vertices incident to ) is .
The problem of finding a matching of maximum cardinality (a.k.a. maximum matching) is among the most fundamental problems in algorithms (the "big threes" in algorithms = matching, cuts, flows).
For all , present a connected graph with nodes, in which every maximum matching has only one edge.
Consider the following Heuristic A: Starting from , keep adding arbitrary edges into while possible until we cannot add anymore.
- Present a graph where this heuristic returns one edge and the optimal has two edges.
- Prove that this heuristic returns at a matching of size at least half of the optimal.
Let us further improve the heuristic (say, Heuristic A+). Starting from returned by Heuristic A, while it is possible to find and so that is a matching, update .
- Present a graph where this heuristic returns two edges and the optimal has three edges.
- Prove that this heuristic returns a matching of size at least two thirds of the optimal.
Define Heuristic A++ that strengthens A+ and achieves at least three fourths of the optimal. Prove that your heuristic returns a matching of size at least three fourths of the optimal.
Back to polynomials
Currently, there is a near linear-time algorithm for solving perfect matching in bipartite graphs. We will look at a much simpler, randomized algorithm that is highly parallelizable. In particular, we will show a randomized reduction from perfect matching to computing the determinant of a matrix - a task that admits a high degree of parallelism.
Determinants: Denote by the set of all permutations .1 For each permutation , the sign of , denoted by is a number which is either or (depending on ). We use the following definition of the determinant of matrix .
The precise definition of is quite irrelevant here, so we omit this definition.
Reduction from matching to determinant: Given a bipartite graph , we denote and . Each entry is defined to be a variable if and if there is no edge in . Notice that we have at most variables in the matrix , so is a polynomial on at most variables. The degree of is at most (each term is a product of at most distinct variables).
Polynomial is a non-zero polynomial if and only if graph has a perfect matching.
To prove the direction, let be a perfect matching, we use the permutation defined by . More formally, we define where whenever . This implies that the term is non-zero, hence is non-zero (one also needs to formally justify this, i.e. do you see why the term does not cancel out?). The other direction can be proved similarly.
Since is a polynomial of degree at most , we can test whether is identically zero by picking a random and check whether . In practice, this can be done by defining matrix where is chosen randomly and uniformly. Afterwards, compute the determinant . We argue that the probability of failure is small.
- If does not have a perfect matching, then is a zero polynomial and so is .
- If has a perfect matching, then is a non-zero polynomial of degree at most . Therefore, the probability that is at most by Theorem 48.
Footnotes
-
For instance, . ↩