FindMaximumFlow
finds the maximum flow between source vertex s and target vertex t in a graph g.
finds the maximum flow between vertex indices s and t in a graph with edge capacity matrix m.
finds the maximum flow between multi-sources s1, … and multi-targets t1, ….
Details and Options


- FindMaximumFlow finds the maximum flow from a source vertex to a target vertex, subject to capacity constraints.
- By default, the maximum flow is returned.
- Matrices and SparseArray objects can be used in FindMaximumFlow.
- For undirected graphs, edges are taken to have flows in both directions at the same time and same capacities.
- Self-loops are ignored, and parallel edges are merged.
- FindMaximumFlow[data,source,target,"OptimumFlowData"] returns an OptimumFlowData object flowdata that can be used to extract additional properties, using the form flowdata["property"].
- FindMaximumFlow[data,source,target,"property"] can be used to directly give the value of "property".
- Properties related to the optimal flow data include:
-
"EdgeList" list of edges contributing to the flow "FlowGraph" graph of vertices and edges contributing to the flow "FlowMatrix" matrix of edge flows between pairs of vertices "FlowTable" formatted table of edge flows "FlowValue" value of the flow "ResidualGraph" residual graph of the flow "VertexList" list of vertices contributing to the flow - The following options can be given:
-
EdgeCapacity Automatic capacity for each edge VertexCapacity Automatic capacity for each vertex - With the default setting EdgeCapacity->Automatic, the edge capacity of an edge is taken to be the EdgeCapacity of the graph g if available; otherwise, it is 1.
- With the default setting VertexCapacity->Automatic, the vertex capacity of a vertex is taken to be the VertexCapacity of the graph g if available; otherwise, it is Infinity.
- FindMaximumFlow works with undirected graphs, directed graphs, multigraphs, and mixed graphs.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Find the maximum flow between two vertices in a graph:

https://wolfram.com/xid/0btng3or8t0t-qwzt6s

Find the maximum flow between "s" and "t":

https://wolfram.com/xid/0btng3or8t0t-5xwv1k

https://wolfram.com/xid/0btng3or8t0t-0qrgps


https://wolfram.com/xid/0btng3or8t0t-cnjuhi

Scope (10)Survey of the scope of standard use cases
FindMaximumFlow works with undirected graphs:

https://wolfram.com/xid/0btng3or8t0t-gay90t


https://wolfram.com/xid/0btng3or8t0t-1vbgvr


https://wolfram.com/xid/0btng3or8t0t-s2h57c


https://wolfram.com/xid/0btng3or8t0t-i4ww80


https://wolfram.com/xid/0btng3or8t0t-5e2cau

Use rules to specify the graph:

https://wolfram.com/xid/0btng3or8t0t-bndh30

Compute the maximum flow for an edge capacity matrix:

https://wolfram.com/xid/0btng3or8t0t-cojxn

Compute the maximum flow between multi-sources and multi-sinks:

https://wolfram.com/xid/0btng3or8t0t-3vnkdo

Find properties of a maximum flow:

https://wolfram.com/xid/0btng3or8t0t-7cd155
The value of the maximum flow:

https://wolfram.com/xid/0btng3or8t0t-gtx79i

List of edges contributing to the flow:

https://wolfram.com/xid/0btng3or8t0t-bd3lak


https://wolfram.com/xid/0btng3or8t0t-scruz


https://wolfram.com/xid/0btng3or8t0t-q6o4gi

FindMaximumFlow works with large graphs:

https://wolfram.com/xid/0btng3or8t0t-bdnamb

https://wolfram.com/xid/0btng3or8t0t-gegolt


https://wolfram.com/xid/0btng3or8t0t-7ckwl

Options (2)Common values & functionality for each option
EdgeCapacity (1)
By default, the edge capacity of an edge is taken to be its EdgeCapacity property if available, otherwise 1:

https://wolfram.com/xid/0btng3or8t0t-uc5puh

Use EdgeCapacity->capacities to set the edge capacity:

https://wolfram.com/xid/0btng3or8t0t-dh45n

VertexCapacity (1)
By default, the vertex capacity of a vertex is taken to be its VertexCapacity property if available, otherwise Infinity:

https://wolfram.com/xid/0btng3or8t0t-m22fcr

Use VertexCapacity->capacities to set the vertex capacity:

https://wolfram.com/xid/0btng3or8t0t-gl2o5n

Applications (7)Sample problems that can be solved with this function
Transportation Networks (3)
Based on the 1940 Soviet railway network, find the maximum amount of cargo that can be transported from sources in the Western Soviet Union to destinations in Eastern Europe:

https://wolfram.com/xid/0btng3or8t0t-iz1zda
The maximum flow value from indexed cities {1,5,6,7,9,12,13,18} to {44,40}:

https://wolfram.com/xid/0btng3or8t0t-4llese

https://wolfram.com/xid/0btng3or8t0t-g2ewlb


https://wolfram.com/xid/0btng3or8t0t-zw9ypw

A railroad network serving six major Canadian cities, with the daily number of car compartments:

https://wolfram.com/xid/0btng3or8t0t-eu67n0
Find the maximum number of compartments that can be carried from Vancouver to Winnipeg:

https://wolfram.com/xid/0btng3or8t0t-5t58mo

