You would be right; using scipy.sparse.csgraph.maximum_flow
:
>>> from scipy.sparse import csr_matrix
>>> from scipy.sparse.csgraph import maximum_flow
>>> m = csr_matrix([[0, 2, 4, 0], [0, 0, 6, 4], [0, 0, 0, 2], [0, 0, 0, 0]])
>>> maximum_flow(m, 0, 3)
MaximumFlowResult with value of 4
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.