Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp
3.5.16· Coding › Graphs
HUM KYA model kar rahe hain
KYU max-flow = min-cut (derivation scratch se)
Step 1 — Kisi bhi cut pe flow ke barabar hota hai.
Koi bhi cut lo. ke saare nodes par conservation equation ka sum karo. Internal edges (dono endpoints mein) ek baar aur ek baar ke roop mein aate hain aur cancel ho jaate hain. Jo bachta hai woh sirf cut cross karne wala flow hai: Yeh step kyun? Conservation ke andar sab kuch balance karti hai, isliye se net baahri flow, se net baahri flow ke barabar hona chahiye, jo hai .
Step 2 — Weak duality: har flow ≤ har cut. Kyun? Forward flows capacity se cap hote hain; backward flows subtract hote hain aur hote hain. Isliye koi bhi flow value kisi bhi cut capacity se bounded hai. Hence .
Step 3 — Equality achievable hai (max-flow min-cut theorem).
Jab flow maximum hota hai, residual graph mein koi augmenting path NAHI hota (aage define hoga). Maano residual graph mein se reachable saare nodes, = baaki. Tab . Is cut ke liye:
- har forward edge () saturated hai (), warna reachable hota;
- har backward edge carry karta hai, warna woh mein ek residual edge deta.
Step 1 mein plug karo: . Toh yeh flow ek cut capacity ke barabar hai, aur Step 2 se dono optimal hain.
Residual graph (saare algorithms ka engine)
Ek augmenting path residual graph mein koi bhi path hai. Iski bottleneck uspe minimum hai; utna push karna ko strictly increase karta hai.
Ford–Fulkerson (the method)
Edmonds–Karp (ek smart path rule)

Worked Example 1 — haath se push & augment karo
Network: (cap 3), (2), (1), (2), (3).
Path 1: , bottleneck . Push 2. Kyun? limiter hai. Path 2: , bottleneck . Push 2. Path 3: , residual: mein hai, , . Bottleneck . Push 1. Ab . Aur kyun nahi? ki out-capacity hai, sab saturated — yahi min cut hai , . Max flow = 5. ✔
Worked Example 2 — backward edge bacha leta hai
(1), (1), (1), (1), (1).
Greedy choose karta hai, bottleneck 1. Kyun panic ho sakta hai? Ab aur unusable lagte hain. Lekin residual mein backward (cap 1) hai. Naya path: ? — (1), backward (1), (1). Push 1. Total = min cut. Yeh step kyun? Backward edge ne buri commitment undo ki, ko free kiya. ✔
Recall Feynman: ek 12-saal ke bacche ko explain karo
Socho ek tap se ek bucket tak water pipes hain. Har pipe sirf itna hi carry kar sakti hai. Tum chahte ho maximum paani bucket tak pahunche. Limit hai network ki sabse kamzor jagah — pipes ka woh sasta set dhundho jise cut karne se koi paani nahi jaata, aur exactly wahi hai max paani jo tum bhej sakte ho. Algorithm "abhi bhi khule raaste" dhundta rehta hai, paani push karta hai, aur ise allow bhi hai ki woh pehle try kiye ek raaste se paani wapas le aur better jagah bheje. Jab koi khula raasta nahi bachta, done — bottleneck hit ho gayi.
Flashcards
Ek flow network ke har edge par kya chahiye aur kaun se do special nodes hote hain?
Ek valid flow ke do constraints batao.
Ek s–t cut ki capacity define karo.
Max-flow min-cut theorem state karo.
Flow ke maximum hone ki teen equivalent conditions kya hain?
Edge ki residual capacity kya hai, aur kaun sa backward edge appear hota hai?
Backward residual edges kyun chahiye?
Augmenting path kya hai aur woh kitna flow carry karta hai?
Integer capacities ke saath Ford-Fulkerson ki complexity kya hai?
Edmonds-Karp ko kaun sa rule define karta hai aur iski complexity kya hai?
Edmonds-Karp capacity-independent kyun hai?
Max flow run karne ke baad min cut kaise recover karte hain?
Kisi bhi cut pe flow ke barabar kyun hota hai?
Connections
- Graphs — base data structure & traversal
- BFS — Edmonds-Karp ka shortest-augmenting-path engine
- Bipartite Matching — unit-capacity max flow ke roop mein solve hota hai
- Linear Programming Duality — max-flow/min-cut iski combinatorial special case hai
- Dinic's Algorithm — level graphs + blocking flows se faster
- Menger's Theorem — edge/vertex disjoint paths = ek flow corollary