Definition · Matchings, and Hall's conditionIn a bipartite graph with parts X and Y, a matching is a set of edges no two of which share a vertex. It saturates X when every member of X is in one of its edges.
For S ⊆ X, write N(S) for the set of vertices in Y joined to at least one member of S. Hall's condition is that |N(S)| ≥ |S| for every S ⊆ X.
Theorem · Hall's marriage theoremA bipartite graph has a matching saturating X if and only if |N(S)| ≥ |S| for every subset S of X.
Discrete Mathematics states this in “Bipartite Graphs” and does not prove the sufficient direction. This lesson supplies it as a consequence of max-flow min-cut, and does so constructively: when the maximum matching misses a vertex, the minimum cut of the flow network exhibits the violating S.
The reduction is short enough to keep in your head. Add a source with a capacity-one arc to each member of X; keep every edge of the graph as an arc of capacity one; add a sink with a capacity-one arc from each member of Y. On a three-applicant, two-job instance that is seven nodes and eleven arcs.
the graph 1-a 1-b 2-a 2-b 3-a 3-b
the network src>1 src>2 src>3 each capacity 1
1>a 1>b 2>a 2>b 3>a 3>b each capacity 1
a>snk b>snk each capacity 1
7 nodes, 11 arcs
maximum flow 2 and the linear programme agrees: 2
maximum matching 2 of 3
minimum cut {src, 1, 2, 3, a, b} capacity 2
S = the applicants on the source side = {1, 2, 3}
N(S) = {a, b}
|N(S)| - |S| = -1 Hall FAILS on S
Both jobs are filled, and an applicant is still left out. Those two sentences are not in tension: there are three applicants and two jobs, and a matching saturating the applicants would need three distinct jobs. The certificate is the whole of X here, and it takes one sentence to check — all three applicants will take only a or b, and there are two of those.
The deficient set need not be everybody
Example · Three sharing one job, and a fourth with three of its ownEdges 1-a, 2-a, 3-a, 4-b, 4-c, 4-d. The maximum matching has two edges out of a possible four, the minimum cut has capacity 2, and the deficient set the cut names is S = {1, 2, 3} with N(S) = {a}.
Three applicants, one job between them, a shortfall of two. Applicant 4 is not part of the certificate at all — it has three jobs to itself and is doing nothing wrong. A reader who expects the violating set to be all of X will not find it here, and the searching that follows is exactly what the minimum cut saves.
Example · Nothing deficient, and nothing to produceEdges 1-a, 1-b, 2-b, 2-c, 3-c, 3-d, 4-d, 4-a: four applicants in a ring with four jobs. The maximum matching has four edges, every applicant is placed, and the minimum cut has capacity 4 — the set {src} alone.
S and N(S) come back empty and the lab reports that Hall's condition holds on every subset. There is nothing to certify: the alternating search that produces the violating set starts from the unmatched applicants, and here there are none. Remove one edge and the certificate appears.
The same theorem, a third time
König's theorem — that in a bipartite graph the smallest vertex cover has exactly as many vertices as the largest matching — is the same statement again. The lab computes the cover from the matching, and it is the cover the Hungarian method was counting when it drew lines through the zeros. On the three-applicant instance the cover is the two jobs; on the three-sharing-one instance it is applicant 4 together with job a.
So the assignment lesson's cover step, this lesson's deficient set, and the maximum-flow theorem are three readings of one fact. That is not a coincidence worth admiring; it is the reason the assignment problem can be solved by a method with a stopping proof, and the reason that method's most delicate step is the one this lesson has now justified.
One limitation to state plainly. All of this is about bipartite graphs. Matching in a general graph is a genuinely harder problem with a different theory, its own theorem about odd sets, and an algorithm this path does not contain. The boundary is exactly the odd cycle that broke total unimodularity in the integrality lesson, which is a pleasing place for a course to end.