Min-Cut of a weighted graph is defined as the minimum sum of weights of (at least one)edges that when removed from the graph divides the graph into two groups. Mechthild Stoer and Frank Wagner proposed an algorithm in 1995 to find minimum cut in an undirected weighted graphs.
The algorithm works on a method of shrinking the graph by merging the most tightly connected vertex until only one node is left in the graph and for each step performed, the weight of the merged cut is stored in a list. Minimum value in the list would be the minimum cut value of the graph.
Pseudocode for the algorithm is given below,
function: MinCutPhase(Graph G, Weights W, Vertex a):
A <- {a}
while A != V:
add tightly connected vertex to A
store cut_of_the_phase and shrink G by merging the two vertices added last
minimum = INF
function: MinCut(Graph G, Weights W, Vertex a):
while |V| > 1:
MinCutPhase(G,W,a)
if cut_of_the_phase < minimum:
minimum = cut_of_the_phase
return minimum
Vertex can be arbitrary and remains same throughout the whole algorithm. in MinCutPhase is a collection of vertices which starts with the arbitrary vertex and starts adding other vertices of graph one at a time until it is equal to which is collection of all vertices. Tightly connected vertex to implies a vertex whose edge weight to any of the vertex in is maximum. It can mathematically represented as , will be the new tightly connected vertex. The cut_of_the_phase is the sum of edges connecting last added vertex with rest of the graph. Minimum value of is the required result.
Last two vertices added to the set are merged by creating a single node for both of them and edges joining them are deleted. Edges connecting these vertices to other vertices are replaced with edges weighing sum of edges to both the vertex. Ex: Let vertices and are the two vertices added last to the set . Let there are three edges connecting and to the set , . Now as they are added last, vertices and are merged to a single node, say . Now, edges connecting to will be, .
For a flow network with as in the algo mentioned above, is either or , will be the maximum flow of the network from to . This is because, minimum cut will be the bottleneck capacity of the flow network. And always, the amount of flow from source side to sink side has to pass through these set of edges that are to be cut. Working on a paper, source should be on left and destination on right. The cut should always start from top of the graph, move to bottom of the graph(should not stop in between). The edges that are to be considered in min-cut should move from left of the cut to right of the cut. Sum of capacity of all these edges will be the min-cut which also is equal to max-flow of the network.
Working on a directed graph to calculate max flow of the graph using min-cut concept is shown in image below.
Few possible cuts in the graph are shown in the graph and weights of each cut are as follows: . As mentioned these are only few possible cuts but considering any valid cut would not have weight less than . And it is the min-cut of this graph which is also the max-flow of the graph as explained above.
Không có nhận xét nào:
Đăng nhận xét