- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
FlowAlgorithm<V,
,E> MaximumFlowAlgorithm<V,
,E> MinimumSTCutAlgorithm<V,
E>
This implementation uses 2 heuristics described in Vladimir Kolmogorov's original PhD thesis:
- Timestamp heuristic.
- Distance heuristic;
The worse-case running time of this algorithm on a network $G = (V, E)$ with a capacity function $c: E \rightArrow R^{+}$ is $\mathcal{O}(E\times f)$, where $f$ is the maximum flow value. The reason for this is that the algorithm doesn't necessarily augments shortest $s-t$ paths in a residual network. That's why the argument about the running time complexity is the same as with the Ford-Fulkerson algorithm.
This algorithm doesn't have the best performance on all types of networks. It's recommended to
check if this algorithm gives substantial performance improvement before using it in a particular
application. A good general-purpose alternative which works fast in all scenarios is the
PushRelabelMFImpl
.
This algorithm works with both directed and undirected networks. The algorithm doesn't have internal synchronization, thus any concurrent network modification has undefined behaviour.
- Author:
- Timofey Chudakov
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapht.alg.interfaces.FlowAlgorithm
FlowAlgorithm.Flow<E>, FlowAlgorithm.FlowImpl<E>
Nested classes/interfaces inherited from interface org.jgrapht.alg.interfaces.MaximumFlowAlgorithm
MaximumFlowAlgorithm.MaximumFlow<E>, MaximumFlowAlgorithm.MaximumFlowImpl<E>
-
Field Summary
Fields inherited from class org.jgrapht.alg.flow.MaximumFlowAlgorithmBase
comparator, cutEdges, DEFAULT_EPSILON, directedGraph, edgeExtensionManager, maxFlow, maxFlowValue, network, sink, sinkPartition, source, sourcePartition, vertexExtensionManager
-
Constructor Summary
ConstructorDescriptionBoykovKolmogorovMFImpl
(Graph<V, E> network) Creates a new algorithm instance with the specifiednetwork
.BoykovKolmogorovMFImpl
(Graph<V, E> network, double epsilon) Construct a new algorithm instance with the specifiesnetwork
andepsilon
. -
Method Summary
Modifier and TypeMethodDescriptiongetMaximumFlow
(V source, V sink) Sets current source tosource
, current sink tosink
, then calculates maximum flow fromsource
tosink
.Methods inherited from class org.jgrapht.alg.flow.MaximumFlowAlgorithmBase
calculateMinCut, calculateSourcePartition, composeFlow, getCurrentSink, getCurrentSource, getCutCapacity, getCutEdges, getFlowDirection, getFlowMap, getMaximumFlowValue, getSinkPartition, getSourcePartition, init, pushFlowThrough
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jgrapht.alg.interfaces.FlowAlgorithm
getFlow
Methods inherited from interface org.jgrapht.alg.interfaces.MaximumFlowAlgorithm
getMaximumFlowValue
-
Constructor Details
-
BoykovKolmogorovMFImpl
Creates a new algorithm instance with the specifiednetwork
. The created algorithm uses default epsilon.- Parameters:
network
- flow network.
-
BoykovKolmogorovMFImpl
Construct a new algorithm instance with the specifiesnetwork
andepsilon
.- Parameters:
network
- flow networkepsilon
- tolerance for the comparison of floating point values
-
-
Method Details
-
getMaximumFlow
Sets current source tosource
, current sink tosink
, then calculates maximum flow fromsource
tosink
. Returns an object containing detailed information about the flow.- Parameters:
source
- source of the flow inside the networksink
- sink of the flow inside the network- Returns:
- maximum flow
-