Wait, What?
A matching can be perfect and still be the wrong answer.
The assignment problem asks for a one-to-one pairing that optimises total cost or value. The Hungarian family of methods is powerful because it combines combinatorial matching with dual variables, reduced costs and augmenting structure. The learner therefore sees not just how to find a matching, but how an algorithm can carry its own certificate of optimality.
Quick Answer
Learn the Hungarian algorithm through assignment matrix → feasible matching → dual potentials → reduced costs → equality graph → augmenting path → potential update → optimality certificate.
1. Build the Assignment Model
Start with a small matrix whose rows are agents and columns are tasks. State whether the objective is minimum cost or maximum value. Then write the one-to-one constraints explicitly. This prevents the learner from confusing the assignment problem with stable matching, unrestricted graph matching or minimum-cost flow.
2. Understand Potentials as Lower-Bound Structure
Associate dual values with rows and columns. Reduced costs describe how much slack remains after accounting for those potentials. When a matched edge has zero reduced cost and all reduced costs satisfy dual feasibility, the matching and dual solution begin to line up through complementary slackness.
3. Work Inside the Equality Graph
Edges whose reduced cost is zero form the current equality graph. Search there for an augmenting path that increases the size of the matching without violating one-to-one constraints. If no augmenting path is available, adjust potentials to expose new zero-reduced-cost edges while preserving feasibility.
4. Trace One 3×3 Example
Use three workers and three jobs. Record the current potentials, zero reduced-cost edges, current matching and alternating tree after every change. Ask the learner to predict which constraint is preventing augmentation before performing the potential update. This converts the algorithm from a memorised matrix ritual into a sequence of justified state transitions.
5. Why Augmentation Alone Is Not Enough
A maximum-cardinality matching only guarantees that many pairs were formed. The assignment objective also requires the correct total cost. Hungarian reasoning therefore couples augmentation with dual information so that the final perfect matching satisfies the optimisation objective rather than merely the cardinality objective.
6. Learn the Optimality Certificate
The key professional idea is complementary slackness: once a perfect matching uses edges consistent with the dual optimum and dual feasibility is maintained, the primal and dual objectives meet. This gives a reason the answer is optimal, not just evidence that the code stopped.
7. Compare With Related Problems
- Stable matching: preference stability, not minimum total assignment cost.
- General graph matching: pairs arbitrary graph vertices and may require blossom reasoning.
- Minimum-cost flow: handles broader network constraints at greater modelling generality.
- Hungarian assignment: exploits bipartite one-to-one structure directly.
Common Failure States
- Confusing a complete matching with an optimal matching.
- Changing potentials in a way that breaks dual feasibility.
- Following zero entries mechanically without understanding reduced cost.
- Mixing minimisation and maximisation conventions.
- Claiming optimality from sample tests rather than the primal-dual argument.
Practice Ladder
- Solve a 2×2 assignment by inspection.
- Build reduced costs for a 3×3 matrix.
- Trace an alternating tree and augmenting path.
- Perform one potential update and verify feasibility.
- Explain complementary slackness in plain language.
- Compare Hungarian, min-cost flow and general matching for a specified task.
Learning Hall Boundary
This article owns the assignment-specific Hungarian route. It links to existing general matching, min-cost flow and stable-matching articles without replacing their canonical jobs.
Professional rule: understand the Hungarian algorithm when you can trace both the matching and the dual state, explain why each potential update is legal, and identify the final certificate that proves the assignment is optimal.
