Introduction
A matching pairs up vertices along edges so that no vertex is used twice: assigning workers to jobs they are qualified for, students to projects, or tasks to processors. The central questions are how large a matching can be, when every vertex can be matched, and how matchings relate to other covering problems (vertex covers, edge covers, independent sets). Bipartite matching is solvable in polynomial time and has exact min-max theorems; these are the results developed in the sections that follow.
Prerequisites
- Graph Theory Fundamentals: bipartite graphs, degrees, paths, special graphs. Graphs are simple and undirected.
Core concepts
Definitions
Let with .
- A matching is a set of edges, no two sharing an endpoint. A vertex incident to an edge of is matched (saturated); otherwise it is unmatched (exposed).
- is maximal if no edge of can be added to it (every edge of touches a matched vertex).
- is maximum if no matching of has more edges. Its size is the matching number , also written .
- is perfect if every vertex is matched; then , so must be even.
Every maximum matching is maximal; a maximal matching need not be maximum. In the path , is maximal (both other edges touch or ) but is larger and perfect.
Maximal versus maximum bound: if is maximal, then . Each edge of a maximum matching has an endpoint matched by , and each edge of has only two endpoints. So the greedy algorithm (add any edge whose ends are both free) is within a factor 2.

Matching numbers of standard graphs
| Graph | Perfect matching? | |
|---|---|---|
| Path ( vertices) | if and only if even | |
| Cycle | if and only if even | |
| Complete graph | if and only if even | |
| if and only if | ||
| Star | 1 | only for |
| Hypercube , | yes | |
| Petersen graph | 5 | yes |
Counting perfect matchings. has perfect matchings (match the lowest-numbered free vertex to any of the remaining, repeat). has (a perfect matching is a bijection between the sides). has 2.
Augmenting paths and Berge's theorem
Given a matching , an -alternating path alternates between edges not in and edges in . An -augmenting path is an alternating path whose two ends are both unmatched. Swapping the edges along it (taking the symmetric difference ) gives a matching with one more edge.
Berge's theorem: is a maximum matching if and only if there is no -augmenting path.
This yields the standard algorithm: start with any matching and repeatedly find an augmenting path. For bipartite graphs, each search is a BFS or DFS, giving time; the Hopcroft-Karp algorithm improves this to . Bipartite matching also reduces to maximum flow. General graphs need Edmonds' blossom algorithm, still polynomial.
Hall's marriage theorem
Let be bipartite with parts and . For , let be the set of vertices adjacent to some vertex of .
The condition is clearly necessary (the vertices of need distinct partners in ); Hall's theorem says it is also sufficient. To show that no -saturating matching exists, exhibit one set with (a Hall violator).
Corollaries.
- If and Hall's condition holds, the matching is perfect.
- Every -regular bipartite graph with has a perfect matching. (Counting edges: .) Repeating this, its edges split into perfect matchings.
- Deficiency version: , where the maximum includes .
Covers and independent sets
| Concept | Definition | Number |
|---|---|---|
| Independent set | vertices, no two adjacent | = maximum size |
| Vertex cover | vertices touching every edge | (also ) = minimum size |
| Matching | edges, no two sharing a vertex | = maximum size |
| Edge cover | edges touching every vertex | = minimum size (needs no isolated vertices) |
Relations (for any graph on vertices):
- is independent if and only if is a vertex cover, so .
- Gallai: if has no isolated vertices, .
- always (each matching edge needs its own cover vertex), and (the ends of a maximal matching cover all edges).
- Konig's theorem: if is bipartite, . This fails for odd cycles: but .
- For bipartite without isolated vertices, combining the above, .
Finding or is NP-hard for general graphs, but polynomial for bipartite graphs by Konig's theorem.
Worked examples
Example 1: Hall violator
Bipartite graph with , and edges . For , , so . No perfect matching exists. Deficiency is the largest, so (for example ).
Example 2: counting perfect matchings
: perfect matchings. : . : none (sides unequal), but matchings saturate the side of size 3.
Example 3: covers in a non-bipartite graph
For : , , , . Checks: , , and as for every odd cycle, whose maximum matching has edges and minimum vertex cover has vertices.
Example 4: augmenting path
In the path with , the vertices and are unmatched, and alternates (non-, , non-, , non-). Swapping gives , a perfect matching.
Example 5: building a maximum matching by successive augmenting paths
Take the bipartite graph with parts and and edges , , , , , .
Start with . The free vertices in are ; in they are .
- From free , the edge reaches the matched vertex . Crossing the matching edge and then the free edge reaches free . So is an -augmenting path. Symmetric difference gives .
- From free , the edge reaches free , a length-1 augmenting path. Symmetric difference gives .
Now every vertex is matched, so is perfect and therefore maximum: . By Berge's theorem there is no further augmenting path. An independent check: the three edges of form a matching, and a vertex cover of size 3 (for example , or ) proves ; with always, both equal 3 (Konig).
The same also admits a longer augmenting path , whose symmetric difference yields the different perfect matching . Either route reaches size .
Example 6: Hall's condition and Konig's theorem on one graph
Reuse the bipartite graph of Example 1: parts , , edges , , , , , , .
- Hall violator. For , , so . No matching saturates . The deficiency formula gives .
- Explicit maximum matching. has size 3. (The leftover unmatched pair is and ; no edge joins them, and every neighbour of is already matched.)
- Konig certificate. The set is a vertex cover of size 3: every listed edge touches , or . So . Combined with and , one gets . Konig's equality holds even though Hall's condition for an -saturating matching fails: the theorem equates matching number with cover number; it does not force a perfect matching.
Important properties and observations
- A graph with an odd number of vertices has no perfect matching.
- Removing a vertex set that leaves more than components with an odd number of vertices rules out a perfect matching (Tutte's condition, the general-graph analogue of Hall).
- A tree has at most one perfect matching.
- The size of any matching is at most the size of any vertex cover (weak duality); for bipartite graphs the two optima meet (strong duality, Konig).
- Every maximal matching has size between and .
Standard confusions.
- Maximal versus maximum. Maximal means no edge can be added; maximum means largest possible size. Every maximum matching is maximal, but not conversely (the path with is the standard counterexample).
- Perfect versus complete. A perfect matching saturates every vertex of . A matching that saturates every vertex of one part (but not necessarily of ) is an -saturating matching, sometimes called a complete matching of into . Perfect requires as well.
- Even order. A perfect matching needs an even number of vertices, because matched vertices come in pairs. An odd-order graph never has a perfect matching, no matter how dense its edges are. Completeness of the graph () does not remove this obstruction when is odd: .
GATE examination perspective
- Compute . For special graphs use the table; for small graphs find a matching and a vertex cover of the same size (in bipartite graphs) to prove optimality.
- Hall's condition. Look for a set of left vertices with too few neighbours.
- Counting perfect matchings. for , for , 2 for an even cycle.
- Covers. ; without isolated vertices. The equality is guaranteed for bipartite graphs; some non-bipartite graphs also satisfy it, but not all.
- Trap: maximal is not maximum.
- Trap: applying Konig's theorem to a non-bipartite graph.
- Augmenting-path construction. From any matching, search for an augmenting path; each success increases the size by one until Berge's condition holds.
- Konig certificate. In a bipartite graph, a matching and a vertex cover of equal size prove both are optimal.
Summary
Sources
- K. H. Rosen, Discrete Mathematics and Its Applications, 7th ed., McGraw-Hill, 2012: Section 10.2 (Graph Terminology and Special Types of Graphs).
- D. B. West, Introduction to Graph Theory, 2nd ed., Prentice Hall, 2001: Section 3.1 (Matchings and Covers).