Lecture from: 13.05.2025 | Video: Homelab

Wrapping Up Ford-Fulkerson

Before we begin new applications, let’s recap the key algorithmic results from last time.

Assumptions

  • Let the network be , a directed graph.
  • and .
  • Capacities are non-negative integers.
  • Let be the largest capacity.

Observation: Upper Bound on Maximum Flow

From the definition of capacity and network structure, we know:

That is, the flow from the source can be bounded above by the total outgoing capacity, which in the worst case is edges with maximum capacity .

Runtime Per Iteration

Each iteration of the Ford-Fulkerson algorithm:

  • Searches for an - path in the residual graph: .
  • Augments flow along the path: .

Thus, each iteration takes time.

Integer Capacities ⇒ Guaranteed Progress

With integer capacities:

  • Each augmentation increases flow by at least 1.
  • So, total number of augmentations is .

Theorem (Ford-Fulkerson Termination)

If all capacities are integers, Ford-Fulkerson terminates in at most iterations and returns an integer-valued maximum flow.

Total Time Complexity:

Why Integer Capacities Matter

If capacities are irrational (e.g., ), augmenting paths might increase flow by arbitrarily small amounts. This could lead to infinite loops and non-termination. Integer capacities ensure each step contributes non-zero flow, making the algorithm finite.

Applications of Maximum Flows

Flows and cuts in graphs offer a powerful toolkit to solve a range of problems in discrete mathematics, computer science, and beyond. In this lecture, we explore three key applications:

  1. Maximum Bipartite Matching
  2. Edge-Disjoint Paths
  3. Image Segmentation via Min-Cut

Each is reduced to a max-flow (or min-cut) instance, allowing us to apply efficient algorithms with guaranteed correctness.

1. Maximum Bipartite Matching

Problem Definition

Let be a bipartite graph, with disjoint vertex sets and and edge set .

A matching is a set of edges such that no two edges in share an endpoint.

The goal is to find a maximum matching - one of maximum cardinality.

Note: the first matching is a “maximal” matching, while the second is a “maximal and (cardinality) maximum. Similarly the third one is a maximum matching.

Flow Network Construction

We reduce the matching problem to a max-flow problem.

Let . Construct a flow network as follows:

  • Let .
  • Add a directed edge with capacity for each .
  • Add a directed edge with capacity for each .
  • Add a directed edge with capacity for each .

All capacities are , and the graph is directed.

Correctness of the Reduction

Let be a flow in of value .

Claim:

The graph has a matching of size if and only if has a flow of value .

Proof Sketch:

() Given a matching of size in , define a flow :

  • For each , set .
  • All other flows are .

This is a valid flow (capacities respected, flow conservation holds), and has total value .

() Given a flow of value , we extract a matching:

  • Because of unit capacities, all flows are or .
  • For each edge with , include in the matching.
  • Since each vertex has in-degree and out-degree at most , no two edges share an endpoint.

Hence, this defines a matching of size .

Algorithm and Runtime

Apply Ford-Fulkerson (or a variant like Edmonds-Karp). Since all capacities are integers (in fact, 1), the integrality theorem guarantees an integer flow.

  • Runtime: for Ford-Fulkerson with unit capacities.
  • Improved: Hopcroft-Karp algorithm solves it in .

2. Edge-Disjoint Paths

Problem Definition

Let be a directed or undirected graph, and , .

The task is to find the maximum number of edge-disjoint - paths, i.e., simple paths from to that do not share any edge.

Reduction to Max-Flow

Construct a network :

  • Replace each undirected edge by directed edges and .
  • Set capacity for all .

Now compute a maximum flow from to in .

Correctness

Let be a flow of value .

We show that has edge-disjoint - paths.

  • Flow values are integral ().
  • For any vertex , the number of incoming edges with equals the number of outgoing edges with (flow conservation).
  • Hence, paths can be extracted by tracing flow from to .
Construction of Paths:
  1. Start at .
  2. Follow outgoing edges with .
  3. Remove used edges from the flow.
  4. Repeat until all flow is exhausted.

This results in edge-disjoint paths.

Theoretical Implication: Menger’s Theorem

This reduction gives an algorithmic proof of:

The maximum number of edge-disjoint - paths equals the minimum number of edges whose removal separates and .

This is a special case of the Max-Flow Min-Cut Theorem.

3. Image Segmentation via Min-Cut

Problem

We are given an image modeled as a graph where:

  • = set of pixels
  • = adjacency of neighboring pixels

Each pixel has:

  • : cost of assigning to the foreground
  • : cost of assigning to the background

Each edge has:

  • : cost of cutting this edge (i.e., separating and )

Goal: Assign each pixel to foreground or background to minimize segmentation cost.

Objective Function

Let be a partition of into foreground and background.

We define the cost:

  • First two terms: penalty for “wrong” label
  • Last term: penalty for inconsistent adjacent labels

Flow Network Construction

Build a flow network :

  • For each pixel :
    • Add edge with capacity
    • Add edge with capacity
  • For each edge :
    • Add directed edges and with capacity

Solving the Segmentation

  • Compute a minimum - cut.
  • Let be the set of vertices reachable from in the residual graph.
  • Assign to foreground, to background.

Why Does This Work?

The capacity of the - cut is exactly:

Hence, minimizing the cut minimizes the segmentation cost.

Summary

ApplicationProblemFlow Network ConstructionSolved Using
Bipartite MatchingMaximum matching in bipartite graphSource connects to , sink to Max-Flow
Disjoint PathsMax number of edge-disjoint pathsUnit capacities, source = , sink = Max-Flow + Paths
Image SegmentationForeground/background partitioning, to/from source/sinkMin-Cut

“Combinatorial problems often hide inside networks. Flows and cuts reveal their structure - and their solutions.”