Search code examples
performancealgorithmgraphgraph-algorithmnetwork-flow

calculating minimum - cut in a directed weighted graph using maxflow algorithm


i have calculated maximum flow using ford fulkerson algorithm,now i want to implement project selection problem for which i need to calculate max. no. of feasible projects.i need to find a min.cut containing no. of feasible projects with max profit. What should be the algorithm to find a min. cut *after knowing max.flow in graph.*How can i use max flow to determine cut containing i.e no. of nodes contributing to max flow.I need to select the optimal set of nodes so that revenue is maximisied. In my application each node is associated with a revenue,it can be positive and negative also. and there are precedence constraints also,eg.if a is selected than b&c also must be selected Can anybody tell me how to implement this?


I have transformed it in max flow graph as follows: if revenue(node)>0 add an edge from source->node else add an edge from node->sink and i have created a egde of infinite capacity for precedence constraints


Solution

  • we can calculate min.cut (A,B)by running dfs/bfs from source vertex, and then finding the saturated edges in final residual graph i.e.after there are no augmenting paths