CP Python LibraryGitHub

Max Flow

Solves maximum flow problem.

__init__

Arguments

add_edge

Appends an edge with capacity to the graph.

Arguments

solve

Finds the maximum flow from the source to the sink.

Arguments

Returns

Complexities

{O(min(n2/3m,m3/2))if graph is unit capacity (i.e., all capacities are the same)O(n2m)otherwise\begin{cases} O(\min(n^{2/3}m, m^{3/2})) & \text{if graph is unit capacity (i.e., all capacities are the same)} \\ O(n^2m) & \text{otherwise} \end{cases}

where mm represents the number of edges added.

Code Test