pgr_maxFlowMinCost_Cost
— Calculates the minmum cost maximum flow in a directed graph from the source(s) to the targets(s).
Warning
Possible server crash
Warning
Experimental functions
Availability
Support
The main characteristics are:
Summary
pgr_maxFlowMinCost_Cost(Edges SQL, source, target)
pgr_maxFlowMinCost_Cost(Edges SQL, sources, target)
pgr_maxFlowMinCost_Cost(Edges SQL, source, targets)
pgr_maxFlowMinCost_Cost(Edges SQL, sources, targets)
RETURNS FLOAT
pgr_maxFlowMinCost_Cost(Edges SQL, source, target)
RETURNS FLOAT
Example: | From vertex \(2\) to vertex \(3\) |
---|
SELECT * FROM pgr_MaxFlowMinCost_Cost(
'SELECT id,
source, target,
capacity, reverse_capacity,
cost, reverse_cost FROM edge_table',
2, 3
);
pgr_maxflowmincost_cost
-------------------------
400
(1 row)
pgr_maxFlowMinCost_Cost(Edges SQL, source, targets)
RETURNS FLOAT
Example: | From vertex \(13\) to vertices \(\{7, 1, 4\}\) |
---|
SELECT * FROM pgr_MaxFlowMinCost_Cost(
'SELECT id,
source, target,
capacity, reverse_capacity,
cost, reverse_cost FROM edge_table',
13, ARRAY[7, 1, 4]
);
pgr_maxflowmincost_cost
-------------------------
450
(1 row)
pgr_maxFlowMinCost_Cost(Edges SQL, sources, target)
RETURNS FLOAT
Example: | From vertices \(\{1, 7, 14\}\) to vertex \(12\) |
---|
SELECT * FROM pgr_MaxFlowMinCost_Cost(
'SELECT id,
source, target,
capacity, reverse_capacity,
cost, reverse_cost FROM edge_table',
ARRAY[1, 7, 14], 12
);
pgr_maxflowmincost_cost
-------------------------
650
(1 row)
pgr_maxFlowMinCost_Cost(Edges SQL, sources, targets)
RETURNS FLOAT
Example: | From vertices \(\{7, 13\}\) to vertices \(\{3, 9\}\) |
---|
SELECT * FROM pgr_MaxFlowMinCost_Cost(
'SELECT id,
source, target,
capacity, reverse_capacity,
cost, reverse_cost FROM edge_table',
ARRAY[7, 13], ARRAY[3, 9]
);
pgr_maxflowmincost_cost
-------------------------
600
(1 row)
Column | Type | Default | Description |
---|---|---|---|
Edges SQL | TEXT |
The edges SQL query as described in Inner Query. | |
source | BIGINT |
Identifier of the starting vertex of the flow. | |
sources | ARRAY[BIGINT] |
Array of identifiers of the starting vertices of the flow. | |
target | BIGINT |
Identifier of the ending vertex of the flow. | |
targets | ARRAY[BIGINT] |
Array of identifiers of the ending vertices of the flow. |
Edges SQL: | an SQL query of a directed graph of capacities, which should return a set of rows with the following columns: |
---|
Column | Type | Default | Description |
---|---|---|---|
id | ANY-INTEGER |
Identifier of the edge. | |
source | ANY-INTEGER |
Identifier of the first end point vertex of the edge. | |
target | ANY-INTEGER |
Identifier of the second end point vertex of the edge. | |
capacity | ANY-INTEGER |
Capacity of the edge (source, target)
|
|
reverse_capacity | ANY-INTEGER |
-1 | Capacity of the edge (target, source),
|
cost | ANY-NUMERICAL |
Weight of the edge (source, target) if it exists. | |
reverse_cost | ANY-NUMERICAL |
0 | Weight of the edge (target, source) if it exists. |
Where:
ANY-INTEGER: | SMALLINT, INTEGER, BIGINT |
---|---|
ANY-NUMERICAL: | smallint, int, bigint, real, float |
Type | Description |
---|---|
FLOAT |
Minimum Cost Maximum Flow possible from the source(s) to the target(s) |