Closed
Description
Reporter: Mi_Sawa (Japanese tweet: https://twitter.com/Mi_Sawa/status/1303170874938331137)
max_flow
/ min_cost_flow
cannot handle self-loops "correctly".
This is the code of max_flow.add_edge()
. We can notice that we cannot handle an id of reverse edge correctly.
In now, in spite of this code wrong, everything goes well. However, cleary we should fix this.
int add_edge(int from, int to, Cap cap) {
assert(0 <= from && from < _n);
assert(0 <= to && to < _n);
assert(0 <= cap);
int m = int(pos.size());
pos.push_back({from, int(g[from].size())});
g[from].push_back(_edge{to, int(g[to].size()), cap});
g[to].push_back(_edge{from, int(g[from].size()) - 1, 0});
return m;
}
Metadata
Metadata
Assignees
Labels
No labels