Introduction to Network Flows

This page introduces the basic concepts of network flows.

Overview

A network is a special directed graph G=(V,E)G=(V,E), distinguished from an ordinary directed graph by its capacities and source and sink.

  • Every edge in EE, namely (u,v)(u, v), has a weight called its capacity, denoted by c(u,v)c(u, v). When (u,v)∉E(u,v)\notin E, we may assume c(u,v)=0c(u,v)=0.

  • There are two special vertices in VV: the source (source) ss and the sink (sink) tt (s≠ts \neq t).

For a network G=(V,E)G=(V, E), a flow is a function from the edge set EE to the integers or reals that satisfies the following properties.

  1. Capacity constraint: for every edge, the flow through that edge cannot exceed its capacity, that is, 0≤f(u,v)≤c(u,v)0 \leq f(u,v) \leq c(u,v);
  2. Flow conservation: except at the source and sink, the net flow at every vertex uu is 00. Here, the net flow at uu is defined as f(u)=∑x∈Vf(u,x)−∑x∈Vf(x,u)f(u) = \sum_{x \in V} f(u, x) - \sum_{x \in V} f(x, u).

For a network G=(V,E)G = (V, E) and a flow ff on it, define ff's flow value ∣f∣|f| as ss's net flow f(s)f(s). As a consequence of flow conservation, this is also the opposite of tt's net flow, namely −f(t)-f(t).

For a network G=(V,E)G = (V, E), if {S,T}\{S, T\} is a partition of VV (that is, S∪T=VS \cup T = V and S∩T=∅S \cap T = \varnothing), and s∈S,t∈Ts \in S, t \in T, then {S,T}\{S, T\} is called a cut of GG separating ss and tt. The capacity of the ss–tt cut {S,T}\{S, T\} is defined as ∣∣S,T∣∣=∑u∈S∑v∈Tc(u,v)||S, T|| = \sum_{u \in S} \sum_{v \in T} c(u, v).

Common Problems

Common network-flow problems include, but are not limited to, the following types.

  • Maximum-flow problem: for a network G=(V,E)G = (V, E), assign a flow to each edge to obtain a suitable flow ff and make ff's flow value as large as possible. Such a flow ff is called a maximum flow of GG.
  • Minimum-cut problem: for a network G=(V,E)G = (V, E), find a suitable ss–tt cut {S,T}\{S, T\} and make the total capacity of {S,T}\{S, T\} as small as possible. This total capacity {S,T}\{S, T\} is called the minimum cut of GG.
  • Minimum-cost maximum-flow problem: for a network G=(V,E)G = (V, E), assign a weight w(u,v)w(u, v) to each edge, called its cost, meaning the cost paid for sending one unit of flow through (u,v)(u, v). Among all possible maximum flows of GG, the one with minimum total cost is called a minimum-cost maximum flow.

We will introduce these problems in detail in later chapters.

Example: 24 Network-Flow Problems

The 24 network-flow problems are a widely circulated problem set on the Chinese internet (LibreOJ/Luogu); they existed at least around 2010. The set introduced classic techniques for modeling other problems as network-flow problems. Due to the limitations of its era, these problems may not be the most representative network-flow problems, but they are still worth reading for readers interested in algorithm competitions.

This content comes from OI Wiki: Introduction to Network Flows. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.