Hubbry Logo
Matching (graph theory)Matching (graph theory)Main
Open search
Matching (graph theory)
Community hub
Matching (graph theory)
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Matching (graph theory)
Matching (graph theory)
from Wikipedia

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] In other words, a subset of the edges is a matching if each vertex appears in at most one edge of that matching. Finding a matching in a bipartite graph can be treated as a network flow problem.

Definitions

[edit]

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.

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 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.

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. A matching is perfect if . 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: . 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 (c) 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]

Properties

[edit]

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

Further we deduce that

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 be a graph on vertices, and be distinct nonzero purely imaginary numbers where . Then the matching number of is if and only if (a) there is a real skew-symmetric matrix with graph and eigenvalues and zeros, and (b) all real skew-symmetric matrices with graph have at most nonzero eigenvalues.[6] Note that the (simple) graph of a real symmetric or skew-symmetric matrix of order has vertices and edges given by the nonozero off-diagonal entries of .

Matching polynomials

[edit]

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

Another definition gives the matching polynomial as

where n is the number of vertices in the graph. Each type has its uses; for more information see the article on matching polynomials.

Algorithms and computational complexity

[edit]

Maximum-cardinality matching

[edit]

A fundamental problem in combinatorial optimization is finding a maximum matching. This problem has various algorithms for different classes of graphs.

In an unweighted bipartite graph, the optimization problem is to find a maximum cardinality matching. The problem is solved by the Hopcroft-Karp algorithm in time O(VE) time, and there are more efficient randomized algorithms, approximation algorithms, and algorithms for special classes of graphs such as bipartite planar graphs, as described in the main article.

Maximum-weight matching

[edit]

In a weighted bipartite graph, the optimization problem is to find a maximum-weight matching; a dual problem is to find a minimum-weight matching. This problem is often called maximum weighted bipartite matching, or the assignment problem. The Hungarian algorithm solves the assignment problem and it was one of the beginnings of combinatorial optimization algorithms. It uses a modified shortest path search in the augmenting path algorithm. If the Bellman–Ford algorithm is used for this step, the running time of the Hungarian algorithm becomes , or the edge cost can be shifted with a potential to achieve running time with the Dijkstra algorithm and Fibonacci heap.[7]

In a non-bipartite weighted graph, the problem of maximum weight matching can be solved in time using Edmonds' blossom algorithm.

Maximal matchings

[edit]

A maximal matching can be found with a simple greedy algorithm. A maximum matching is also a maximal matching, and hence it is possible to find a largest maximal matching in polynomial time. However, no polynomial-time algorithm is known for finding a minimum maximal matching, that is, a maximal matching that contains the smallest possible number of edges.

A maximal matching with k edges is an edge dominating set with k edges. Conversely, if we are given a minimum edge dominating set with k edges, we can construct a maximal matching with k edges in polynomial time. Therefore, the problem of finding a minimum maximal matching is essentially equal to the problem of finding a minimum edge dominating set.[8] Both of these two optimization problems are known to be NP-hard; the decision versions of these problems are classical examples of NP-complete problems.[9] Both problems can be approximated within factor 2 in polynomial time: simply find an arbitrary maximal matching M.[10]

Counting problems

[edit]

The number of matchings in a graph is known as the Hosoya index of the graph. It is #P-complete to compute this quantity, even for bipartite graphs.[11] It is also #P-complete to count perfect matchings, even in bipartite graphs, because computing the permanent of an arbitrary 0–1 matrix (another #P-complete problem) is the same as computing the number of perfect matchings in the bipartite graph having the given matrix as its biadjacency matrix. However, there exists a fully polynomial time randomized approximation scheme for counting the number of bipartite matchings.[12] A remarkable theorem of Kasteleyn states that the number of perfect matchings in a planar graph can be computed exactly in polynomial time via the FKT algorithm.

The number of perfect matchings in a complete graph Kn (with n even) is given by the double factorial (n − 1)!!.[13] The numbers of matchings in complete graphs, without constraining the matchings to be perfect, are given by the telephone numbers.[14]

The number of perfect matchings in a graph is also known as the hafnian of its adjacency matrix.

Finding all maximally matchable edges

[edit]

