How can I find the minimum cut on a graph using a maximum flow algorithm?

瘦欲@ 提交于 2019-11-28 03:19:03

From the source vertex, do a depth-first search along edges in the residual network (i.e., non-saturated edges and back edges of edges that have flow), and mark all vertices that can be reached this way. The cut consists of all edges that go from a marked to an unmarked vertex. Clearly, those edges are saturated and thus were not traversed. As you noted, there might be other saturated edges that are not part of the minimum cut.

I don't want to be picky, but the suggested solution is not quite right as proposed.

Correct solution: What you actually should be doing is bfs/dfs on the Residual-Network Gf (read it up on wikipedia) and marking vertices. And then you can pick those with marked from-vertex and unmarked to-vertex.

Why 'following unsaturated edges' is not enough: Consider, that the flow algorithm saturates the edges as shown in the picture. I marked the vertices I'm visiting with the approach of "just following unsaturated edges" with green. Clearly the only correct min-cut is the edge from E-F, while the suggested solution would also return A-D (and maybe even D-E).

Note that the vertex D would be visited by the dfs/bfs if we considered the Residual network instead, because there'd be an edge from E to D, thereby making the edge E-F the only one with a marked from-vertex and an unmarked to-vertex.

Gyula

Note: Falk's algorythm can be used to find both a minimum cut with minimum vertices and with maximum vertices. For the latter the algorythm should be reversed, ie. search from the sink vertex instead of the source. See a related question: Network Flow: Adding a new edge

One way to understand is, let's define a cut as two sets S and T, which will include s and t, respectively.

Now, add all vertices in S that are reachable from s in the residual network and put the remaining edges in T. This will be one cut.

Second, cut can be formed by putting all vertices in T that are reachable from t in the residual network and put the remaining vertices in S.

Take a look at this video to find out how do we find the vertices reachable from s and t.

https://www.youtube.com/watch?v=FIJaXfUIXJA&index=4&list=PLe-ggMe31CTduQ68XQ-sVj32wYJIspTma

So, to give the exact procedure how to obtain the minumum cut:

  1. Run Ford-Fulkerson algorithm to find the max flow and to get the residual graph1.
  2. Run BFS on the residual graph to find the set of vertices that are reachable from source in the residual graph.(respecting that you can't use edges with 0 capacity in the residual graph) IMPORTANT: You have to use reverse edges in the residual graph to find the correct set of reachable vertices!!! (See this algorithm)
  3. All edges in the original graph which are from a reachable vertex to non-reachable vertex are minimum cut edges. Print all such edges.

1 Graph in which the capacity of an edge is defined like it's original capacity minus its flow (flow from the maximum flow network).

SPV

After the maximum flow is calculated, we can search for edges (u,v) such that in the residual graph, there's a edge in the residual graph from v to u and f(v,u) = c(u,v) [which means the edge is saturated]

After shortlisting such edges, we can select such edges (u,v) by using the criteria that there exists no path from u to sink t in the residual graph. If this condition is satisfied, then such edges form a part of (S,T) cut

Running time of this algorithm may be O(E) * O( V + E ) = O( E^2 )

I think this is what other people are saying, but I found it unclear so here's my explanation:

From the source node, do a flood fill of the graph, travelling only along edges with residual capacity, marking each visited vertex. You can use a DFS for this. Recall that back edges from a vertex have a residual capacity - equal to the flow along the forward edge (ie. r(u, v) = remaining capacity for edge (u, v), r(v, u) = flow(u, v)).

In effect, this determines the S part of the S-T cut of the graph.

The minimum cut will now be the set of edges such that one vertex is marked from your flood fill above, and the other vertex is not marked. These will be edges without residual capacity (otherwise you would have traversed them in your DFS), and together form the minimum cut.

After removing these edges, the set of unmarked vertices will form the T section of the cut.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!