flowG (NetworkX graph) – Edges of the graph are expected to have an attribute called
‘capacity’. If this attribute is not present, the edge is
considered to have infinite capacity.

_s (node) – Source node for the flow.

_t (node) – Sink node for the flow.

capacity (string) – Edges of the graph G are expected to have an attribute capacity
that indicates how much flow the edge can support. If this
attribute is not present, the edge is considered to have
infinite capacity. Default value: ‘capacity’.

flow_func (function) – A function for computing the maximum flow among a pair of nodes
in a capacitated graph. The function has to accept at least three
parameters: a Graph or Digraph, a source node, and a target node.
And return a residual network that follows NetworkX conventions
(see Notes). If flow_func is None, the default maximum
flow function (preflow_push()) is used. See below for
alternative algorithms. The choice of the default function may change
from version to version and should not be relied on. Default value:
None.

kwargs (Any other keyword parameter is passed to the function that) – computes the maximum flow.

Returns:

flow_value – Value of the maximum flow, i.e., net outflow from the source.

The function used in the flow_func parameter has to return a residual
network that follows NetworkX conventions:

The residual network R from an input graph G has the
same nodes as G. R is a DiGraph that contains a pair
of edges (u,v) and (v,u) iff (u,v) is not a
self-loop, and at least one of (u,v) and (v,u) exists
in G.

For each edge (u,v) in R, R[u][v]['capacity']
is equal to the capacity of (u,v) in G if it exists
in G or zero otherwise. If the capacity is infinite,
R[u][v]['capacity'] will have a high arbitrary finite value
that does not affect the solution of the problem. This value is stored in
R.graph['inf']. For each edge (u,v) in R,
R[u][v]['flow'] represents the flow function of (u,v) and
satisfies R[u][v]['flow']==-R[v][u]['flow'].

The flow value, defined as the total flow into t, the sink, is
stored in R.graph['flow_value']. Reachability to t using
only edges (u,v) such that
R[u][v]['flow']<R[u][v]['capacity'] induces a minimum
s-t cut.

Specific algorithms may store extra data in R.

The function should supports an optional boolean parameter value_only. When
True, it can optionally terminate the algorithm as soon as the maximum flow
value and the minimum cut can be determined.