Part 3 · Chapter 14

Network Optimization Models

A map of cities and roads, a power grid, a pipeline, a project schedule — draw them all as a graph of nodes joined by arcs and a surprising number of optimization problems fall into a single family. This chapter studies four classics on such networks: the shortest path between two nodes, the cheapest tree that connects every node, the largest flow a network can carry, and the least-cost way to route supplies to demands. Each has an elegant, purpose-built algorithm, and all four turn out to be special cases of one grand model — the minimum-cost flow problem.

Optimization Techniques Prof. Mithun Mondal Reading time ≈ 50 min
i What you'll learn
  • The language of networks — nodes, arcs, paths, cycles, trees, and flows.
  • The shortest-path problem and Dijkstra's algorithm for nonnegative arc lengths.
  • The minimum spanning tree and why the greedy (Prim/Kruskal) rule is exactly optimal.
  • The maximum-flow problem and the Ford–Fulkerson augmenting-path method.
  • The max-flow min-cut theorem — the bottleneck that limits every network.
  • The minimum-cost flow model that unifies transportation, assignment, shortest path, and max flow.
Section 14-1

Networks and Terminology

A network (or graph) \(G = (N, A)\) is a set of nodes \(N\) joined by a set of arcs \(A\). An arc \((i, j)\) connects node \(i\) to node \(j\); it is directed if flow may travel only from \(i\) to \(j\), and undirected if it may go either way. A path is a sequence of arcs leading from one node to another; a cycle is a path that returns to its start. A network is connected if a path joins every pair of nodes, and a tree is a connected network with no cycles — a tree on \(n\) nodes has exactly \(n-1\) arcs. A spanning tree is a tree that reaches every node of the network.

2 4 1 7 3 1 5 1 2 3 4 5
A five-node network with a weight on each arc — the running example for shortest path and spanning tree

When arcs carry weights, those numbers can mean different things — a length or cost, a capacity limiting flow, or a per-unit shipping cost — and each interpretation gives a different optimization problem. The rest of this chapter works through the four most important, using the network above (and one directed network) as running examples.

Section 14-2

The Shortest-Path Problem

Given a network with a nonnegative length on each arc, the shortest-path problem asks for the path of least total length from a source node to a destination (or from the source to every other node). Dijkstra's algorithm solves it by growing a set of permanently labelled nodes whose shortest distance from the source is already known.

Keep a tentative distance \(d(i)\) for every node, initialised to \(0\) at the source and \(\infty\) elsewhere. Repeat: select the unlabelled node \(i\) with the smallest \(d(i)\) and mark it permanent; then relax each arc \((i,j)\) out of it, setting \(d(j) \leftarrow \min\{\,d(j),\ d(i) + \ell_{ij}\,\}\). Because arc lengths are nonnegative, the smallest tentative label can never later be improved — so labelling it permanently is safe.

2 1 3 1 2 3 4 5
Shortest path from node 1 to node 5: \(1 \to 2 \to 3 \to 5\) with length \(2+1+3 = 6\)

Running Dijkstra from node 1: label 1 at \(0\); relax to get \(d(2)=2,\ d(3)=4\). The smallest is node 2 — make it permanent, and relaxing \((2,3)\) improves \(d(3)\) to \(2+1=3\). Node 3 is next at \(3\); relaxing \((3,5)\) gives \(d(5)=3+3=6\). Node 5 becomes permanent at \(6\), the shortest distance, along the path \(1 \to 2 \to 3 \to 5\).

🔑
Why the greedy label is safe
\[ \ell_{ij} \ge 0 \ \Longrightarrow\ \text{the minimum tentative label is already final} \]

Any other route to that node must pass through a still-unlabelled node whose distance is at least as large, and adding nonnegative arcs can only increase it. Nonnegativity is essential — with negative arcs Dijkstra can fail, and a label-correcting method (e.g. Bellman–Ford) is used instead.

Section 14-3

The Minimum Spanning Tree Problem