One of the basic problems in matching theory is to find in a given graph all edges that may be extended to a maximum matching in the graph (such edges are called maximally matchable edges, or allowed edges). Algorithms for this problem include:

  • For general graphs, a deterministic algorithm in time and a randomized algorithm in time .[15][16]
  • For bipartite graphs, if a single maximum matching is found, a deterministic algorithm runs in time .[17]

Online bipartite matching

[edit]

The problem of developing an online algorithm for matching was first considered by Richard M. Karp, Umesh Vazirani, and Vijay Vazirani in 1990.[18]

In the online setting, nodes on one side of the bipartite graph ("clients") arrive one at a time and must either be immediately matched to the other side of the graph ("servers") or discarded. This is a natural generalization of the secretary problem and has applications to online ad auctions. A simple greedy algorithm is 1/2-competitive. For the unweighted maximization case with a random arrival model, Karp, Vazirani and Vazirani gave a randomized algorithm that attains a competitive ratio of 0.632. The bound was later improved to 0.696.[19] The problem was also studied in a model where clients may switch servers in order to improve the matching, and the goal is to economize on the number of switches while achieving a maximum matching.[20]

Characterizations

[edit]

Kőnig's theorem states that, in bipartite graphs, the maximum matching is equal in size to the minimum vertex cover. Via this result, the minimum vertex cover, maximum independent set, and maximum vertex biclique problems may be solved in polynomial time for bipartite graphs.

Hall's marriage theorem provides a characterization of bipartite graphs which have a perfect matching and Tutte's theorem on perfect matchings provides a characterization for arbitrary graphs.

Applications

[edit]

Matching in general graphs

[edit]

Matching in bipartite graphs

[edit]

See also

[edit]

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
In graph theory, a matching is a set of edges in an undirected graph that do not share a common vertex. The size of a matching is defined as the number of edges it contains, and a matching is called maximum if no larger matching exists in the graph. A perfect matching is a special case where every vertex in the graph is incident to exactly one edge in the matching, thereby covering all vertices. Matchings are fundamental structures in graph theory, with significant results distinguishing behaviors in bipartite graphs—those with vertices partitioned into two disjoint sets where edges only connect vertices between the sets—from general graphs. In bipartite graphs, König's theorem establishes that the size of a maximum matching equals the size of a minimum vertex cover, a duality that enables efficient optimization techniques. Additionally, Hall's marriage theorem provides a necessary and sufficient condition for the existence of a perfect matching from one partite set to the other: for every subset of vertices in the first set, the number of neighbors in the second set is at least as large as the subset's size. For general non-bipartite graphs, finding maximum matchings is more complex due to the possible formation of odd cycles, but Edmonds' blossom algorithm resolves this by iteratively searching for augmenting paths while contracting "blossoms"—odd cycles that obstruct larger matchings—achieving a polynomial-time solution with time complexity O(V4)O(V^4), where VV is the number of vertices. Tutte's theorem offers a structural characterization of graphs admitting perfect matchings, stating that a graph has a perfect matching if and only if for every subset of vertices, the number of odd components in the graph induced by removing that subset does not exceed the subset's size. These theorems and algorithms underpin applications in , such as and network flow problems.

Basic Concepts

Definitions

In graph theory, a matching in an undirected graph G=(V,E)G = (V, E) is formally defined as a subset MEM \subseteq E of edges such that no two edges in MM share a common vertex. This ensures that each edge in the matching pairs distinct vertices without overlap. The size of a matching, also known as its cardinality, is denoted by M|M| and represents the number of edges in the set. Basic examples include the empty matching M=M = \emptyset, which has cardinality 0 and covers no vertices; a single-edge matching, consisting of one edge and covering exactly two vertices; and a perfect matching, which is a matching that covers every vertex in VV, requiring V|V| to be even and satisfying M=V/2|M| = |V|/2. For a matching MM in a graph GG, a vertex vVv \in V is said to be MM-saturated if it is incident to an edge in MM, and MM-unsaturated otherwise. In a , there are no MM-unsaturated vertices. While the concept of a matching is primarily developed for undirected graphs, it extends to directed graphs (digraphs), where a matching is a set of with no common end-vertices (neither heads nor tails shared). However, the and applications focus predominantly on undirected graphs. A matching is maximal if it cannot be extended by adding another edge from EME \setminus M.

Types of Matchings

