2

I am looking for an algorithm, when a given two nodes 's' and 't' in a undiredted graph, to find min-cut edges, which partitions the graph into two A and B, 's' will in A and 't' will in B.

I see most people suggesting for Ford–Fulkerson algorithm to for that task, at here. I am thinking is that is it possible to use Dinic's algorithm for it. Since Dinic's algorithm can be speed up with dynamic tree. Because I want to find min-cut edges with fastest way possible.

which algorithm is faster for to find min-cut edges in a huge undirected graph?

I would like to hear some advice while I am looking into the details for these algorithm.

Thanks in advance

Community
  • 1
  • 1
arslan
  • 1,644
  • 4
  • 25
  • 51

1 Answers1

5

Basically, any algorithm which solves the maximal flow, also solves the minimal cut. Once you have the flows, find the residual flow graph. In this graph, run BFS from the source s. The min cut is just the set of edges (u, v) for which u is reachable from s, and v is not.

Since Dinic is only O(V2E) as opposed to FF's Θ(E2V), then it will be faster, in general.

The cost of finding the residual flow graph and running BFS is negligible, in this case.

Ami Tavory
  • 66,807
  • 9
  • 114
  • 153
  • Originally I applied modified dfs to find all simple paths and compute min-cut edges from these paths, but it is quite slow when graph become larger. Great answer, this gives me confidence in applying Dinic with dynamic tree for this problem. Thanks :). I hope this solution output edges faster. – arslan Mar 17 '16 at 09:24
  • @alim it is known that DTs are inferior in practice in terms of running time, so don't even bother... Use a good push relabel implementation instead – Niklas B. Mar 17 '16 at 10:09
  • @ Niklas B, Hi, I am not very familiar with these algorithms, could you please be more specific. are you suggesting to use a different algorithm or ? – arslan Mar 17 '16 at 13:31
  • @alim The table [here](https://en.wikipedia.org/wiki/Maximum_flow_problem#Solutions) outlines various known solutions. You can find it there. – Ami Tavory Mar 17 '16 at 13:33
  • @Ami Tavory, yes, I see the table, the Jim Orlin's + KRT (King, Rao, Tarjan)'s algorithm seems faster than others, since its time complexity O(VE). I just want to use an algorithm which always correctly compute and as fast as possible (simple is better too). Maybe I should check that algorithm. Some algorithm has example codes and while some bit difficut to find such sources. – arslan Mar 17 '16 at 13:38
  • @Ami Tavory, Hi, one last question I wan to ask. My graph is undirected and unweighted graph. I guess i can assign same weight on each edge, then these algorithm should be able to compute min-cut edges. Am I right? – arslan Mar 17 '16 at 16:50
  • @alim Technically, you should convert your graph into a digraph (directed graph) with antiparallel edges each with capacity 1. – Ami Tavory Mar 17 '16 at 16:52
  • @Ami Tavory, you been helpful, thank you very much :) – arslan Mar 17 '16 at 16:54
  • @Niklas B. Yes, I found dynamic tree is kind of trouble, push relabel algorithm seems easier, such I don't have to use complex data structure. – arslan Mar 24 '16 at 13:31
  • @alim not only easier, also faster in practice. Check out http://www.davideisenstat.com/dtree/ – Niklas B. Mar 24 '16 at 13:51
  • @Niklas B. Wow, the tree thing is quite complicated. I should have check push-relabel earlier. But it seems I need to do few changes to make push-relabel to find min-cuts, not max-flow which is not goal. – arslan Mar 25 '16 at 05:49
  • @alim Computing the min-cut is actually simpler: After you computed a maximum preflow using push-relabel, every "gap" (height label with no associated vertices) represents a minimum cut – Niklas B. Mar 25 '16 at 12:03
  • @NiklasB. I posted a question about min-cut by push-relabeling algorithm, and a example in figure here: http://stackoverflow.com/questions/36216258/how-to-apply-push-relabel-algorithm-to-find-min-cut-edges-in-undirected-unweight?noredirect=1#comment60064998_36216258 . could you take a look and point out in that example? that would be great if you could. – arslan Mar 25 '16 at 13:57
  • @NiklasB. I did not understand what does 'height label with no associated vertices' mean, could you explain in the example I posted? Thanks – arslan Mar 25 '16 at 14:01