MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / add_edge

Method add_edge

code/graph/edmonds_karps_mcmf.cpp:12–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 flow_network(int _n) : n(_n), head(n,-1) { }
11 void reset() { e = e_store; }
12 void add_edge(int u, int v, int cost, int uv, int vu=0) {
13 e.push_back(edge(v, uv, cost, head[u]));
14 head[u] = (int)size(e)-1;
15 e.push_back(edge(u, vu, -cost, head[v]));
16 head[v] = (int)size(e)-1; }
17 ii min_cost_max_flow(int s, int t, bool res=true) {
18 e_store = e;
19 memset(pot, 0, n*sizeof(int));

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
edgeClass · 0.70

Tested by

no test coverage detected