Interface FlowNetwork.Int
-
- All Superinterfaces:
FlowNetwork
- Enclosing interface:
- FlowNetwork
public static interface FlowNetwork.Int extends FlowNetwork
Flow on graph edges, with integer capacities and flows values.Similar to the regular
FlowNetwork
interface, but with integer capacities and flows. Some algorithms that work on flow networks are specifically for integers networks, or may performed faster if the capacities and flows are integers.- Author:
- Barak Ugav
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jgalgo.FlowNetwork
FlowNetwork.Int
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static FlowNetwork.Int
createAsEdgeWeight(Graph g)
Create an integer flow network by adding edge weights usingGraph.addEdgesWeights(java.lang.Object, java.lang.Class<? super E>)
.default double
getCapacity(int edge)
Deprecated.int
getCapacityInt(int edge)
Get the integer capacity of an edge.default double
getFlow(int edge)
Deprecated.int
getFlowInt(int edge)
Get the integer amount of flow units going along an edge.default void
setCapacity(int edge, double capacity)
Deprecated.void
setCapacity(int edge, int capacity)
Set the integer capacity of an edge.default void
setFlow(int edge, double flow)
Deprecated.void
setFlow(int edge, int flow)
Set the integer amount of flow units going along an edge.
-
-
-
Method Detail
-
getCapacityInt
int getCapacityInt(int edge)
Get the integer capacity of an edge.- Parameters:
edge
- an edge identifier in the graph- Returns:
- the capacity of the edge
- Throws:
IndexOutOfBoundsException
- ifedge
is not a valid edge identifier
-
getCapacity
@Deprecated default double getCapacity(int edge)
Deprecated.Description copied from interface:FlowNetwork
Get the capacity of an edge.- Specified by:
getCapacity
in interfaceFlowNetwork
- Parameters:
edge
- an edge identifier in the graph- Returns:
- the capacity of the edge
-
setCapacity
void setCapacity(int edge, int capacity)
Set the integer capacity of an edge.- Parameters:
edge
- an edge identifier in the graphcapacity
- the new capacity of the edge- Throws:
IndexOutOfBoundsException
- ifedge
is not a valid edge identifierIllegalArgumentException
- ifcapacity
is negative
-
setCapacity
@Deprecated default void setCapacity(int edge, double capacity)
Deprecated.Description copied from interface:FlowNetwork
Set the capacity of an edge.- Specified by:
setCapacity
in interfaceFlowNetwork
- Parameters:
edge
- an edge identifier in the graphcapacity
- the new capacity of the edge
-
getFlowInt
int getFlowInt(int edge)
Get the integer amount of flow units going along an edge.If the graph is directed, a flow of \(f\) units on
e
, for \(0 \leq f \leq cap(e)\), means a flow of \(f\) units of flow fromedgeSource(e)
toedgeTarget(e)
.If the graph is undirected, a flow of \(+f\) units on
e
, for \(0 \leq f \leq cap(e)\), means a flow of \(f\) units of flow fromedgeSource(e)
toedgeTarget(e)
, while a flow of \(-f\) units one
, for \(-cap(e) \leq -f < 0\), means a flow of \(|-f|\) units of flow fromedgeTarget(e)
toedgeSource(e)
(opposite direction).- Parameters:
edge
- an edge identifier in the graph- Returns:
- the amount of flow units going along an edge
- Throws:
IndexOutOfBoundsException
- ifedge
is not a valid edge identifier
-
getFlow
@Deprecated default double getFlow(int edge)
Deprecated.Description copied from interface:FlowNetwork
Get the amount of flow units going along an edge.If the graph is directed, a flow of \(f\) units on
e
, for \(0 \leq f \leq cap(e)\), means a flow of \(f\) units of flow fromedgeSource(e)
toedgeTarget(e)
.If the graph is undirected, a flow of \(+f\) units on
e
, for \(0 \leq f \leq cap(e)\), means a flow of \(f\) units of flow fromedgeSource(e)
toedgeTarget(e)
, while a flow of \(-f\) units one
, for \(-cap(e) \leq -f < 0\), means a flow of \(|-f|\) units of flow fromedgeTarget(e)
toedgeSource(e)
(opposite direction).- Specified by:
getFlow
in interfaceFlowNetwork
- Parameters:
edge
- an edge identifier in the graph- Returns:
- the amount of flow units going along an edge
-
setFlow
void setFlow(int edge, int flow)
Set the integer amount of flow units going along an edge.- Parameters:
edge
- an edge identifier in the graphflow
- the new flow of the edge- Throws:
IndexOutOfBoundsException
- ifedge
is not a valid edge identifier
-
setFlow
@Deprecated default void setFlow(int edge, double flow)
Deprecated.Description copied from interface:FlowNetwork
Set the amount of flow units going along an edge.- Specified by:
setFlow
in interfaceFlowNetwork
- Parameters:
edge
- an edge identifier in the graphflow
- the new flow of the edge
-
createAsEdgeWeight
static FlowNetwork.Int createAsEdgeWeight(Graph g)
Create an integer flow network by adding edge weights usingGraph.addEdgesWeights(java.lang.Object, java.lang.Class<? super E>)
.Unless
setCapacity(int, int)
orsetFlow(int, int)
are used, the capacity and flow of each edge will be zero.- Parameters:
g
- a graph- Returns:
- a flow network implemented as edge weights
-
-