Skip to main content
Mathematics LibreTexts

5.9.3: Transportation Networks and Flows

  • Page ID
    18878
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    investigate!

    At the end of the school day, all the students plan on driving from school (vertex A) to the concert (at vertex Z). The directed edges in the graph below represent one-way roads, and the weight of each edge represents the number of vehicles (in hundreds) that particular road can handle in one hour. What is the greatest number of vehicles that can get from school to the concert in one hour? How many vehicles should take each road?

    clipboard_ef0856435c632cb3e5ea063df7bd7533e.png

    Definition

    A transportation network is a connected, weighted, directed graph with the following properties.

    1. There is one source, a vertex with no incoming edges. [In other language, the vertex has indegree 0.]
    2. There is one sink, a vertex with no outgoing edges. [In other language, the vertex has outdegree 0.]
    3. Each edge \((u,v)\) is assigned a nonnegative weight \(C_{uv}\) called the capacity of that edge. [Notice I wrote the edge as an ordered pair rather than a set. This is because each edge has an initial vertex and a terminal vertex, so the order matters.]

    Transportation networks can also be used to model oil flowing through a series of pipelines, data flowing through a network of computers, and many other situations.

    Definition

    Let \(G\) be a transportation network with capacity \(C_{ij}\) on edge \((i,j)\). A flow \(F\) on \(G\) assigns to each edge \((i,j)\) a nonnegative number \(F_{ij}\), called the flow on edge \((i,j)\) with the following properties.

    1. \(F_{ij}\leq C_{ij}\).
    2. For every vertex \(i\) other than the source or the sink, \(\sum_j F_{ij}=\sum_j F_{ji}\).

    What do these two conditions mean in words? The first says that the flow cannot exceed the capacity on an edge. We can see why this condition is necessary - we cannot, for example, send more oil through a pipeline than it can handle. The second says that the flow IN to a vertex must be equal to the flow OUT of that same vertex (except at the source or the sink). Again this condition makes sense: if oil is flowing through a series of pipelines, we should not gain or lose oil between the source of the oil and location to which we are sending it.

    To write a flow on a transportation network, give each edge a pair of numbers with the capacity of an edge preceding the flow along that edge: \(C_{ij},F_{ij}\). Express your solution to the initial example in this section as a flow on a transportation network.

    Theorem \(\PageIndex{1}\)

    For any flow \(F\) on a transportation network, the flow out of the source must equal the flow into the sink. In symbols, \(\sum_j F_{aj}=\sum_j F_{jz}\).

    Proof

    This proof is left as an exercise.

    Because of the previous theorem, we can make the following definition.

    Definition

    The value of a flow is the total flow out of the sink (or into the source). A maximal flow is a flow with greatest possible value.

    Definition

    A cut in a transportation network \(G\) is a partition of the vertices of \(G\) into two sets \(S\) and \(T\) so that the source is in \(S\) and the sink is in \(T\).

    For example \(S=\{A,B\}\) and \(T=\{C,D,E,Z\}\) is a cut for the transportation network at the beginning of the section.

    Definition

    The capacity of the cut S,T is the sum of the capacities of all edges starting at a vertex in \(S\) and ending at a vertex in \(T\). Equivalently, it is the number \(\sum_{i\in S, j\in T} C_{ij}\). A minimal cut is a cut with the least possible capacity.

    The capacity of the previous cut is \(3+8=11\). A minimal cut for the same network is \(S=\{A,B,C\}\) and \(T=\{D,E,Z\}\). This cut has capacity 9.

    It turns out that maximal flows are related to minimal cuts.

    Theorem \(\PageIndex{2}\)

    Let \(F\) be a flow on a transportation network \(G\) and let \(S,T\) be a cut. If \(\sum_i F_{ai}=\sum_{i\in S, j\in T} C_{ij}\) (i.e. if the value of the flow is equal to the capacity of the cut), then the flow is maximal and the cut is minimal.

    Proof

    The proof is omitted.

    We present below an algorithm that can be used to find a maximal flow in a transportation network. It is given below in sentences rather than in pseudocode for ease of understanding. The basic idea is that we begin with a flow of zero along each edge. We use the algorithm to find a path from the source to the sink along which we can increase the flow. We do so, and then we try again. We keep doing so until we cannot anymore; what we are left with is a maximal flow. The proof that the algorithm produces a maximal flow and a minimum cut are omitted.

    Max Flow algorithm

    1. Label the source \((source,+,\infty)\).
    2. Look at a labeled vertex. Suppose it is called \(v\) and has label \((u, \pm, a)\). For each unlabeled vertex \(w\) do the following:

      1. If there is an edge from \(v\) to \(w\), and the current flow from \(v\) to \(w\) is below capacity, give \(w\) the label \((v,+,b)\) where \(b\) is either \(a\) or the capacity minus the flow, whichever is smaller.

      2. If there is an edge from \(w\) to \(v\) and the current flow from \(w\) to \(v\) is positive, then give \(w\) the label \((v,-,b)\) where \(b\) is either \(a\) or the current flow, whichever is smaller.

      3. Otherwise, don't give \(w\) a label.

    3. Repeat step 2 until the sink is labeled or you can't label anymore.

      1. If the sink is labeled, increase the flow by the amount in the label on the sink, following the path back to the source. Notice that if you encounter any “-” you need to decrease the flow on that arc. Then start again at step 1 with this new flow.

      2. If the sink isn’t labeled you are done. The current flow is maximal. We have also found a minimal cut: the set of labeled vertices is S and the set of unlabeled vertices is T.

    Exercise \(\PageIndex{3}\)

    Use the max flow algorithm to determine a maximal flow, the value of the maximal flow, and a minimal cut for the transportation network below.

    clipboard_ec8f5b0d97d275d40918215147f247201.png

    Use the max flow algorithm to determine a maximal flow, the value of the maximal flow, and a minimal cut for the transportation network with the given flow below.

    clipboard_ef7cd208ccadff68fe7e02ac2617c536f.png


    5.9.3: Transportation Networks and Flows is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?