In the minimum-cost flow problem, we want to find a flow that satisfies all supply and demand and has the minimum possible cost. Formally, a flow in the network is a function assigning flows to edges, (non-negative amount of flow on edge to ), which satisfies the capacity constraints and flow conservation constraints.

The input is a flow network where:

  • is a set of nodes
  • is a set of directed edges
  • For each edge , is the capacity of edge We label each edge (x, y)
  • For each node , (as in flow-feasibility problem) is the (initial) supply (if ) or demand (if ) at . 1st number on each edge, x
  • For each edge , is the cost of one unit of flow on edge . 2nd number on each edge, y