Class MaximumFlowAbstract
- java.lang.Object
-
- com.jgalgo.alg.connect.MinimumEdgeCutStAbstract
-
- com.jgalgo.alg.flow.MaximumFlowAbstract
-
- All Implemented Interfaces:
MinimumEdgeCutSt
,MaximumFlow
- Direct Known Subclasses:
MaximumFlowAbstractWithoutResidualNet
,MaximumFlowAbstractWithResidualNet
public abstract class MaximumFlowAbstract extends MinimumEdgeCutStAbstract implements MaximumFlow
Abstract class for computing a maximum flow in a graph.This abstract class also implements the
MinimumEdgeCutSt
interface, and thus can be used to compute the minimum edge cut of a graph.The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.
- Author:
- Barak Ugav
-
-
Constructor Summary
Constructors Constructor Description MaximumFlowAbstract()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V,E>
Flow<V,E>computeMaximumFlow(Graph<V,E> g, WeightFunction<E> capacity, Collection<V> sources, Collection<V> sinks)
Calculate the maximum flow in a network between a set of sources and a set of sinks.<V,E>
Flow<V,E>computeMaximumFlow(Graph<V,E> g, WeightFunction<E> capacity, V source, V sink)
Calculate the maximum flow in a network between a source and a sink.-
Methods inherited from class com.jgalgo.alg.connect.MinimumEdgeCutStAbstract
computeMinimumCut, computeMinimumCut
-
-
-
-
Method Detail
-
computeMaximumFlow
public <V,E> Flow<V,E> computeMaximumFlow(Graph<V,E> g, WeightFunction<E> capacity, V source, V sink)
Description copied from interface:MaximumFlow
Calculate the maximum flow in a network between a source and a sink.Some algorithm might run faster for integer capacities, and
WeightFunctionInt
can be passed ascapacity
.If
g
is anIntGraph
, its better to pass aIWeightFunction
ascapacity
to avoid boxing/unboxing. Ifg
is anIntGraph
, the returned object isIFlow
.- Specified by:
computeMaximumFlow
in interfaceMaximumFlow
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphcapacity
- a capacity edge weight functionsource
- a source vertexsink
- a sink vertex- Returns:
- the flows computed for each edge
-
computeMaximumFlow
public <V,E> Flow<V,E> computeMaximumFlow(Graph<V,E> g, WeightFunction<E> capacity, Collection<V> sources, Collection<V> sinks)
Description copied from interface:MaximumFlow
Calculate the maximum flow in a network between a set of sources and a set of sinks.Some algorithm might run faster for integer capacities, and
WeightFunctionInt
can be passed ascapacity
.If
g
is anIntGraph
, its better to pass aIWeightFunction
ascapacity
to avoid boxing/unboxing. Ifg
is anIntGraph
, the returned object isIFlow
.- Specified by:
computeMaximumFlow
in interfaceMaximumFlow
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphcapacity
- a capacity edge weight functionsources
- a set of source verticessinks
- a set of sink vertices- Returns:
- the flows computed for each edge
-
-