HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Max flow algorithm for floating-point weights and E~=10*V

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
flowpointfloatingweightsalgorithmmaxforand

Problem

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.

Solution

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.

Context

StackExchange Computer Science Q#118906, answer score: 2

Revisions (0)

No revisions yet.