Discrete MathematicsPlanarity, Coloring and Matching3 of 4
Planarity, Coloring and Matching · 3
Bipartite Matching and Hall's Theorem
When a group of people apply to jobs they are qualified for, we want to assign people to jobs so that nobody gets two jobs and no two people share a job.
Matchings in Bipartite Graphs
Splitting the dots into people on the left and jobs on the right gives a bipartite graph, where every line goes from a person to a job they can do. A matching is any choice of highlighted lines where no two highlighted lines share a dot:
⟶⟶no person gets 2 jobs,no job gets 2 peopleMatchingevery person on theleft gets a jobComplete matchingevery dot on bothsides is matchedPerfect matching
1
Making a Matching Bigger with Augmenting Paths
If we hand out jobs one by one from the top of the list, we can get stuck when the next person's only qualified jobs are already taken. Instead of starting over, we look for an augmenting path: a zig-zag chain that alternates between unselected lines and currently highlighted lines to shift people over until someone moves into an empty job.
On our 5-person board, suppose we start by matching A–1,B–2, and C–3. How can we fit D, who is only qualified for Job 2, into the matching?
Augmenting Paths
Text solution
Trace the alternating path from the unmatched person to an empty jobStart at D, cross unselected lines to go from left to right and currently highlighted lines to go from right to left, and stop as soon as you reach the empty Job 4.
Flip every line along the pathUn-highlight the old matched lines in the chain and highlight the unselected ones, while leaving A–1 untouched.
Un-highlight: ⟶Highlight: B–2,C–3D–2,B–3,C–4
New matching: A–1,D–2,B–3,C–4
So D gets Job 2,B shifts to Job 3, and C shifts to Job 4, growing our matching from 3 lines to 4.
Because an augmenting path starts at an unmatched person on an unselected line and ends at an empty job on an unselected line, flipping the path always replaces k highlighted lines with k+1 highlighted lines without giving anyone two jobs.
Because an augmenting path starts and ends on unselected lines and alternates in between, flipping it always adds one more match without giving anyone two jobs.
2
Bottlenecks and Maximum Matchings
When an augmenting-path search runs out of new jobs to reach and hits a dead end, it exposes a bottleneck: a group of people on the left who together connect to fewer jobs on the right than there are people in the group. A bottleneck not only proves a complete matching is impossible, but also gives an upper bound on the size of the maximum matching, the largest matching the graph can hold.
Now that A–1,D–2,B–3, and C–4 are matched, what happens when we try to match E (who only connects to Jobs 1 and 2), and what is the largest possible matching on this board?
Bottlenecks and Maximum Matchings
Text solution
Count the people and jobs in the dead-end chainTrace every line leaving E and the people holding E's jobs (A and D) to see how many jobs they connect to in total, then subtract to find how many people must go unmatched.
3 people{A,D,E}⟶2 jobs{1,2}⟹3−2=1 person must be left out
Bound the largest possible matchingSubtract that guaranteed unmatched person from the 5 total people on the left.
Largest possible matching size=5−1=4
Pair the bound with a matching of that sizeCombine the upper bound of 4 with the 4-line matching already on the board to prove we cannot do better.
Maximum matching (size 4): A–1,D–2,B–3,C–4
So 4 is the maximum matching size on this board, proved by a matching that reaches 4 and a bottleneck that rules out 5.
3
Hall's Theorem
A bottleneck clearly prevents a complete matching, and Hall's Theorem tells us the reverse is also true: a bottleneck is the only thing that can ever stop a complete matching. As long as every possible group of people on the left connects to at least as many jobs as there are people in that group, a complete matching is guaranteed.
Hall's Theorem
In symbols, Hall's Theorem says that a complete matching of the left side exists if and only if
for every subset group of peopleon the leftS,number of jobsconnected to S∣N(S)∣≥number ofpeople in S∣S∣
Notice that N(S) counts each job connected to S once, even if several people in S have lines going to that same job.
Adding people to S whose lines only go to already-highlighted jobs in N(S) makes ∣S∣ grow while ∣N(S)∣ stays fixed, exposing a bottleneck the moment ∣N(S)∣<∣S∣.
When you add people who only connect to jobs the group already reaches, the group grows while its job count stays the same, creating a bottleneck as soon as there are fewer jobs than people.
4
Systems of Distinct Representatives
Many problems never mention people, jobs, or bipartite graphs at all: instead, they give a list of sets and ask for a system of distinct representatives, which means picking one unique item from each set with no repeats. Turning the sets into the left side of a bipartite graph and the items into the right side makes this a complete matching problem.
Given the five sets A={1,2},B={2,3},C={1,3},D={1,2,3}, and E={2,4,5}, can we pick one number from each set so that no number is picked twice?
Systems of Distinct Representatives
ABCDE={1,2}={2,3}={1,3}={1,2,3}={2,4,5}
one number from each set,no number picked twice?
Text solution
Turn the sets and numbers into a bipartite graphPut the sets A,B,C,D,E as dots on the left and the numbers 1,2,3,4,5 as dots on the right, drawing a line from each set to the numbers inside it.
Left side: Right side: {A,B,C,D,E}{1,2,3,4,5}
Collect the neighbors of the sets that share a small group of numbersTake the subset of the first four sets S={A,B,C,D} and list all the numbers that appear in any of them to find N(S).
SN(S)={A,B,C,D}⟹∣S∣=4,={1,2,3}⟹∣N(S)∣=3
Compare the sizes using Hall's TheoremCheck whether the number of available representatives in N(S) is at least the number of sets in S.
∣N(S)∣=3<4=∣S∣
Because those 4 sets only contain 3 numbers between them, Hall's Theorem tells us a system of distinct representatives is impossible (whereas changing D to {1,2,3,4} removes the bottleneck and lets us pick A–1,B–2,C–3,D–4, and E–5).
5
Counting Lines with Hall's Theorem
Sometimes we aren't given the graph at all, only rules about how many lines leave each person and how many lines go to each job. Even without seeing where the lines go, we can test Hall's Theorem for any group of k people by counting the lines leaving that group.
If every person in a bipartite graph applies to exactly 3 jobs, and every job gets exactly 3 applicants, is a complete matching guaranteed?
Counting Lines with Hall's Theorem
Text solution
Count the lines leaving any group of k peoplePick any subset S of k people on the left, where each person has 3 lines coming out of them.
∣S∣=k⟹Lines leaving S=3k
Bound how many jobs are needed to receive those linesEvery line leaving S goes to a job in N(S), and since each job can receive at most 3 of those lines, divide by 3 to find the minimum number of jobs in N(S).
∣N(S)∣≥33k=k=∣S∣
Because ∣N(S)∣≥∣S∣ holds for every possible subset S, a bottleneck can never happen, and Hall's Theorem guarantees a complete matching before we even see the graph.
Key concepts
When you are working with a specific bipartite graph (or a collection of sets turned into a graph, with sets on the left and numbers on the right), your approach depends on whether you are building a matching or proving one cannot get any bigger:
To grow a matching that got stuck
trace an augmenting path from an unmatched person to an empty job by alternating unselected lines (left to right) and highlighted lines (right to left), then flip every line on the path (D→2→B→3→C→4 replaces 2 matched lines with 3). If you can already spot a distinct match for everyone directly, just write the matching down; you do not need to check subsets with Hall's Theorem.
To prove a complete matching is impossible
you never need to check every subset: you only need to show one bottleneck where ∣N(S)∣<∣S∣ (such as S={A,D,E} connecting only to N(S)={1,2}, where ∣N(S)∣=2<3=∣S∣).
To prove a matching has the maximum possible size
pair two pieces of evidence: a bottleneck showing that at least ∣S∣−∣N(S)∣ people must go unmatched (with 5 people total, 3−2=1 person left out limits any matching to at most 5−1=4), and an actual matching of that size (A–1,D–2,B–3,C–4) showing that a size of 4 is reachable.
To guarantee a complete matching when you only have line counts
use Hall's Theorem(for every subset S,∣N(S)∣≥∣S∣) on a general group of k people: multiply k by the minimum number of lines leaving each person, and divide by the maximum number of lines each job can receive (3k lines with at most 3 per job forces ∣N(S)∣≥33k=k). Once a complete matching is guaranteed, check whether both sides have the same total number of dots before calling it a perfect matching(5 people matched into 8 jobs is complete, not perfect).
6
Practice
1
Four people (A,B,C,D) apply to four jobs (1,2,3,4) with the following qualifications: A can do 1,2;B can do 2,3;C can do 1,3,4; and D can do 1. Starting from the matching A–1,B–2,C–3 (with D unmatched and Job 4 empty), find an augmenting path from D to Job 4 and give the new matching after flipping the path.
D's only line goes to Job 1. Who currently holds Job 1 in the matching, and which other job can that person move to?
Starting from D, we follow the unselected line to Job 1. (Watch out: C is also qualified for Job 1, so it is tempting to jump from 1 straight to C and then to 4, giving the path D→1→C→4. That mistake follows an unselected line from right to left instead of a currently highlighted line, so flipping it would give Job 1 to D and to C while A still holds it.) Following the highlighted line from 1 back to A and continuing to alternate unselected and highlighted lines gives the augmenting path
D→1→A→2→B→3→C→4
Flipping the path un-highlights A–1,B–2, and C–3 and highlights the unselected lines, giving the perfect matching D–1,A–2,B–3, and C–4.
2
Consider the five sets A={1,4},B={2,5},C={1,6},D={1,4,6}, and E={4,6}. Can you choose a system of distinct representatives (one number from each set with no repeats)? If so, list one; if not, use Hall's Theorem to prove it is impossible.
Look at which numbers each set uses: is there a group of sets that never uses 2 or 5?
Check the sets that only use numbers from {1,4,6}. (Watch out: if you only check all five sets together as S={A,B,C,D,E}, you get ∣S∣=5 and N(S)={1,2,4,5,6} with ∣N(S)∣=5, which hides the bottleneck because set B brings in the two extra numbers 2 and 5.) Leaving B out and taking S={A,C,D,E} gives ∣S∣=4, while the numbers appearing in those sets are N(S)={1,4,6}, so ∣N(S)∣=3. Since ∣N(S)∣=3<4=∣S∣, by Hall's Theorem a system of distinct representatives is impossible.
3
Six people (A,B,C,D,E,F) apply to six jobs (1,2,3,4,5,6). Their qualifications are: A can do 1,2;B can do 1,2;C can do 2;D can do 1,3,4;E can do 1,2; and F can do 3,5,6. What is the size of the largest possible matching on this graph? Prove your answer using both a matching and a bottleneck.
Watch out: 2 is the number of people left out, not the size of the maximum matching. Stopping at 2 forgets to subtract those 2 unmatched people from the 6 total people on the left.
Four of the people only connect to Jobs 1 and 2. How many of those four must go unmatched, and how many of the 6 total people can still get a job?
The subset S={A,B,C,E} has ∣S∣=4 people who only connect to N(S)={1,2}, so ∣N(S)∣=2. At least ∣S∣−∣N(S)∣=4−2=2 of these people must go unmatched. (Watch out: 2 is the number of people left out, not the size of the maximum matching. Stopping at 2 forgets to subtract those 2 unmatched people from the 6 total people on the left.) Subtracting from the 6 people total shows no matching can have size greater than 6−2=4, and a matching of size 4 is achieved by A–1,C–2,D–4, and F–5, so the maximum matching has size 4.
4
In a bipartite graph with 6 people on the left and 8 jobs on the right, every person applies to at least 4 jobs, and every job receives at most 3 applicants. Use Hall's Theorem to determine whether a complete matching is guaranteed, and explain whether a perfect matching is possible.
For any group of k people, find the minimum number of lines leaving the group, and then compare the total number of dots on the two sides of the graph.
For any subset S of k people, at least 4k lines leave S. Since each job in N(S) can receive at most 3 of those lines, there must be at least 34k jobs in N(S). (Watch out: dividing the wrong way gives 43k<k, which swaps lines leaving per person with lines arriving per job.) Because ∣N(S)∣≥34k≥k=∣S∣ for every subset S, Hall's Theorem guarantees a complete matching. However, a perfect matching is impossible because the two sides have different sizes (6 people and 8 jobs), leaving 2 jobs unmatched in every complete matching.
5
Suppose there are 5 people and 5 jobs, every person applies to at least 2 jobs, and every job receives at most 3 applicants. Does this guarantee a complete matching? Either prove that it does or give an example of a graph following these rules that has a bottleneck.
A group of k people has at least 2k lines leaving it, and each job can take up to 3 lines. What is the smallest k where 2k lines can fit into fewer than k jobs?
For a group of k people, at least 2k lines leave the group, which only forces at least 32k jobs in N(S), and when k=3,32(3)=2<3. To build a counterexample, have A,B,C each apply to Jobs 1 and 2. (Watch out: you still have to give D and E at least 2 jobs each without connecting them to Jobs 1 or 2, because Jobs 1 and 2 already have 3 applicants each.) Having D and E each apply to Jobs 3,4, and 5 obeys both rules while giving S={A,B,C} with ∣S∣=3 and N(S)={1,2} with ∣N(S)∣=2<3, so a complete matching is not guaranteed.