开发者

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

开发者 https://www.devze.com 2023-01-31 12:52 出处:网络
I need to find the minimum cut on a graph. I\'ve been reading about flow networks, but all I can find are maximum flow algorithms such as Ford-Fulkerson, push-relabel, etc. Given the max flow-min cut

I need to find the minimum cut on a graph. I've been reading about flow networks, but all I can find are maximum flow algorithms such as Ford-Fulkerson, push-relabel, etc. Given the max flow-min cut theorem, is it possible to use one of those algorithms to find the minimum cut on a graph using a maximum flow algorithm? How?

The best information I have found so far is that if I find "saturated" edges i.e. edges whe开发者_JS百科re flow equals capacity, those edges correspond to the minimum cut. Is that true? It doesn't sound 100% right to me. It is true that all edges on the minimum cut will be saturated, but I believe there might also be saturated edges which are out of the minimum cut "path".


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).

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

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.


So, to give the exact procedure how to obtain the minimum 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).


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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消