The minimum spanning tree (MST) problem asks for the set of arcs of least total length that keeps every node connected. The answer is a spanning tree — \(n-1\) arcs, no cycles — and unlike the shortest-path problem it is about connecting all nodes cheaply, not travelling between two of them (think of laying cable or pipe to reach every building at minimum total length).

A simple greedy rule solves it exactly. In Kruskal's version, sort the arcs by length and add them cheapest-first, skipping any arc that would close a cycle, until \(n-1\) arcs are in. In Prim's version, grow one tree from an arbitrary node, each step adding the cheapest arc that joins a tree node to a node not yet in the tree.

2 1 3 1 1 2 3 4 5
The minimum spanning tree uses arcs \(2\text–3,\ 4\text–5,\ 1\text–2,\ 3\text–5\) for a total length of \(1+1+2+3 = 7\)

On our network, sorting the arcs gives \(2\text–3(1),\ 4\text–5(1),\ 1\text–2(2),\ 3\text–5(3),\ 1\text–3(4),\ 3\text–4(5),\ 2\text–4(7)\). Adding them in order, the arc \(1\text–3\) is rejected because it would close the cycle \(1\text–2\text–3\); after four accepted arcs every node is connected, giving total length \(7\).

Greedy is not always right — but here it is. Most problems punish a greedy, take-the-cheapest-now strategy, yet for the MST it is provably optimal. The reason is the cut property: for any way of splitting the nodes into two groups, the cheapest arc crossing the split must belong to some minimum spanning tree. Kruskal and Prim simply apply this property repeatedly, which is why recognising special structure — the recurring theme of Part 3 — pays off again.

Section 14-4

The Maximum-Flow Problem

Now put a capacity \(u_{ij}\) on each directed arc — the most flow it can carry. The maximum-flow problem asks how much can be sent from a source \(s\) to a sink \(t\) at once, with flow on every arc kept within its capacity and conserved at every intermediate node (what flows in flows out).

4 2 3 1 4 s a b t
A directed capacity network — the numbers are the maximum flow each arc can carry

The Ford–Fulkerson method builds the answer one augmenting path at a time. Find any path from \(s\) to \(t\) whose arcs all have spare capacity (the residual), push flow equal to the smallest spare capacity along it (the bottleneck), and reduce each arc's residual accordingly — while adding residual capacity in the reverse direction, so flow can be rerouted later. Repeat until no augmenting path remains.

On the network above: send \(1\) along \(s\to a\to t\) (bottleneck \(1\)), then \(3\) along \(s\to a\to b\to t\) (bottleneck \(3\)), then \(1\) along \(s\to b\to t\) (bottleneck \(1\)). Now both arcs into \(t\) are full, so no augmenting path is left and the maximum flow is \(1+3+1 = 5\).

Section 14-5

The Max-Flow Min-Cut Theorem

An \(s\)–\(t\) cut splits the nodes into two sets, one containing \(s\) and the other \(t\). Its capacity is the total capacity of the arcs pointing from the \(s\)-side to the \(t\)-side. Since every unit of flow must cross any such cut, no flow can exceed the smallest cut's capacity. The remarkable fact is that this bound is always achieved.

cut = 1 + 4 = 5 1 4 s a b t
The minimum cut isolates \(t\); its capacity \(1+4 = 5\) equals the maximum flow
🔑
Max-flow min-cut theorem
\[ \text{maximum } s\text{–}t\text{ flow} \;=\; \text{minimum } s\text{–}t\text{ cut capacity} \]

When Ford–Fulkerson stops, the nodes still reachable from \(s\) in the residual network form the \(s\)-side of a cut whose every forward arc is saturated — so its capacity equals the flow found, proving both values optimal at once. Here the cut isolating \(t\) has capacity \(1+4 = 5\), matching the maximum flow. The cut is the network's true bottleneck: relieve it and nothing else, and the throughput rises.

Section 14-6

The Minimum-Cost Flow Problem

