Let (G,s,t,{c}) be a flow network, and let F be the set of all edges e for which there exists at least one minimum cut (A,B) such that e goes from A to B. Give a polynomial time algorithm that finds all edges in F.
NOTE: So far I know I need to run Ford-Fulkerson so each edges has a flow. Furthermore I know for all edges in F, the flow f(e) = c(e). However not all edges in a graph G which respects that constraint will be in a min-cut. I am stuck here.
Suppose you have computed a max flow on a graph
Gand you know the flow through every edge in the graph. From the source vertexs, perform a Breadth First Search OR Depth First Search on the original graph and only traverse those edges that have flow less than the capacity of the edge. Denote the set of vertices reachable in this traversal asS, and unreachable vertices asT.To obtain the minimum cut
C, we simply find all edges in the original graphGwhich begin at some vertex inSand end at some vertex inT.This tutorial in Topcoder provides an explanation / proof of the above algorithm. Look at the section beginning with the following text:
I shall attempt to provide an explanation of the corresponding section in the Topcoder tutorial (just for me to brush up on this as well).
Now, suppose that we have computed a max flow on a graph
G, and that we have computed the set of edgesCusing the procedure outlined above. From here, we can conclude several facts.Fact 1: Source vertex
smust be in setS, and sink vertextmust be in setT.Otherwise, vertices
sandtmust be in the same set, which means that we must have found a path fromstotconsisting only of edges that have flow less than capacity. This means that we can push more flow fromstot, and therefore we have found an augmenting path! However, this is a contradiction, since we have already computed a max flow on the graph. Hence, it is impossible for source vertexsand sink vertextto be connected, and they must be in different sets.Fact 2: Every edge beginning at set
Sand ending at setTmust have flow == capacityAgain we prove this by contradiction. Suppose that there is a vertex
uinSand a vertexvinT, such that edge(u,v)in the residual network has flow less than capacity. By our algorithm above, this edge will be traversed, and vertexvshould be in setS. This is a contradiction. Therefore, such an edge must have flow == capacity.Fact 3: Removing the edges in
Cfrom graphGwill mean that there is no path from any vertex in setSto any vertex in setTSuppose that this is not the case, and there is some edge
(u,v)that connects vertexuin setSto vertexvin setT. We can separate this into 2 cases:(u,v)is less than its capacity. But we know this will cause vertexvto be part of setS, so this case is impossible.(u,v)is equal to its capacity. This is impossible since edge(u,v)will be considered as part of the edge setC.Hence both cases are impossible, and we see that removing the edges in
Cfrom the original graphGwill indeed result in a situation where there is no path fromStoT.Fact 4: Every edge in the original graph
Gthat begins at vertex setTbut ends at vertex setSmust have a flow of0The explanation on the Topcoder tutorial may not be obvious on first reading and the following is an educated guess on my part and may be incorrect.
Suppose that there exists some edge
(x,y)(wherexbelongs to vertex setTandybelongs to vertex setS), such that the flow through(x,y)is greater than 0. For convenience, we denote the flow through(x,y)asf. This means that on the residual network, there must exist a backward edge(y,x)with capacityfand flow0. Since vertexyis part of setS, the backward edge(y,x)has flow0with capacityf > 0, our algorithm will traverse the edge(y,x)and place vertexxas part of vertex setS. However, we know that vertexxis part of vertex setT, and hence this is a contradiction. As such, all edges fromTtoSmust have a flow of 0.With these 4 facts, along with the Max-flow min-cut theorem, we can conclude that:
The max flow must be less than or equal to the capacity of any cut. By Fact 3,
Cis a cut of the graph, so the max flow must be less than or equal to the capacity of cutC.Fact 4 allows us to conclude that there is no "back flow" from
TtoS. This along with Fact 2 means that the flow consists entirely of "forward flow" fromStoT. In particular, all the forward flow must result from the cutC. This flow value happens to be the max flow. As such, by the Max-flow min-cut theorem, we know thatCmust be a minimum cut.