MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / max_flow

Method max_flow

Graph Theory/Dinics Algorithm.cpp:62–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60 return 0;
61 }
62 long long max_flow(int _s, int _t) {
63 s = _s;
64 t = _t;
65 long long flow = 0;
66 while (bfs()) {
67 done.assign(n, 0);
68 while (long long nw = dfs(s, inf)) flow += nw;
69 }
70 flow_through.assign(mxid + 10, 0);
71 for(int i = 0; i < n; i++) for(auto e : g[i]) if(e.id >= 0) flow_through[e.id] = e.flow;
72 return flow;
73 }
74};
75int main() {
76 int n, m;

Callers 1

mainFunction · 0.45

Calls 2

assignMethod · 0.80
dfsFunction · 0.70

Tested by

no test coverage detected