-
Notifications
You must be signed in to change notification settings - Fork 258
Description
By definition in the document appendix.html, it should return 0 I believe.
g(v, f) = Sum{...} - Sum{...}
This implies the sum of g(v, f) over all vertices is zero.
g(v, f) = g(v, f') holds for all vertices v other than s and t.
Since s = t, this also implies g(t, f) = g(t, f'). (∵ everywhere except t is fixed, and the sum is fixed)
g(t,f′)−g(t,f) is maximized under these conditions. It returns this g(t,f′)−g(t,f)
Since g(t, f) = g(t, f'), the returned value should be 0.
Though, the actual implementation returns inf or the third argument (limit),
The current return value also makes sense if you view the problem as an instance of MaxFlow formulated as LP. You'll most likely get a primal unbounded, dual infeasible instance, depending on the choose of formulation.
Since there are multiple return values that makes some sense, both fix (fix documentation / fix implementation) would still leave confusion. So it might be better to assert(s != t)
and document it.
https://github.com/rust-lang-ja/ac-library-rs/pull/24/files#r485363476