Are you talking about maximum flow in your graph from start
to finish
? If so, there are bunch of methods for working with flows in NetworkX
.
For example, maximum_flow(G, s, t, capacity='capacity', flow_func=None, **kwargs)
. It accepts your graph and start and finish nodes in it.
It returns:
flow_value
(integer, float) – Value of the maximum flow, i.e., net outflow from the source.
flow_dict
(dict) – A dictionary containing the value of the flow that went through each edge.
So your code will be like:
flow_value, flow_dict = nx.maximum_flow(G, 'x', 'y')
Now in dictionary you can find all the edges in the flow and their usage.