In graph theory, matchings can be classified based on their size and structural properties relative to the graph. A maximal matching is a matching that cannot be extended by the addition of any single edge from the graph, meaning there is no edge that can be added without violating the matching condition of disjoint endpoints. This property holds if the matching leaves no unsaturated vertices adjacent to each other via an unused edge. A maximum matching, in contrast, is a matching of the largest possible cardinality among all matchings in the graph, saturating the maximum number of vertices without necessarily being extendable in every local sense. Every maximum matching is maximal, but the converse does not hold, as some maximal matchings may be smaller than the optimal size. A perfect matching is a maximum matching that covers every vertex in the graph, pairing all vertices exactly once; this requires the graph to have an even number of vertices. The term "perfect matching" emerged in early 20th-century graph theory literature, reflecting its role in enumerative problems like those in chemical bond structures. For graphs with an odd number of vertices, a near-perfect matching is a maximum matching that covers all vertices except exactly one, leaving a single unsaturated vertex. An induced matching is a matching such that the subgraph induced by its saturated vertices consists solely of the matching edges themselves, with no additional edges between those vertices in the original graph. This ensures the matched edges are pairwise non-adjacent, even indirectly through other paths. To illustrate the distinctions, consider the P4P_4 with vertices labeled 1-2-3-4 and edges between consecutive vertices. The single edge {2-3} forms a maximal matching of size 1, as no other edge can be added without sharing a vertex, but it is not maximum, since {1-2, 3-4} achieves size 2. In the complete graph K2nK_{2n} with 2n2n vertices, perfect matchings exist, such as pairing vertices into nn disjoint edges, covering all vertices completely.

Properties and Characterizations

Fundamental Properties

In , an alternating path with respect to a matching MM in a graph GG is a path where the edges alternate between those in MM and those not in MM, typically starting and ending with edges not in MM. Such paths play a central role in analyzing the structure of matchings, as they highlight potential ways to extend or modify MM. An augmenting path is a specific type of alternating path that starts and ends at unsaturated vertices (vertices not incident to any edge in MM); the between MM and the edges of this path yields a larger matching, thereby increasing the size of MM by one. The existence of an augmenting path relative to MM indicates that MM is not a maximum matching. The Gallai-Edmonds decomposition provides a structural partition of the vertices of any graph GG into three sets: D(G)D(G), the vertices not covered by at least one maximum matching; A(G)A(G), the vertices adjacent to D(G)D(G); and C(G)=V(G)(D(G)A(G))C(G) = V(G) \setminus (D(G) \cup A(G)), where C(G)C(G) consists of components that are factor-critical (each has a near-perfect matching missing any single vertex). This decomposition reveals the matching-covered components of GG, with the maximum matching size given by 12(V(G)D(G)+o(C(G)))\frac{1}{2} (|V(G)| - |D(G)| + o(C(G))), where o(C(G))o(C(G)) is the number of components in the subgraph induced by C(G)C(G). It underscores the inherent barriers to perfect matchings in general graphs, distinguishing regions where matchings can be extended from those that remain partially unsaturated. In bipartite graphs, König's theorem establishes that the size of a maximum matching equals the size of a minimum , providing a duality between these concepts that does not hold in general graphs. This property implies tight bounds on structures relative to matching capacity in bipartite settings. Relatedly, the minimum edge cover of a graph GG can be constructed from a maximum matching MM by adding, for each unsaturated vertex, an arbitrary incident edge not in MM; the size of this edge cover is V(G)ν(G)|V(G)| - \nu(G), where ν(G)\nu(G) is the matching number. Every graph admits at least one maximal matching, obtained by greedily selecting non-adjacent edges until no more can be added without violating the matching condition. However, the number of distinct maximum matchings in a graph can be exponential in the number of vertices, as seen in complete bipartite graphs Kn,nK_{n,n} where the count equals n!n!.

Key Theorems and Characterizations

