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

Method dfs

Graph Theory/Dinics Algorithm.cpp:45–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 return d[t] != -1;
44 }
45 long long dfs(int u, long long flow) {
46 if (u == t) return flow;
47 for (int &i = done[u]; i < (int)g[u].size(); i++) {
48 edge &e = g[u][i];
49 if (e.w <= e.flow) continue;
50 int v = e.to;
51 if (d[v] == d[u] + 1) {
52 long long nw = dfs(v, min(flow, e.w - e.flow));
53 if (nw > 0) {
54 e.flow += nw;
55 g[v][e.rev].flow -= nw;
56 return nw;
57 }
58 }
59 }
60 return 0;
61 }
62 long long max_flow(int _s, int _t) {
63 s = _s;
64 t = _t;

Callers

nothing calls this directly

Calls 2

dfsFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected