Class BoykovKolmogorovMFImpl<V,E>
- 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 FlowAlgorithm
FlowAlgorithm.Flow<E>, FlowAlgorithm.FlowImpl<E>Nested classes/interfaces inherited from interface MaximumFlowAlgorithm
MaximumFlowAlgorithm.MaximumFlow<E>, MaximumFlowAlgorithm.MaximumFlowImpl<E> -
Field Summary
Fields inherited from class MaximumFlowAlgorithmBase
comparator, cutEdges, DEFAULT_EPSILON, directedGraph, edgeExtensionManager, maxFlow, maxFlowValue, network, sink, sinkPartition, source, sourcePartition, vertexExtensionManager -
Constructor Summary
ConstructorsConstructorDescriptionBoykovKolmogorovMFImpl(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 specifiesnetworkandepsilon. -
Method Summary
Modifier and TypeMethodDescriptiongetMaximumFlow(V source, V sink) Sets current source tosource, current sink tosink, then calculates maximum flow fromsourcetosink.Methods inherited from class MaximumFlowAlgorithmBase
calculateMinCut, calculateSourcePartition, composeFlow, getCurrentSink, getCurrentSource, getCutCapacity, getCutEdges, getFlowDirection, getFlowMap, getMaximumFlowValue, getSinkPartition, getSourcePartition, init, pushFlowThroughMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FlowAlgorithm
getFlowMethods inherited from interface MaximumFlowAlgorithm
getMaximumFlowValue
-
Constructor Details
-
BoykovKolmogorovMFImpl
-
BoykovKolmogorovMFImpl
-
-
Method Details
-
getMaximumFlow
Sets current source tosource, current sink tosink, then calculates maximum flow fromsourcetosink. 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
-