The minimum-cost flow problem is the most general model of the four. Each node \(i\) has a net supply \(b_i\) (positive at a source, negative at a demand, zero at a transshipment node), each arc has a per-unit cost \(c_{ij}\) and a capacity \(u_{ij}\). The task is to route the supplies to the demands at least total cost while respecting capacities and conserving flow at every node.

Minimum-cost flow model
\[ \min \sum_{(i,j)\in A} c_{ij}\,x_{ij} \quad \text{s.t.} \quad \sum_{j} x_{ij} - \sum_{j} x_{ji} = b_i\ (\forall i), \qquad 0 \le x_{ij} \le u_{ij} \]

The equality constraints are the flow-conservation (node) equations: at each node, outflow minus inflow equals its net supply. For the model to be feasible, total supply must equal total demand, \(\sum_i b_i = 0\).

🔑
Integer flows come for free
\[ \text{integer } b_i,\ u_{ij} \ \Longrightarrow\ \text{some optimal flow is integer} \]

The node–arc incidence matrix is totally unimodular, exactly as in the transportation and assignment problems of the previous chapters. So the linear-programming relaxation automatically yields whole-number flows — no branch-and-bound required — and a specialised, very fast simplex variant, the network simplex method, exploits the tree structure of basic solutions to solve it far quicker than ordinary simplex.

Section 14-7

A Unifying Framework

The power of the minimum-cost flow model is that the other network problems — and the transportation and assignment problems of Chapters 12 and 13 — are all special cases obtained by choosing the supplies, costs, and capacities appropriately:

Special caseHow to obtain it from min-cost flow
Transportation problemSources with supply \(b_i>0\), destinations with demand \(b_j<0\), arc costs \(c_{ij}\), no intermediate nodes
Assignment problemA transportation problem with every supply and demand equal to \(1\)
Shortest-path problemSend one unit from source \((b_s=1)\) to sink \((b_t=-1)\); arc costs are the lengths
Maximum-flow problemZero arc costs, a return arc \(t\to s\) of cost \(-1\); maximising its flow maximises throughput
One model, four algorithms. Although min-cost flow contains them all, each special case keeps its own tailored algorithm — Dijkstra, the greedy MST rule, Ford–Fulkerson — precisely because that structure permits something faster than solving the full model. Use the general network-simplex machinery when supplies, costs, and capacities genuinely mix; reach for a specialised algorithm the moment the problem collapses to one of the recognisable special forms.

Section 14-8

Worked Examples

1 Reading a network

Problem. A tree connects \(n = 6\) nodes. How many arcs does it have, and what happens if you add one more arc?

Solution. A tree on \(n\) nodes has exactly \(n-1 = 5\) arcs and no cycles. Adding any further arc joins two already-connected nodes, creating exactly one cycle — so the result is no longer a tree.

2 Dijkstra's algorithm

Problem. Using the five-node network, find the shortest distance from node 1 to node 5.

Solution. Permanent labels appear in the order \(d(1)=0,\ d(2)=2,\ d(3)=3,\ d(5)=6\). Relaxing \((2,3)\) improves node 3 from \(4\) to \(3\); relaxing \((3,5)\) then gives \(6\). The shortest path is \(1\to 2\to 3\to 5\) of length \(2+1+3 = 6\).

3 Minimum spanning tree

Problem. Find the minimum spanning tree of the same network by Kruskal's method.

Solution. Sort arcs: \(2\text–3(1),\,4\text–5(1),\,1\text–2(2),\,3\text–5(3),\,1\text–3(4),\dots\) Add \(2\text–3,\ 4\text–5,\ 1\text–2\), then \(3\text–5\) which links the two pieces; \(1\text–3\) is skipped (it would form a cycle). Four arcs connect all five nodes for a total length of \(1+1+2+3 = 7\).

4 An augmenting path

Problem. In the directed capacity network, after sending \(1\) unit on \(s\to a\to t\), find the next augmenting path and its bottleneck.

