Algorithm Design

Network Flow Applications: Bipartite Matching & Image Segmentation

12:30

Plays from YouTube. Watch on YouTube

How can a network solve two problems that seem to have nothing in common?

Meet Network Flow Applications: the art of translating assignments and image labels into capacities, flows, and minimum cuts.

We start with bipartite matching. Workers qualify for different jobs, but each worker and each job may appear only once. A greedy assignment gets stuck, so we uncover an alternating path that increases the number of filled jobs.

From there, we construct a unit-capacity source-worker-job-sink network and prove both directions of the reduction. A matching creates an integral feasible flow, and an integral flow decodes to a matching of exactly the same size.

Then we turn to binary image segmentation. Each pixel has a foreground and background preference, while neighboring pixels incur a penalty when their labels differ.

We derive the cut network one edge type at a time: source-to-pixel capacities encode foreground preferences, pixel-to-sink capacities encode background preferences, and two opposite arcs encode each neighbor-separation penalty.

Finally, we compute a synthetic 3×3 example and compare how different boundary penalties change its optimal labels. The key identity is cut capacity equals a fixed constant minus the segmentation score, so a minimum cut solves the specified optimization exactly.

The big idea: a useful reduction preserves both feasible solutions and objective values. Build the correspondence carefully, then let a graph algorithm do the optimization.

Algorithms explained visually, one concept at a time.