https://wolfram.com/xid/0btng3or8t0t-ttovxg

Number of compartments between cities:

https://wolfram.com/xid/0btng3or8t0t-f9r2n

Show the flows of compartments:

https://wolfram.com/xid/0btng3or8t0t-sed99g

In a regional power distribution network below with given capacities, find the maximum power that can be distributed to WanChai:

https://wolfram.com/xid/0btng3or8t0t-rjrd1f

https://wolfram.com/xid/0btng3or8t0t-wc984


https://wolfram.com/xid/0btng3or8t0t-oym3f0

Network Connectivity (2)
A directed network that describes the flow of information among 10 organizations concerned with social welfare issues in one Midwestern US city. Find the maximum possible information flow from COUN to COMM:

https://wolfram.com/xid/0btng3or8t0t-hfzcnr
Find the maximum flow and the flow graph:

https://wolfram.com/xid/0btng3or8t0t-gzvg05


https://wolfram.com/xid/0btng3or8t0t-eqdo4a

A town has 7 residents, 4 clubs and 3 political parties. Each resident is a member of at least one club and can belong to exactly one political party. In a balanced council each club must nominate one of its members to represent it in town council so that the number of council members belonging to the political party is at most
. Find if it is possible to create a balanced council:

https://wolfram.com/xid/0btng3or8t0t-haqilu
Since the maximum flow value equals 4, this means that the town has a balanced council:

https://wolfram.com/xid/0btng3or8t0t-im02q7

The flow graph shows that a possible balanced council could be R1, R2, R4 and R5:

https://wolfram.com/xid/0btng3or8t0t-gcubpv

Assignment Problems (2)
A company has a number of different jobs. Each employee is suited for some of these jobs, and each person can perform at most one job at a time. Find the maximum number of jobs that can be performed at the same time:

https://wolfram.com/xid/0btng3or8t0t-et0a2
The maximum flow from all employees to all tasks gives the number of simultaneous jobs:

https://wolfram.com/xid/0btng3or8t0t-c1ep2b

https://wolfram.com/xid/0btng3or8t0t-eoyvc1

Show possible job assignments:

https://wolfram.com/xid/0btng3or8t0t-ldiiyb

Given a set of women, each of whom has a preference for some subset of men, find a maximal matching where only matches that agree with preferences are allowed:

https://wolfram.com/xid/0btng3or8t0t-xzd5c
Since you want each person to match once, restrict the vertex capacity to 1:

https://wolfram.com/xid/0btng3or8t0t-bqu6tg

https://wolfram.com/xid/0btng3or8t0t-cdzuur


https://wolfram.com/xid/0btng3or8t0t-jgy22i

Properties & Relations (5)Properties of the function, and connections to other functions
The sum of in-flows is equal to the sum of out-flows for interior vertices:

https://wolfram.com/xid/0btng3or8t0t-zsko3

https://wolfram.com/xid/0btng3or8t0t-dzpjd8

The in-flow for interior vertices:

https://wolfram.com/xid/0btng3or8t0t-gf9dyz

The out-flow for interior vertices:

https://wolfram.com/xid/0btng3or8t0t-8sm8

A graph with self-loops is treated as a simple graph:

https://wolfram.com/xid/0btng3or8t0t-p1tcz

https://wolfram.com/xid/0btng3or8t0t-kgrm3h


https://wolfram.com/xid/0btng3or8t0t-d2wnps

The edge connectivity between two vertices is equal to the value of the maximum flow:

https://wolfram.com/xid/0btng3or8t0t-idc219

https://wolfram.com/xid/0btng3or8t0t-gayeut


https://wolfram.com/xid/0btng3or8t0t-e35a0z

The vertex connectivity between two vertices can be found using FindMaximumFlow:

https://wolfram.com/xid/0btng3or8t0t-jz08kh

https://wolfram.com/xid/0btng3or8t0t-ls73b1


https://wolfram.com/xid/0btng3or8t0t-cuyhss

Wolfram Research (2012), FindMaximumFlow, Wolfram Language function, https://reference.wolfram.com/language/ref/FindMaximumFlow.html (updated 2015).
Text
Wolfram Research (2012), FindMaximumFlow, Wolfram Language function, https://reference.wolfram.com/language/ref/FindMaximumFlow.html (updated 2015).
Wolfram Research (2012), FindMaximumFlow, Wolfram Language function, https://reference.wolfram.com/language/ref/FindMaximumFlow.html (updated 2015).
CMS
Wolfram Language. 2012. "FindMaximumFlow." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FindMaximumFlow.html.
Wolfram Language. 2012. "FindMaximumFlow." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FindMaximumFlow.html.
APA
Wolfram Language. (2012). FindMaximumFlow. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindMaximumFlow.html
Wolfram Language. (2012). FindMaximumFlow. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindMaximumFlow.html
BibTeX
@misc{reference.wolfram_2025_findmaximumflow, author="Wolfram Research", title="{FindMaximumFlow}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FindMaximumFlow.html}", note=[Accessed: 01-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_findmaximumflow, organization={Wolfram Research}, title={FindMaximumFlow}, year={2015}, url={https://reference.wolfram.com/language/ref/FindMaximumFlow.html}, note=[Accessed: 01-April-2025
]}