One of the foundational results in matching theory is , which provides a necessary and sufficient condition for the existence of a in s. Consider a G=(UW,E)G = (U \cup W, E) with bipartition UU and WW, where U=W|U| = |W|. The theorem states that GG has a for every subset SUS \subseteq U, the size of the neighborhood N(S)N(S) satisfies N(S)S|N(S)| \geq |S|. This condition ensures that no subset of one side is underserved by connections to the other side. A proof sketch relies on the concept of deficiency: define the deficiency of SUS \subseteq U as \def(S) = |S| - |N(S)|, and the overall deficiency as \max_{S \subseteq U} \def(S). The theorem holds because a exists precisely when the deficiency is zero; if positive, the maximal deficient set obstructs a complete assignment, and conversely, one can construct a system of distinct representatives iteratively by expanding matchings along unsaturated vertices until the condition is satisfied. Extending this to general graphs, Tutte's theorem characterizes the existence of perfect matchings without bipartiteness assumptions. For a graph G=(V,E)G = (V, E) with even V|V|, GG has a perfect matching if and only if for every subset SVS \subseteq V, the number of odd components o(GS)o(G - S) in the subgraph induced by VSV \setminus S satisfies o(GS)So(G - S) \leq |S|. This condition accounts for potential barriers created by subsets SS that leave too many isolated odd-sized components unmatched. The proof involves constructing a from GG by duplicating vertices and applying Hall's theorem, where violations correspond to subsets exceeding the bound; equality ensures a 1-factorization in the auxiliary graph, yielding the perfect matching in GG. Building on Tutte's result, the Berge-Tutte formula provides a min-max characterization of the size of a maximum matching in any graph. The matching number ν(G)\nu(G), the of a maximum matching, is given by ν(G)=12minSV(Vo(GS)+S).\nu(G) = \frac{1}{2} \min_{S \subseteq V} \left( |V| - o(G - S) + |S| \right). This formula derives from Tutte's theorem by observing that the deficiency across all possible barriers SS determines the unmatched vertices: if ν(G)=Vd2\nu(G) = \frac{|V| - d}{2} for some deficiency dd, then the maximum over SS of o(GS)So(G - S) - |S| equals dd, as the optimal SS maximizes the excess odd components relative to the barrier size, and rearranging yields the expression. For bipartite graphs, this specializes to König's theorem, where o(GS)o(G - S) counts unsaturated vertices appropriately, unifying the cases. Edmonds' matching polytope theorem states that the convex hull of incidence vectors of matchings in a graph is defined by non-negativity, degree constraints (sum of edges at each vertex ≤1), and odd-set constraints (for every odd-sized S of vertices, sum of edges within S ≤ (|S|-1)/2). This proves the integrality of the relaxation, allowing polynomial-time computation of maximum matchings via , unifying bipartite and general cases under polyhedral . Factor-critical graphs, also known as hypomatchable graphs, are those in which the removal of any single vertex leaves a graph with a perfect matching; equivalently, they have an odd number of vertices and no perfect matching themselves but near-perfect matchings avoiding any specified vertex. A structural characterization is that a connected graph GG is factor-critical if and only if it admits an odd decomposition: starting from a single vertex, repeatedly adding paths (ears) between existing vertices such that the total number of vertices remains odd at each step. These graphs form the building blocks in the Gallai-Edmonds of arbitrary graphs, highlighting their role in describing maximum matchings. These theorems trace their origins to key developments in the mid-20th century: Hall's work in addressed bipartite systems of representatives, Tutte's 1947 contribution generalized to arbitrary graphs amid factorization studies, and Berge's 1957 refinement introduced the min-max formula, paving the way for Edmonds' integrative polyhedral perspective in 1965.

Algorithms and Complexity

Maximum-Cardinality Matching

A maximum-cardinality matching, also known as a maximum matching, is a matching in a graph that contains the largest possible number of edges among all matchings in that graph. The size of such a matching, denoted ν(G)\nu(G), provides a measure of how well the vertices can be paired without sharing endpoints. Finding a maximum matching is a fundamental problem in , with applications in optimization and combinatorial structures, and it is solvable in polynomial time for both bipartite and general graphs. In bipartite graphs, the problem can be reduced to computing a maximum flow in a constructed as follows: add a source connected by edges of capacity 1 to all vertices in one part, and a connected similarly from the other part, with all original edges having capacity 1. The value of the maximum flow equals the size of the maximum matching, as each unit of flow corresponds to an unmatched path from source to that augments the matching. By König's theorem, this size also equals the minimum size in the . An efficient algorithm for bipartite graphs is the , which runs in O(VE)O(\sqrt{|V|} |E|)
Add your contribution
Related Hubs
User Avatar
No comments yet.