I figured you'd have to check the edges that are saturated, and if there's a path of saturated edges with the same capacity, choose any of them. But I'm having trouble on cases where there may be many of those paths or the saturated edges are connected by non-saturated edges with higher capacity in between.

I came up with checking every path that has at least one saturated edge, but I think that would be too slow as it may check too many edges just to get one of the saturated ones, in something like $$$O(|minCutEdges| \cdot E)$$$.

How do you do it efficiently?

If it's relevant, I'm trying to solve this problem (can find the optimal profit but can't print the solution): szkopul — Travel Agency (biu)

Auto comment: topic has been updated by SuperSheep (previous revision, new revision, compare).After you've run your flow algorithm on the graph, the ending point will not be reachable from the starting point (if only positive weight edges are traversed). Let $$$A$$$ be the set of all nodes reachable from the starting point and let $$$B$$$ be the set of all nodes

notreachable from the starting point. Now, the minimum cut is formedexactlyby all edges satisfying all following properties:Finding all such edges shouldn't be too difficult. If you can't come up with anything, I can help more.

Thanks a lot!

That was a very clear and helpful explanation. I get it now :)