4

Could you, please, suggest a maximum flow algorithm for a graph with floating-point weights and the number of edges approximately equal to the number of vertices? I.e. O(V^3) algorithms take too much time, but O(E^2) algorithms are much more preferable. More specifically, you can assume V~=1M and E~=10M where M stands for millions.

2 Answers2

2

Push-relabel with 'highest label first' heuristic is considered state of the art for a long time. It has a theoretical running time of $O(n^2 \sqrt{m})$, but runs very fast in practice. As far as I know, most algorithms that uses sophisticated data structures such as dynamic trees are outperformed in practice. You can look at the paper "Computational investigations of maximum flow algorithms" which shows some measurements of different running times of algorithms. The push-relabel algorithm is available in boost in C++, JGraphT or JGAlgo in Java, and many more libraries (not in networkx).

Regarding floating points, almost all algorithms should work for them theoretically (unless scaling is used, which is not common for max flow). In practice, there are errors because of rounding, but in most libraries you can specific an epsilon of precision which should solve the problem. Boost support template for the capacity type, so you can use other types other than double for it, such as big decimal, but it would probability be ~1000 times slower.

barakugav
  • 36
  • 2
1

Orlin's algorithm can solve max flow in sparse graphs in $O(|V| |E|)$ time. See

Max flows in O(nm) time, or better. James B. Orlin. STOC 2013.

You'll have to decide whether the potential speedup is worth the time to implement it, as I believe the algorithm is quite complex. I don't know whether the algorithm is better in practice.

Perhaps someone else will have better suggestions for you.

D.W.
  • 167,959
  • 22
  • 232
  • 500