A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Bipartite Graphs and Matching Problems

College Depth 79 in the knowledge graph ☐ I know this ☆ Set as goal
17topics build on this
393prerequisites beneath it
See this on the map →
Bipartite Graphs and MatchingsGraph Coloring and Chromatic Numbers→→Bipartite Graphs and 2-Colorability
bipartite matching Hall's-theorem perfect-matching

Core Idea

A bipartite graph has vertex partition into two sets with edges only between sets (not within). A matching is a set of disjoint edges. Hall's marriage theorem characterizes when a perfect matching (every vertex matched) exists in a bipartite graph.

How It's Best Learned

Recognize bipartite graphs: they have no odd cycles. Use BFS/DFS to 2-color them. Apply Hall's theorem to prove existence of matchings. Model problems as bipartite matching: job assignments, system administrators, Latin rectangles.

Common Misconceptions

A bipartite graph need not be complete bipartite. Hall's condition is necessary and sufficient: every subset S of one part must have at least |S| neighbors on the other side.

Explainer

A bipartite graph divides its vertices into two distinct groups — call them "left" and "right" — where edges only connect a left vertex to a right vertex, never two vertices within the same group. From your prior work on bipartite graphs, you know this two-colorability is equivalent to having no odd cycles. The classic real-world picture: left vertices are job applicants, right vertices are open positions, and edges connect each applicant to the jobs they qualify for. The question "can we assign everyone to a job?" is exactly a matching problem.

A matching is a set of edges with no shared endpoints — each vertex appears in at most one matched pair. A perfect matching matches every vertex on one side (or both sides if they're equal in size). The central theorem is Hall's Marriage Theorem: a bipartite graph has a perfect matching from the left side if and only if for every subset S of left vertices, the set of their neighbors N(S) satisfies |N(S)| ≥ |S|. This is called Hall's condition. Intuitively, it says no subset of applicants is "too picky" — every group of k applicants must collectively be interested in at least k distinct jobs.

The necessity of Hall's condition is immediate: if some subset S of left vertices has fewer than |S| neighbors on the right, there simply aren't enough distinct right vertices to match all of S, so a perfect matching is impossible. The sufficiency — that Hall's condition guarantees a perfect matching exists — requires a proof, typically by induction on the size of the graph. You build a matching greedily where the condition is tight (|N(S)| = |S| for some S), then handle the slack cases where you have room to maneuver.

In practice, augmenting path algorithms find the actual maximum matching efficiently. An augmenting path is a path that starts and ends at unmatched vertices and alternates between unmatched and matched edges. Following this path toggles the matching status of each edge on the path, increasing the matching size by one. The algorithm terminates when no augmenting path exists — at that point, the matching is maximum. Hall's theorem converts an existential question ("does a perfect matching exist?") into a combinatorial condition you can verify, while augmenting paths give you the constructive algorithm to find it.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Set Operations: Union, Intersection, and Complement → Proof by Cases → Proving by Cases and Exhaustion → Vacuous Truth and Trivial Cases → Proof by Cases (Proof by Exhaustion) → Mathematical Induction → Graph Paths, Cycles, and Connectivity → Trees and Spanning Trees → Planar Graphs and Euler's Formula → Graph Coloring and the Chromatic Number → Graph Coloring and Chromatic Numbers → Bipartite Graphs and Matching Problems

Longest path: 80 steps · 393 total prerequisite topics

Prerequisites (2)

Leads To (1)