Solution. The path \(s\to a\to b\to t\) still has residuals \(3,\ 3,\ 4\), so its bottleneck is \(3\); push \(3\) units. A final unit on \(s\to b\to t\) saturates both arcs into \(t\), leaving no augmenting path and a maximum flow of \(5\).

5 Locating the min cut

Problem. Verify the maximum flow of \(5\) using the max-flow min-cut theorem.

Solution. Take the cut with only \(t\) on one side. Its forward arcs are \(a\to t\) (capacity \(1\)) and \(b\to t\) (capacity \(4\)), so its capacity is \(5\). No cut is smaller, and a flow of \(5\) exists, so both are optimal — the two arcs into \(t\) are the bottleneck.

6 Recognising a special case

Problem. Show that a shortest-path problem is a minimum-cost flow problem.

Solution. Set the source supply \(b_s = 1\) and sink demand \(b_t = -1\), all other \(b_i = 0\), give each arc cost equal to its length and unlimited capacity. Sending the single unit from \(s\) to \(t\) at least cost forces it along the shortest path, and total unimodularity keeps the optimal flow \(0\)–\(1\) on each arc.

Review

Chapter Summary

Networks

Nodes joined by arcs; a tree has \(n-1\) arcs and no cycle; a spanning tree reaches every node.

Shortest path

Dijkstra labels the nearest node permanently and relaxes its arcs — needs \(\ell_{ij} \ge 0\).

Spanning tree

The greedy rule (Kruskal/Prim) adds cheapest cycle-free arcs; the cut property makes it optimal.

Maximum flow

Ford–Fulkerson pushes flow along augmenting paths until none remains.

Min cut

Max flow \(=\) min cut; the saturated cut is the network's bottleneck.

Min-cost flow

Supplies, costs, capacities; totally unimodular, so integer — solved by the network simplex.

Practice

Problems

Solve each on the appropriate network, showing the labels, arcs, or paths at each step. Difficulty rises down the list.

  1. Define node, arc, path, cycle, and spanning tree, and state how many arcs a spanning tree of \(n\) nodes has.
  2. Explain why Dijkstra's algorithm may give a wrong answer when some arc lengths are negative.
  3. Run Dijkstra from node 1 on the chapter network and give the shortest distance to every node, not just node 5.
  4. State the difference between the shortest-path problem and the minimum spanning tree problem in one sentence each.
  5. Apply Prim's algorithm to the chapter network starting from node 4 and confirm the same tree of length \(7\).
  6. State the cut property and use it to argue that the cheapest arc in a connected network is always in some MST.
  7. Define an augmenting path and the residual capacity of an arc, and explain why reverse residual arcs are needed.
  8. For the directed capacity network, list one \(s\)–\(t\) cut of capacity greater than \(5\) and explain why it is not the minimum.
  9. State the max-flow min-cut theorem and explain how the stopping condition of Ford–Fulkerson proves it.
  10. Write the minimum-cost flow formulation and show how setting all supplies and demands to \(1\) recovers the assignment problem.
  11. Explain why the node–arc incidence matrix being totally unimodular guarantees integer optimal flows.
  12. A courier network has source \(s\), sink \(t\), and arcs \(s\!\to\!a\,(5),\ s\!\to\!b\,(3),\ a\!\to\!b\,(2),\ a\!\to\!t\,(2),\ b\!\to\!t\,(5)\) with the numbers in parentheses as capacities. Find the maximum flow, the minimum cut, and verify they are equal.
Tip: the four problems in this chapter look different but share one habit of mind — always keep track of what each arc number means. A number can be a length (shortest path, MST), a capacity (max flow), or a per-unit cost with a separate capacity (min-cost flow), and using the wrong interpretation is the most common mistake. When a problem mixes supplies, per-unit costs, and capacities at once, stop looking for a shortcut and model it directly as minimum-cost flow; when it collapses to a single kind of number on the arcs, reach for the specialised algorithm — Dijkstra, greedy MST, or Ford–Fulkerson — that was built for exactly that structure.