Pipeline Max Flow Problem
Pipeline Max Flow Problem — ExecCode Hard DSA Practice
Solve the Pipeline Max Flow problem on ExecCode. Free online hard DSA practice in Graph. Write and run code in Java, C++, Python — no signup required to run.
Problem description
A directed pipeline network has capacities. You want the maximum barrels per hour from source to sink. Dinic's blocking flow (or push-relabel) computes max flow. Residual edges let you reroute. Each edge is [u, v, capacity]. Return the maximum flow. If the sink is unreachable, return 0. You are given: n — nodes edges — directed capacities source — start sink — end Return maximum flow value. Flow conservation holds at every node except source and sink.
Examples
Input {'n': 4, 'edges': [[0, 1, 3], [0, 2, 2], [1, 3, 2], [2, 3, 3], [1, 2, 1]], 'source': 0, 'sink': 3}; Output 5. Input {'n': 2, 'edges': [[0, 1, 7]], 'source': 0, 'sink': 1}; Output 7. Input {'n': 3, 'edges': [[0, 1, 5]], 'source': 0, 'sink': 2}; Output 0
Constraints
Capacities >= 0 Parallel edges stack as separate residual links
Practice Pipeline Max Flow free on ExecCode. Browse DSA problems, topic map, and placement guides.