University Center of Si El’Houès Barika
Department of Mathematics and Computer Science
Graph theory
nd
2 year computer science student
Chapter 3: Network Flows
Pre-requirements:
• Mathematics basics
• Graph theory basics
Objectives:
• Know the basics of network flows, its properties, and some of its applications.
• Know the cut-set propertie
• Understand max-flow min-cut theorem.
• Find a maximum flow.
Outlines:
Introduction: ............................................................................................................................. 1
I. Cuts: .................................................................................................................................. 2
II. Network flows:................................................................................................................... 3
Introduction:
Our society today is largely governed by networks such as transportation and
communication. Thus, the mathematical analysis of such networks has become of fundamental
importance.
In a network of telephone lines, highways, railroads, pipelines of oil (or gas or water), and so
on, it is important to know the maximum rate of flow that is possible from one station to another
in the network.
This type of network is represented by a weighted connected graph in which the vertices are
the stations and the edges are lines through which the given commodity (oil, gas, water, number of
messages, number of cars, etc.) flows. While, the weight is a real positive number associated with
each edge represents the capacity of the line, that is, the maximum amount of flow possible per
unit of time.
Dr.Belferdi Wassila 2024/2025
1
I. Cuts:
Cut-sets are of great importance in studying
properties of communication and transportation
networks.
Suppose, for example, that the six vertices in Figure
1.(a) represent six cities connected by telephone lines
(edges). Wishing to find out if there are any weak spots
in the network that need strengthening by means of
additional telephone lines. We look at all cut-sets of the
graph, and the one with the smallest number of edges is
the most vulnerable.
Figure 1 : cut-set
In Figure 1.(a), the city represented by vertex 𝒗𝟑 can
be separated from the rest of the network by the destruction of just one edge.
a) A cut:
✓ A cut is a set 𝑨 of arcs such that each path from 𝒗 to 𝒘 includes an arc in 𝑨.
✓ In a connected graph 𝑮, a cut-set is a set of edges whose removal from 𝑮 leaves 𝑮
disconnected, provided removal of no proper subset of these edges disconnects 𝑮.
✓ A cut-set always “cuts” a graph into two. Therefore, a cut-set can also be defined as a
minimal set of edges in a connected graph whose removal reduces the rank of the graph by
one.
✓ Another way of looking at a cut-set is this: if we partition all the vertices of a connected
graph 𝑮 into two mutually exclusive subsets, a cut-set is a minimal number of edges whose
removal from 𝑮 destroys all paths between these two sets of vertices.
✓ Cutsets are used to identify weak spots in a communication net. For this purpose we list all
cutsets of the corresponding graph, and find which ones have the smallest number of edges.
✓ A cut-set1 with respect to a pair of vertices 𝒂 and 𝒃 in a connected graph 𝑮 puts 𝒂 and 𝒃
into two different components (i.e., separates vertices 𝒂 and 𝒃).
Example:
In Fig.1
✓ The set of edges {𝒂, 𝒄, 𝒅, 𝒇} is a cut-set.
✓ There are many other cut sets, such as {𝒂, 𝒃, 𝒈} , {𝒂, 𝒃, 𝒆, 𝒇} , and {𝒅, 𝒉, 𝒇}.
✓ The edge {𝒌} alone is also a cut-set.
✓ The set of edges {𝒂, 𝒄, 𝒉, 𝒅} , on the other hand, is NOT a cut-set, because one of its
proper subsets, {𝒂, 𝒄, 𝒉}, is a cut-set.
b) Cut set properties:
✓ Since removal of any edge from a tree breaks the tree into two parts, every edge of a tree
is a cut-set.
✓ Every cut-set in a connected graph 𝐺 must contain at least one branch of every spanning
tree of 𝑮.
1 Sometimes a cut-set is also called a cocycle.
2
Dr.Belferdi Wassila 2024/2025
✓ In a connected graph 𝑮, any minimal set of edges containing at least one branch of every
spanning tree of 𝑮 is a cut-set.
✓ Every circuit has an even number of edges in common with any cut-set.
✓ The capacity of cut-set 𝑺 in a weighted connected graph 𝑮 (in which the weight of each
edge represents its flow capacity) is defined as the sum of the weights of all the edges
in 𝑺.
✓ We are concerned mainly with those cuts whose capacity is as small as possible, the so-
called minimum cuts.
Example :
The following graph, a minimum cut
consists of the arcs vz, xz, yz and xw, but not the
arc zx;
The capacity of this cut is 1+2 + 2 + 2 = 7.
c) Fundamental Cut-sets:
✓ Consider a spanning tree 𝑻 of a connected graph 𝑮. Take any branch 𝒃 in 𝑻. Since {𝒃} is a
cut-set in 𝑻, {𝒃} partitions all vertices of 𝑻 into two disjoint sets—one at each end of 𝒃.
✓ Consider the same partition of vertices in 𝑮, and the cut set 𝑺 in 𝑮 that corresponds to this
partition. Cutset 𝑺 will contain only one branch 𝒃 of 𝑻, and the rest (if any) of the edges in
𝑺 are chords with respect to 𝑻.
✓ Such a cut-set 𝑺 containing exactly one branch of a tree 𝑇 is called a fundamental cut-set2
with respect to 𝑻.
Example:
In the following graph,
Cut-set {𝒅, 𝒆, 𝒇} is a cut-set with respect
to 𝒗𝟏 and 𝒗𝟔 .
The set {𝒇, 𝒈, 𝒉} is also a cut-set with
respect to 𝒗𝟏 and 𝒗𝟔
II. Network flows:
Definitions:
a) A network:
✓ A network 𝑵 to be a weighted digraph that is, a digraph to each arc (directed edge) of which
is assigned a non-negative real number 𝒄(𝒂) called its capacity.
✓ We assume that the digraph has exactly one source 𝒗 and one sink 𝒘.
2 Sometimes a fundamental cut-set is also called a basic cut-set
3
Dr.Belferdi Wassila 2024/2025
Example:
This graph for example, represents
a network consisting of 11 stations
and 19 lines.
The capacity of each of these lines
is also indicated in the figure.
Notes:
▪ The sum of the out-degrees of the vertices of a network is equal to the sum of the in-degrees.
▪ The general case of several sources and sinks, corresponding to more than one manufacturer
and market, is easily reduced to this special case.
b) A flow (Transport):
✓ A flow in a network is a function 𝑓 that assigns to each arc (directed edge) 𝑎 a non-negative
real number 𝑓(𝑎), called the flow in 𝒂, in such a way that:
1) For each arc 𝑓(𝑎) ≤ 𝑐(𝑎);
2) The out-degree and in-degree of each vertex, other than 𝒗 or 𝒘, are equal.
Example:
In the following network:
outdeg(v)= (3+2+1)=6
indeg(w) =(2+4)= 6
∑ 𝐨𝐮𝐭𝐝𝐞𝐠(𝐱) = (𝟐 + 𝟏) = ∑ 𝐢𝐧𝐝𝐞𝐠(𝐱) = (𝟑 + 𝟎 + 𝟎) = 𝟑.
In such a flow problem the questions to be answered are:
1. What is the maximum flow possible through the network between the source and the sink?
2. How do we achieve this flow (i.e., determine the actual flow through each edge when the
maximum flow exists)?
Thus,
✓ The flow in any arc cannot exceed its capacity.
✓ The 'total flow' into each vertex, other than 𝒗 or 𝒘, is equal to the 'total flow' out of it.
✓ Another flow is the zero flow in which the flow in every arc is 0; any other flow is a non-
zero flow.
Dr.Belferdi Wassila 2024/2025
4
✓ An arc 𝒂 for which 𝒄 (𝒂) = 𝒇(𝒂) is called saturated.
Example:
In the following graph: 2/
the arcs vz, xz, yz, xw and zw are saturated,
1/
and the remaining arcs are unsaturated.
1/ 2/ 4/
✓ The sum of the flows in the arcs out of the source 𝒗 is equal to the sum of the flows in the
arcs into the sink 𝒘; this sum is called the value of the flow.
✓ We are mainly interested in flows whose value is as large as possible - the maximum flows.
Example:
In the following network, the flow is a
maximum flow, and that its value is 6.
It is assumed that:
✓ At each intermediate vertex the total rate of commodity entering is equal to the rate leaving.
✓ In other words, there is no accumulation or generation of the commodity at any vertex along
the way.
✓ Furthermore, the flow through a vertex is limited only by the capacities of the edges incident
on it.
✓ In other words, the vertex itself can handle as much flow as allowed through the edges.
✓ Finally, the lines are lossless.
Notes:
▪ A network can have several different maximum flows, their values must be equal.
▪ The study of maximum flows in a network is closely tied up with the concept of a cut.
▪ The value of any flow cannot exceed the capacity of any cut.
▪ So, the value of any maximum flow cannot exceed the capacity of any minimum cut.
▪ This famous result, known as the max-flow min-cut theorem, was first proved by Ford
and Fulkerson in 1955.
In such a flow problem the questions to be answered are:
Dr.Belferdi Wassila 2024/2025
5
1) What is the maximum flow possible through the network between a specified pair
of vertices?
2) How achieve this flow (i.e., determine the actual flow through each edge when the
maximum flow exists)?
The max-flow min-cut theorem
In a given flow (transport) network 𝑮, the maximum value of a flow from 𝒔 to 𝒕 is equal to
the minimum value of the capacities of all the cuts in 𝑮 that separate 𝒔 from 𝒕.
This theorem provides a useful check on the maximality or otherwise of a given flow, as long
as the network is fairly simple.
In practice, the networks we have to deal with are large and complicated, and it is usually
difficult to find a maximum flow by inspection. Most methods for finding a maximum flow involve
determining flow-augmenting paths from 𝒗 to 𝒘. These are paths consisting entirely of
unsaturated arcs xz and arcs zx that carry a non-zero flow.
Example:
Consider the following network.
1) Starting with the zero flow,
2) Construct the flow-augmenting paths:
• 𝒗 → 𝒔 → 𝒕 → 𝒘 along which the value
of the flow can be increased by 2
• 𝒗 → 𝒙 → 𝒛 → 𝒘 along which the value
of the flow can be increased by 2
• 𝒗 → 𝒖 → 𝒛 → 𝒙 → 𝒚 → 𝒘 along which
the value of the flow can be increased by 1.
3) The resulting flow of value 5 is as follows.
4) Since the network has a cut of capacity 5, the
above flow is a maximum flow and the cut is
a minimum cut.
Example:
Dr.Belferdi Wassila 2024/2025
6
The following graph has eight (23 ) cuts that separate 𝒔 from 𝒕. These cuts (identified by vertex set
𝑷) and their capacities are:
The cut with minimum capacity among these is the one in which 𝑷 = {𝒔, 𝒅} and is {𝒃, 𝒄, 𝒕}.
The maximum flow possible in 𝒔 to 𝒕 in the network is therefore 7 units.
III. Extensions of max-flow min-cut theorem:
The max-flow min-cut theorem as stated is applicable to a flow (transport) network (simple,
weighted, connected digraph) with one source and one sink. There are, however, many other types
of network-flow problems that can be solved by extending the max-flow min-cut theorem
appropriately. Some of these extensions are straightforward and others are quite involved. Let us
consider them in increasing order of difficulty.
c) Multiple Sources and Sinks:
If there are several sources 𝑠1 , 𝑠2 , . . . , 𝑠𝑘 and several sinks 𝑡1 , 𝑡2 , . . . 𝑡𝑟 and if the flow from
any source can be sent to any sink, then this problem can be converted immediately into a one -
source and one-sink problem as follows:
✓ Introduce a supersource 𝒔 with edges (of unlimited capacity) directed to 𝒔𝒍 , 𝒔𝟐 , 𝒐. . , 𝒔𝒌
and a supersink 𝒕 with edges (also of unlimited capacity) directed from 𝒕𝟏 , 𝒕𝟐 . . . , 𝒕𝒓. The
problem of maximizing the total value of the flow from all sources is then the same as that
of maximizing the value of the flow from 𝑠 to 𝑡.
IV. Additional applications:
We have been discussing how various types of shipping problems can be solved by means of
network-flow techniques. In addition to these, there are a surprisingly large number of
combinatorial problems in operations research that can be formulated (and then solved) as
network-flow problems. Take for instance the matching or assignment problem discussed in
Section 8-4. We have p men Ml , M2 , . . . , Mp and q jobs J1 , J2 , . . . , Jq and it is known which
men are qualified for which jobs. When is it possible to fill all jobs with qualified men or when is
it possible to assign each man a job he is qualified for? The problem can be formulated as a
network-flow problem, as shown in Fig. 14-7. Construct a p-source q-sink flow network, such that
an edge (Mi , Jk ) exists if and only if man Mi is qualified for job Jk . Join all sources to a supersource
s and all sinks to a supersink t. Assign capacities of one unit to each (s, Mi ) and to each (Ji, t). The
capacities of the remaining edges are made infinite. Then the optimal assignment problem becomes
that of constructing a flow pattern with maximum value from s to t.
Dr.Belferdi Wassila 2024/2025
7