V
- the graph vertex type.E
- the graph edge type.public class DinicMFImpl<V,E> extends MaximumFlowAlgorithmBase<V,E>
MaximumFlowAlgorithm.MaximumFlow<E>, MaximumFlowAlgorithm.MaximumFlowImpl<E>
FlowAlgorithm.Flow<E>, FlowAlgorithm.FlowImpl<E>
comparator, cutEdges, DEFAULT_EPSILON, directedGraph, edgeExtensionManager, maxFlow, maxFlowValue, network, sink, sinkPartition, source, sourcePartition, vertexExtensionManager
Constructor and Description |
---|
DinicMFImpl(Graph<V,E> network)
Constructor.
|
DinicMFImpl(Graph<V,E> network,
double epsilon)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
dfs(org.jgrapht.alg.flow.DinicMFImpl.VertexExtension v,
double flow)
Finds a blocking flow in the network.
|
void |
dinic()
Runs Dinic algorithm with scaling.
|
MaximumFlowAlgorithm.MaximumFlow<E> |
getMaximumFlow(V source,
V sink)
Sets current source to source, current sink to sink, then calculates
maximum flow from source to sink.
|
calculateMinCut, calculateSourcePartition, composeFlow, getCurrentSink, getCurrentSource, getCutCapacity, getCutEdges, getFlowDirection, getFlowMap, getMaximumFlowValue, getSinkPartition, getSourcePartition, init, pushFlowThrough
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
calculateMaximumFlow, getMaximumFlowValue
getFlow
public DinicMFImpl(Graph<V,E> network, double epsilon)
network
- the network on which we calculate the maximum flow.epsilon
- the tolerance for the comparison of floating point values.public MaximumFlowAlgorithm.MaximumFlow<E> getMaximumFlow(V source, V sink)
MaximumFlowAlgorithm
source
- source of the flow inside the networksink
- sink of the flow inside the networkpublic double dfs(org.jgrapht.alg.flow.DinicMFImpl.VertexExtension v, double flow)
v
- current vertex.flow
- we can push through.public void dinic()
Copyright © 2018. All rights reserved.