3.5.16 · HinglishGraphs

Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

1,899 words9 min readRead in English

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)

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

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 capacity ; ek source aur ek sink .
Ek valid flow ke do constraints batao.
Capacity () aur conservation (in-flow = out-flow har non- node par).
Ek s–t cut ki capacity define karo.
— sirf forward edges.
Max-flow min-cut theorem state karo.
; max flow value minimum cut capacity ke barabar hoti hai.
Flow ke maximum hone ki teen equivalent conditions kya hain?
(a) max flow hai, (b) residual graph mein koi augmenting path nahi, (c) kisi cut ke liye.
Edge ki residual capacity kya hai, aur kaun sa backward edge appear hota hai?
; plus backward edge jisme capacity hai.
Backward residual edges kyun chahiye?
Pehle committed flow ko undo/re-route karne ke liye taaki greedy mistakes correct ho sakein.
Augmenting path kya hai aur woh kitna flow carry karta hai?
Residual graph mein ek path; apni bottleneck carry karta hai = uspe minimum residual capacity.
Integer capacities ke saath Ford-Fulkerson ki complexity kya hai?
— max-flow value par depend karta hai (slow ho sakta hai).
Edmonds-Karp ko kaun sa rule define karta hai aur iski complexity kya hai?
Hamesha BFS-shortest path se augment karo; , capacities se independent.
Edmonds-Karp capacity-independent kyun hai?
BFS distances kabhi decrease nahi hote; har edge baar saturate hota hai → augmentations × BFS.
Max flow run karne ke baad min cut kaise recover karte hain?
= final residual graph mein se reachable nodes; = baaki. Cross karne wale forward edges saturated hain.
Kisi bhi cut pe flow ke barabar kyun hota hai?
par conservation ka sum internal edges cancel kar deta hai, net flow out of = net flow out of = bachta 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

Concept Map

has

has

value

capacity

Step1 flow across cut

Step2 weak duality

equality achievable

no augmenting path

defines

drives

Flow network G

Capacity constraint

Flow conservation

Feasible flow f

|f| net leaving s

s-t cut S,T

c of S,T forward edges

every flow <= every cut

Max-Flow Min-Cut theorem

Residual graph

Ford-Fulkerson / Edmonds-Karp