Network Flow

algo.maxFlow

Property Value

Procedure

algo.maxFlow

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

sourceNode

Vertex

Yes

Flow source vertex

sinkNode

Vertex

Yes

Flow sink vertex

relTypes

String

No

all types

Comma-separated relationship types

capacityProperty

String

No

uniform capacity

Edge property for flow capacity

Yield Fields

Field Type Description

maxFlow

Double

Maximum flow value from source to sink

sourceId

RID

Identity of the source vertex

sinkId

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