pgr_maxFlow
— Calculates the maximum flow in a directed graph from the source(s) to the targets(s) using the Push Relabel algorithm.
Availability: 2.4.0
Warning
Experimental functions
Characteristics
pgr_maxFlow(edges_sql, source, target)
pgr_maxFlow(edges_sql, sources, target)
pgr_maxFlow(edges_sql, source, targets)
pgr_maxFlow(edges_sql, sources, targets)
RETURNS BIGINT
Calculates the maximum flow from the source to the target.
pgr_maxFlow(edges_sql, source, target)
RETURNS BIGINT
Example: 

SELECT * FROM pgr_maxFlow(
'SELECT id,
source,
target,
capacity,
reverse_capacity
FROM edge_table'
, 6, 11
);
pgr_maxflow

230
(1 row)
Calculates the maximum flow from the source to all of the targets.
pgr_maxFlow(edges_sql, source, targets)
RETURNS BIGINT
Example: 

SELECT * FROM pgr_maxFlow(
'SELECT id,
source,
target,
capacity,
reverse_capacity
FROM edge_table'
, 6, ARRAY[11, 1, 13]
);
pgr_maxflow

340
(1 row)
Calculates the maximum flow from all the sources to the target.
pgr_maxFlow(edges_sql, sources, target)
RETURNS BIGINT
Example: 

SELECT * FROM pgr_maxFlow(
'SELECT id,
source,
target,
capacity,
reverse_capacity
FROM edge_table'
, ARRAY[6, 8, 12], 11
);
pgr_maxflow

230
(1 row)
Calculates the maximum flow from all of the sources to all of the targets.
pgr_maxFlow(edges_sql, sources, targets)
RETURNS BIGINT
Example: 

SELECT * FROM pgr_maxFlow(
'SELECT id,
source,
target,
capacity,
reverse_capacity
FROM edge_table'
, ARRAY[6, 8, 12], ARRAY[1, 3, 11]
);
pgr_maxflow

360
(1 row)
edges_sql:  an SQL query, which should return a set of rows with the following columns: 

Column  Type  Default  Description 

id  ANYINTEGER 
Identifier of the edge.  
source  ANYINTEGER 
Identifier of the first end point vertex of the edge.  
target  ANYINTEGER 
Identifier of the second end point vertex of the edge.  
capacity  ANYINTEGER 
Weight of the edge (source, target)


reverse_capacity  ANYINTEGER 
1  Weight of the edge (target, source),

Where:
ANYINTEGER:  SMALLINT, INTEGER, BIGINT 

Column  Type  Default  Description 

edges_sql  TEXT 
The edges SQL query as described above.  
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. 
Type  Description 

BIGINT 
Maximum flow possible from the source(s) to the target(s) 