The network flow problem considers a graph G with a set of sources S and sinks T and for which each edge has an assigned capacity (weight), and then asks to find the maximum flow that can be routed from S to T while respecting the given edge capacities. The network flow problem can be solved in time O(n^3). It is implemented in the Wolfram Language as FindMaximumFlow[g, source, sink].