Tutorials › Graph Theory (Undergraduate) › Hall’s Theorem in Worker–Task Assignments

Hall's Marriage Theorem · Tutorial 297 of 799

Hall’s Theorem in Worker–Task Assignments

Translate eligibility lists into a bipartite graph, test Hall’s condition, and use it to justify a distinct-task assignment.

Intermediate 9 min read

What You'll Learn

  • Represent workers, tasks and eligibility as the two parts and edges of a bipartite graph.
  • State Hall’s condition using the neighborhood of every worker subset.
  • Prove both directions of Hall’s theorem, including the induction step.
  • Check Hall’s condition by computing neighborhoods in concrete assignment problems.
  • Recognize why checking each worker separately does not guarantee an assignment.

From Eligibility Lists to a Graph

Suppose a group of workers must each receive a task, and each worker is eligible for only some of the available tasks. The assignment must respect eligibility, and no task may be assigned to two workers. A bipartite graph records exactly these constraints: one part represents workers, the other represents tasks, and an edge records an eligible worker–task pair. The central question is whether there is a way to assign a distinct eligible task to every worker.

All graphs in this tutorial are finite and simple. A bipartite graph \(G=(V,E)\) has its vertices partitioned into two parts, here denoted \(W\) and \(T\), with every edge joining a vertex of \(W\) to one of \(T\). For a set \(X\subseteq W\), its neighborhood \(N(X)\) is the set of tasks adjacent to at least one worker in \(X\). An edge \(wt\) means worker \(w\) is eligible for task \(t\).

Definition: A matching is a set of edges no two of which share an endpoint. A matching saturates the workers if every worker is incident to one of its edges. In an assignment problem, such a matching assigns one eligible task to each worker, with no task assigned more than once. It need not use every task.

The assignment is possible precisely when the graph has a matching that saturates \(W\). Hall’s condition tests whether the available task choices are numerous enough for every group of workers, not just for each worker considered individually.

Hall’s Theorem

Theorem (Hall’s Theorem): Let \(G\) be a finite bipartite graph with parts \(W\) and \(T\). There is a matching saturating \(W\) if and only if $$ |N(X)|\ge |X|\qquad\text{for every }X\subseteq W. $$

The empty set is included: \(N(\varnothing)=\varnothing\), so its condition reads \(0\ge0\). This condition says that any group of \(k\) workers must collectively have at least \(k\) eligible tasks. The theorem does not require \(|W|=|T|\); if the parts have equal size, a matching saturating \(W\) also uses every task.

Proof. First suppose a matching saturates \(W\). For any \(X\subseteq W\), the matching assigns each worker in \(X\) to a different task in \(N(X)\). Therefore \(N(X)\) contains at least \(|X|\) tasks, proving Hall’s condition.

For the converse, assume \(|N(X)|\ge |X|\) for every \(X\subseteq W\). We prove by induction on \(|W|\) that a matching saturating \(W\) exists. If \(|W|=0\), the empty matching saturates \(W\). Now suppose \(|W|>0\), and assume the claim holds for bipartite graphs with fewer workers.

First consider the case that some nonempty proper subset \(S\subset W\) is tight, meaning \(|N(S)|=|S|\). Restrict the graph to workers \(S\) and tasks \(N(S)\). Every subset \(X\subseteq S\) has all its original neighbors in \(N(S)\), so it still satisfies \(|N(X)|\ge |X|\) in this restricted graph. By induction, there is a matching saturating \(S\).

Now consider the remaining workers \(W\setminus S\) and tasks \(T\setminus N(S)\). For any \(Y\subseteq W\setminus S\), the neighbors available in this remaining graph are \(N(Y)\setminus N(S)\). Applying Hall’s condition to \(S\cup Y\) gives $$ |N(S)|+|N(Y)\setminus N(S)| =|N(S\cup Y)| \ge |S|+|Y|. $$ Since \(|N(S)|=|S|\), it follows that \(|N(Y)\setminus N(S)|\ge |Y|\). The remaining graph therefore satisfies Hall’s condition. It has fewer workers than \(G\), so induction gives a matching saturating \(W\setminus S\). The two matchings use disjoint task sets, \(N(S)\) and \(T\setminus N(S)\), so together they saturate \(W\).

It remains to consider the case that no nonempty proper subset of \(W\) is tight. Choose any worker \(w\). Hall’s condition applied to \(\{w\}\) guarantees a neighboring task \(t\). Delete \(w\) and \(t\). For any nonempty \(X\subseteq W\setminus\{w\}\), the set \(X\) is a proper subset of \(W\), so, because its neighborhood size is an integer and it is not tight, \(|N(X)|\ge |X|+1\). Deleting \(t\) removes at most one of these neighbors. Thus the remaining neighborhood of \(X\) has size at least \(|X|\). The empty subset also satisfies Hall’s condition. By induction, the graph after the deletion has a matching saturating \(W\setminus\{w\}\). Adding the edge \(wt\) gives a matching saturating \(W\). Both cases prove the converse, and hence the theorem. \(\square\)

Using Hall’s Condition in an Assignment

To use the theorem directly, list the eligible tasks for each worker, then compute \(N(X)\) for worker subsets \(X\). If one subset has fewer neighboring tasks than workers, the assignment is impossible. If every subset passes the test, Hall’s theorem guarantees an assignment. For a small number of workers, the check can be made by listing all subsets; for larger problems, identifying a useful way to organize the subsets is often the main practical challenge.

Worked Example: Assigning Three Workers

