In the mathematical discipline of graph theory, a matching or independent edge set in an undirected graph is a set of edges without common vertices.[1] Finding a matching in a bipartite graph can be treated as a network flow problem.
Given a graph G = (V, E), a matching M in G is a set of pairwise non-adjacent edges, none of which are loops; that is, no two edges share common vertices.
A vertex is matched (or saturated) if it is an endpoint of one of the edges in the matching. Otherwise the vertex is unmatched (or unsaturated).
A maximal matching is a matching M of a graph G that is not a subset of any other matching. A matching M of a graph G is maximal if every edge in G has a non-empty intersection with at least one edge in M. The following figure shows examples of maximal matchings (red) in three graphs.
Maximal-matching.svg
A maximum matching (also known as maximum-cardinality matching[2]) is a matching that contains the largest possible number of edges. There may be many maximum matchings. The matching number {\displaystyle \nu (G)}\nu (G) of a graph G is the size of a maximum matching. Every maximum matching is maximal, but not every maximal matching is a maximum matching. The following figure shows examples of maximum matchings in the same three graphs.
Maximum-matching-labels.svg
A perfect matching is a matching that matches all vertices of the graph. That is, a matching is perfect if every vertex of the graph is incident to an edge of the matching. Every perfect matching is maximum and hence maximal. In some literature, the term complete matching is used. In the above figure, only part (b) shows a perfect matching. A perfect matching is also a minimum-size edge cover. Thus, the size of a maximum matching is no larger than the size of a minimum edge cover: {\displaystyle \nu (G)\leq \rho (G)}{\displaystyle \nu (G)\leq \rho (G)}. A graph can only contain a perfect matching when the graph has an even number of vertices.
A near-perfect matching is one in which exactly one vertex is unmatched. Clearly, a graph can only contain a near-perfect matching when the graph has an odd number of vertices, and near-perfect matchings are maximum matchings. In the above figure, part © shows a near-perfect matching. If every vertex is unmatched by some near-perfect matching, then the graph is called factor-critical.
Given a matching M, an alternating path is a path that begins with an unmatched vertex[3] and whose edges belong alternately to the matching and not to the matching. An augmenting path is an alternating path that starts from and ends on free (unmatched) vertices. Berge’s lemma states that a matching M is maximum if and only if there is no augmenting path with respect to M.
An induced matching is a matching that is the edge set of an induced subgraph.[4]
In any graph without isolated vertices, the sum of the matching number and the edge covering number equals the number of vertices.[5] If there is a perfect matching, then both the matching number and the edge cover number are |V | / 2.
If A and B are two maximal matchings, then |A| ≤ 2|B| and |B| ≤ 2|A|. To see this, observe that each edge in B \ A can be adjacent to at most two edges in A \ B because A is a matching; moreover each edge in A \ B is adjacent to an edge in B \ A by maximality of B, hence
{\displaystyle |A\setminus B|\leq 2|B\setminus A|.}{\displaystyle |A\setminus B|\leq 2|B\setminus A|.}
Further we deduce that
{\displaystyle |A|=|A\cap B|+|A\setminus B|\leq 2|B\cap A|+2|B\setminus A|=2|B|.}|A|=|A\cap B|+|A\setminus B|\leq 2|B\cap A|+2|B\setminus A|=2|B|.
In particular, this shows that any maximal matching is a 2-approximation of a maximum matching and also a 2-approximation of a minimum maximal matching. This inequality is tight: for example, if G is a path with 3 edges and 4 vertices, the size of a minimum maximal matching is 1 and the size of a maximum matching is 2.
A spectral characterization of the matching number of a graph is given by Hassani Monfared and Mallik as follows: Let {\displaystyle G}G be a graph on {\displaystyle n}n vertices, and {\displaystyle \lambda _{1}>\lambda _{2}>\ldots >\lambda _{k}>0}{\displaystyle \lambda _{1}>\lambda _{2}>\ldots >\lambda _{k}>0} be {\displaystyle k}k distinct nonzero purely imaginary numbers where {\displaystyle 2k\leq n}{\displaystyle 2k\leq n}. Then the matching number of {\displaystyle G}G is {\displaystyle k}k if and only if (a) there is a real skew-symmetric matrix {\displaystyle A}A with graph {\displaystyle G}G and eigenvalues {\displaystyle \pm \lambda _{1},\pm \lambda _{2},\ldots ,\pm \lambda _{k}}{\displaystyle \pm \lambda _{1},\pm \lambda _{2},\ldots ,\pm \lambda _{k}} and {\displaystyle n-2k}{\displaystyle n-2k} zeros, and (b) all real skew-symmetric matrices with graph {\displaystyle G}G have at most {\displaystyle 2k}2k nonzero eigenvalues.[6] Note that the (simple) graph of a real symmetric or skew-symmetric matrix {\displaystyle A}A of order {\displaystyle n}n has {\displaystyle n}n vertices and edges given by the nonozero off-diagonal entries of {\displaystyle A}A.
Main article: Matching polynomial
A generating function of the number of k-edge matchings in a graph is called a matching polynomial. Let G be a graph and mk be the number of k-edge matchings. One matching polynomial of G is
{\displaystyle \sum {k\geq 0}m{k}x^{k}.}\sum {k\geq 0}m{k}x^{k}.
Another definition gives the matching polynomial as
{\displaystyle \sum _{k\geq 0}(-1){k}m_{k}x{n-2k},}\sum _{k\geq 0}(-1){k}m_{k}x{n-2k},
where n is the number of vertices in the graph. Each type has its uses; for more information see the article on matching polynomials.