Class MaximumFlowAbstract
- All Implemented Interfaces:
MinimumEdgeCutSt
,MaximumFlow
- Direct Known Subclasses:
MaximumFlowAbstractWithoutResidualNet
,MaximumFlowAbstractWithResidualNet
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
-
Method Summary
Modifier and TypeMethodDescription<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
-
Constructor Details
-
MaximumFlowAbstract
public MaximumFlowAbstract()Default constructor.
-
-
Method Details
-
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
-