JuliaGraphs / LightGraphsFlows.jl

Flow algorithms on LightGraphs
Other
36 stars 11 forks source link

Edmonds Karp Algorithm for maximum flows not returning the labels for the s-t min cut #10

Closed CBongiova closed 6 years ago

CBongiova commented 6 years ago

Hello, I am running the maximum_flow function (Edmonds Karp Algorithm) but I have noticed that the function does not return the labelling associated with the minimum cut.
Is there a way to return this output? Thanks!

matbesancon commented 6 years ago

you're right, from some quick research, this is an information you can extract from the dual variables at the optimum. From an API perspective, a mincost function could be called, using maxflow under the hood but returning a set of arcs corresponding to this min cut If you want to give it a try, don't hesistate to PR ;)

CBongiova commented 6 years ago

Actually I have just found out that it is possible to extract the mincut with the Erdos package (https://carlolucibello.github.io/Erdos.jl/latest/flow/). So the problem is solved :)

matbesancon commented 6 years ago

I'll keep this open since having a min-cut format of the flow algorithms still seems interesting for LightGraphs

sbromberger commented 6 years ago

Are we sure we don't have this functionality already? If not, Erdos would be a good reference.

matbesancon commented 6 years ago

there is a mincut function in LG, but it does not seem to be the same concept (or I don't understand it). Nothing of the kind in LGFlows yet

CBongiova commented 6 years ago

@mbesancon Indeed it is not the same concept. You want to retrieve the labelling associated with the mincut from a source-sink maximum flow problem. This link should explain the concept: https://www.geeksforgeeks.org/minimum-cut-in-a-directed-graph/

matbesancon commented 6 years ago

thanks @CBongiova, I was thinking about how to solve this one but the residual flow approach seems to be the simplest. I'll start working on this

matbesancon commented 6 years ago

See the #11 PR ;)