Network Flow
algo.maxFlow
| Property | Value |
|---|---|
Procedure |
|
Category |
Network Flow |
Complexity |
CPU+RAM |
Min Args |
2 |
Max Args |
4 |
Syntax
CALL algo.maxFlow(sourceNode, sinkNode [, relTypes, capacityProperty])
YIELD maxFlow, sourceId, sinkId
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
|
Vertex |
Yes |
— |
Flow source vertex |
|
Vertex |
Yes |
— |
Flow sink vertex |
|
String |
No |
all types |
Comma-separated relationship types |
|
String |
No |
uniform capacity |
Edge property for flow capacity |
Yield Fields
| Field | Type | Description |
|---|---|---|
|
Double |
Maximum flow value from source to sink |
|
RID |
Identity of the source vertex |
|
RID |
Identity of the sink vertex |
Description
Computes the maximum flow from a source to a sink using the Edmonds-Karp algorithm (BFS-based Ford-Fulkerson). Time complexity is O(V·E²). Builds a V×V capacity matrix (O(V²) memory). Returns a single row with the maximum achievable flow.
Use Cases
-
Network throughput capacity analysis
-
Traffic flow optimization
-
Supply chain max throughput calculation
Example
MATCH (src:Node {id:'source'}), (sink:Node {id:'sink'})
CALL algo.maxFlow(src, sink, 'PIPE', 'capacity')
YIELD maxFlow, sourceId, sinkId
RETURN maxFlow, sourceId, sinkId
References