Flow Graph- Max Flow and Min Cut
Flow Graph (Network Flow Graph)
A flow graph (in algorithms) is a directed graph used to model movement of some quantity such as:
water in pipes
traffic in roads
data in networks
resources in supply chains
Each edge has a capacity = maximum amount that can pass through it.
π¦ Components of a Flow Graph
A flow network consists of:
πΉ Vertices (Nodes)
Represent locations (cities, routers, tanks, etc.)
πΉ Directed Edges
Show allowed direction of flow.
πΉ Capacity
Maximum flow allowed on each edge.
πΉ Source
Starting node where flow originates.
πΉ Sink
Destination node where flow ends.
π¦ What is a Flow?
A flow assigns a number to each edge such that:
✅ Capacity constraint
✅ Conservation constraint
At every node except source and sink:
π¦ Goal
Compute the maximum total flow from source to sink .
As your uploaded notes explain:
Flow must respect capacities
Total flow leaving equals total flow entering
✅ 2. Maximum Flow Problem
π¦ Problem Definition
Given:
directed graph
source
sink
capacity on each edge
Find:
π¦ Intuition Example
✅ Naive Greedy Algorithm for Maximum Flow
π¦ Idea (Intuition)
Start with zero flow
Repeatedly find any path from source to sink
where all edges still have remaining capacityPush as much flow as possible along that path
Stop when no such path exists
This is a greedy approach because it:
chooses one available path at a time
sends maximum possible flow immediately
never revises earlier decisions
✅ Algorithm (Clean Pseudocode Version)
Naive Greedy Max-Flow Algorithm
✅ Why This Algorithm is “Naive”
It may terminate with non-maximum flow
-
Because earlier choices might block better routes later
-
It cannot undo previous flow decisions
This motivates:
π Residual graphs
π Ford–Fulkerson algorithm
✅ Example Showing Failure
If the algorithm first chooses a bad path:
it may saturate edges incorrectly and prevent a better total flow.
✅ Residual Graph (Key Idea)
To improve a flow, we build a residual network:
forward edge capacity = remaining space
backward edge capacity = current flow
This allows:
sending more flow
undoing earlier decisions
This idea leads to the Ford–Fulkerson algorithm.
✅ Ford–Fulkerson Algorithm (Core Algorithm)
Steps:
Start with zero flow
Find path from to with available capacity
Push maximum possible flow along path
Update residual graph
Repeat until no path exists
When no path exists → flow is maximum.
Finding the Maximum Flow Path through the Graph
The modification works as follows. When processing a node, again the algorithm traverses the node's edges, and if paths with more flow to any other nodes are discovered, then the nodes are updated. At each step, the node with the maximum flow is processed next.
We'll work an example now: The source is A an the sink is G:
The first path we get is A->B->C->E->G with a flow of one. In the residual, the edges whose flow is reduced are colored red, and the reverse edges are colored green:
The next greedy path through the residual is A->B->C->D->F->G, with a flow of two:
The last path is A->D->F->G with a flow of three. Here are the final flow and residual graphs:
The Max Flow is - 1 + 2 + 3 = 6
✅ Important Theorem
πΉ Max-Flow Min-Cut Theorem
Meaning:
The largest flow equals the smallest bottleneck separating and .
This is one of the most important results in algorithms.
We can use the final residual graph to find the min cut.
First, you find all nodes reachable from the source in the residual graph. This is one set of nodes, which we color purple below:
Now, in the original graph, we divide our nodes into two sets: the set determined above, and all of the remaining nodes. They are drawn purple and yellow in the original graph below:
✅ Applications of Maximum Flow
π¦ Networks
Internet packet routing
Bandwidth allocation
π¦ Transportation
Traffic flow optimization
Railway scheduling
π¦ Supply Chain
Goods distribution
Logistics planning
π¦ Image Processing
Image segmentation (cutting object from background)
π¦ Matching Problems
Job assignment
Student–course allocation
π¦ Machine Learning
Graph cuts in computer vision
Energy minimization problems
Summary
The maximum flow problem asks for the greatest possible amount of flow that can be sent from the source to the sink. Algorithms such as Ford–Fulkerson repeatedly find augmenting paths in the residual graph and increase the flow until no more such paths exist. The Max-Flow Min-Cut theorem states that the maximum flow equals the minimum cut capacity.
Applications include traffic routing, communication networks, bipartite matching, logistics optimization, and image segmentation.













Comments
Post a Comment