stevenhalim / cpbook-code

CP4 Free Source Code Project (C++17, Java11, Python3 and OCaml)
2k stars 493 forks source link

Update mcmf.cpp to simplify updates to total_cost #112

Open teekaytai opened 5 months ago

teekaytai commented 5 months ago

Instead of updating total_cost​ once for each edge with total_cost += pushed * cost, we can update the total_cost​ once per augmenting path with total_cost += f * d[t]​, since every path to the sink in the level graph has the same total cost.