Let the workers be \(W=\{A,B,C\}\), the tasks be \(T=\{1,2,3,4\}\), and the eligibility edges be \(E=\{A1,A2,B2,B3,C1,C3,C4\}\). We check Hall’s condition for every worker subset.

For the three singletons, \(N(\{A\})=\{1,2\}\), \(N(\{B\})=\{2,3\}\), and \(N(\{C\})=\{1,3,4\}\); their neighborhood sizes are \(2,2,3\), each at least \(1\). For the three pairs, \(N(\{A,B\})=\{1,2,3\}\) has size \(3\), \(N(\{A,C\})=\{1,2,3,4\}\) has size \(4\), and \(N(\{B,C\})=\{1,2,3,4\}\) has size \(4\); each size is at least \(2\). Finally, \(N(W)=\{1,2,3,4\}\) has size \(4\ge3\). The empty subset also passes, since both sizes are \(0\).

Hall’s theorem guarantees a matching saturating \(W\). One such assignment is \(A\) to task \(1\), \(B\) to task \(2\), and \(C\) to task \(3\). Each selected pair is an edge in \(E\), and the tasks \(1,2,3\) are distinct.

Check: the chosen edges \(\{A1,B2,C3\}\) share no endpoints, so they form a matching. They cover all three workers, as required. Task \(4\) is left unused, which is allowed because the goal is to assign every worker, not necessarily every task.

Worked Example: Two Workers Compete for One Task

Let \(W=\{A,B,C\}\), \(T=\{1,2,3\}\), and \(E=\{A1,B1,C2,C3\}\). Worker \(A\) is eligible only for task \(1\), worker \(B\) is eligible only for task \(1\), and worker \(C\) is eligible for tasks \(2\) and \(3\).

For the singletons, the neighborhood sizes are \(|N(\{A\})|=1\), \(|N(\{B\})|=1\), and \(|N(\{C\})|=2\), so each singleton passes. But for \(X=\{A,B\}\), we have \(N(X)=\{1\}\), and therefore \(|N(X)|=1<2=|X|\). Hall’s condition fails, so no matching can saturate all workers.

Check: any assignment covering both \(A\) and \(B\) would have to assign task \(1\) to both workers, which is forbidden. This confirms directly why the deficient subset prevents a complete assignment. Worker \(C\)’s extra choices cannot resolve the conflict between \(A\) and \(B\).

Worked Example: A Tight Group and an Extra Task

Let \(W=\{A,B,C,D\}\), \(T=\{1,2,3,4,5\}\), and \(E=\{A1,A2,B1,B2,C3,C4,D3,D4,D5\}\). The graph has two separate groups of eligible pairs: \(A,B\) can use tasks \(1,2\), while \(C,D\) can use tasks \(3,4,5\).

For a nonempty subset \(X_1\subseteq\{A,B\}\), its neighborhood is \(\{1,2\}\), of size \(2\), while \(|X_1|\) is either \(1\) or \(2\). For a nonempty subset \(X_2\subseteq\{C,D\}\), its neighborhood is \(\{3,4,5\}\), of size \(3\), while \(|X_2|\) is either \(1\) or \(2\). If a worker subset \(X\) meets both groups, its neighborhood is the disjoint union of those two task sets. Its size is \(2+3=5\), while \(|X|\le4\). If \(X\) is empty, both sizes are \(0\). These cases verify Hall’s condition for every subset.

An assignment is \(A\) to \(1\), \(B\) to \(2\), \(C\) to \(3\), and \(D\) to \(4\). Every selected edge is in \(E\), and no task is repeated.

Check: the subset \(\{A,B\}\) is tight: its neighborhood is \(\{1,2\}\), so both available tasks are needed for those two workers. The other group has three available tasks for two workers. The displayed assignment uses two tasks from each group and leaves task \(5\) unused, consistent with the counts.

Why the Subset Test Matters

Hall’s condition is a group-level test. Counting the choices of each worker separately checks only singleton subsets. That is necessary, but it is not sufficient: several workers may all depend on the same small set of tasks. The second example shows this precisely. Every worker has at least one eligible task, yet the two-worker set \(\{A,B\}\) has only one neighboring task.

Conversely, checking a few promising groups is not enough to establish that an assignment exists. The theorem requires the inequality for every subset of workers, including the whole set and the empty set. In the third example, the two-worker group \(\{A,B\}\) reaches equality, while subsets meeting both groups have a larger neighborhood. Both kinds of subsets matter.

In practice, Hall’s theorem separates feasibility from the act of writing down an assignment: once all subsets satisfy the condition, the theorem guarantees that a matching exists. A proposed assignment should still be checked by confirming that every worker receives an eligible task and that no task is repeated.

Check Your Understanding

For each question, use neighborhoods of worker subsets rather than checking only individual eligibility lists.

  1. Let \(W=\{A,B\}\), \(T=\{1,2,3\}\), and \(E=\{A1,A2,B2,B3\}\). Verify Hall’s condition for all subsets of \(W\), then give an assignment.
  2. Let \(W=\{A,B,C\}\), \(T=\{1,2,3\}\), and \(E=\{A1,B1,C2,C3\}\). Which subset violates Hall’s condition, and what does that tell you about the assignment?
  3. Explain why Hall’s condition for each singleton worker does not by itself guarantee a matching that saturates all workers.
  4. In Hall’s theorem, why does a matching saturating \(W\) imply \(|N(X)|\ge|X|\) for every \(X\subseteq W\)?
  5. If a matching saturates \(W\) but \(|W|<|T|\), must every task be used? Explain.