Applications of Network Flow
Applications of Network Flow
Submitted To:
Introduction
The connections, known as arcs,
tie together certain pairs of nodes.
A network model is concerned
of Network with a flow of something.
Network Flow is important
because many aspects of actual
situations are readily recognized as
networks and the representation of
the model is much more compact
than the general linear program.
Introduction
• Network Flow Problem 4
Network flow:
A diagram D with two disjoint non-empty distinct subsets of node X and Y, and an integer-
valued function c defined on its set of directed edges E.
Sources node:
node in subsets X are with in degree zero of network N.
Sinks node:
node in subsets Y are with out-degree zero of network N.
Intermediate node:
Vertices which are neither sources nor sinks.(set of intermediate nodes are denoted by I.
Capacity:
Value on directed edge e.(capacity of each directed edge is non-negative)
5
Source: Sink:
Node with net outflow, Node with net inflow,
product point. consumption point
a c
s T
b d
Intermediate node:
Node with net inflow and
outflow
• The max-flow problem is to find a valid flow for a given weighted directed graph
6
Formal definition of the G, that has the maximum value over all valid flows.
max-flow problem:
3
Introduction
• Flow 7
A flow f in the network is an integer-valued function defined on its set of directed edges E, such
that
Capacity Constraint:
0≤f (e)≤c (e) for all e €E Integer f (e) is the flow along directed edge e.
Conservation Condition:
f⁺(v)=f⁻(v) for all v εI where, f⁺(v) is sum of the flows along all the directed edges
directed to vertex v is the inflow into v, and f⁻(v) is sum of the flows along all the directed
edges directed from vertex v is the outflow from v.
6/12
u v
6/6
u v
12
u v
6
u v
3/3
v1 v3 v1 v3
3/6
3/8 2/3
S source S t
t sink
3
6/6
8/8
v2 v4 v2 v4
6/6
• Network Flow properties 11
Introduction
3\4
s1 s2
3\6 3\3
S T
s3 s4
15
The remaining capacity of all edges of selected augmenting path is called,
Residual Capacity.
Residual In the given diagram, we have calculate residual capacity of all edges of
Networks augmenting path.
3\4 1
s1 s2 s1 s2
3\6 3\3 3 0
S T S T
s3 s4 s3 s4
The total flow which reached at sink from augmenting path is called, Bottle
Nick Capacity. 16
Bottle Nick In the given diagram, the flow which reached at sink from source by passing s1
Capacity and s2 is Bottle Nick Capacity.
3\4
s1 s2
3\6 3\3
s3 s4
Time Complexity is the total time required by the program to run till its
completion. The time complexity is most commonly expressed using the big O
17
Time notation.
Complexity
3\4
s1 s2
3\6 3\3
4\4 4\4
s3 s4
4\6
Edges (E) = 6
Max Flow (F) = 7
= O (E * F)
= O (6 * 7)
Time Complexity = 42
18
• Oil Transferred to Ship
• Traffic Flow.
• Train Network.
• Flow of Data.
Real Life • Airline Scheduling Network.
Applications of • Internet Connection.
Network Flow: • Electrical Network.
Oil Transferred to Ship 19
Real Life
Application
through Pipeline
Oil Flow from Oil Station (Source) to Ship (Sink) through Pipeline. There is
many routes through which we can flow oil to ship. These routes are called
Edges and the points where these pipes connected to one another are called
Nodes. Every pipe have different capacity for flow of oil. So ,now we will find
the maximum flow of oil which we can flow to ship using these routes and also
calculate Time Complexity.
Oil Transferred to Ship 20
Real Life
Application
through Pipeline
8
v1 v2
12 14
S T
6 4
10
12
v3 v4
8
0
8\8
21
4 v1 v2 6
8\12 8\14
S T 8
6 4
10
12
v3 v4
8
Augmenting Path Bottle Nick Capacity
S - v1 - v2 - T 8
0
8\8
22
4 v1 v2 6
8\12 8\14
S T 8+8
6 4
8\10 8\12
2 v3 v4 4
8\8
0 Augmenting Path Bottle Nick Capacity
S - v1 - v2 - T 8
S - v3 - v4 - T 8
0
8\8
23
0 v1 v2 6
12\12 8\14
S 0 T 8+8+4
6 4\4
8\10 12\12
2 v3 v4 0
8\8
0 Augmenting Path Bottle Nick Capacity
S - v1 - v2 - T 8
S - v3 - v4 - T 8
S - v1 - v4 - T 4
0
8\8
24
0 v1 v2 4
12\12 10\14
S 0 0 T 8+8+4+2
2\6 4\4
10\10 12\12
0 v3 v4 0
8\8
0 Augmenting Path Bottle Nick Capacity
S - v1 - v2 - T 8
S - v3 - v4 - T 8
S - v1 - v4 - T 4
S - v3 - v2 - T 2
25
Augmenting Path Bottle Nick Capacity
S - v1 - v2 - T 8
S - v3 - v4 - T 8
S - v1 - v4 - T 4
S - v3 - v2 - T 2
Maximum Flow = 8+8+4+2 = 22
Edges (E) = 08
Maximum Flow (F) = 22
= O (E * F)
= O (8 * 22)
Time Complexity = O (176)
Real life
Traffic flow 26
application
9 v5
v1
8 6
4 v6
5 6
7 v2
1
2
S v7 T
3 3
v3 9
6
5 v8
6
v4
3
v9
28
5
4/9 v5
2
v1
8 4/6
0
4/4 v6
5 6
7 v2 1
2
S v7 T 4
3 3
v3 9
6
5 v8 Augmenting Bottle nick
6 path Capacity
v4 S-v1-v5-t 4
3
v9
29
5
4/9 v5
2
v1
8 4/6
0
4/4 v6
5 6
7 v2 1
2
S v7 T 4+3
3 3
v3 9
3/6
5 v8 Augmenting Bottle nick
3
path Capacity
v4 3/6 S-v1-v5-t 4
3 S-v4-v9-t 3
3/3 v9
0
30
5
4/9 v5
2
v1
8 4/6
0
0 1
4/4 v6
5/5 5/6
2
5/7 v2
1
2
S v7 T 4+3+5
3 3
v3 9
3/6
5 v8 Augmenting Bottle nick
3
path Capacity
v4 3/6 S-v1-v5-t 4
3 S-v4-v9-t 3
S-v2-v6-t 5
3/3 v9
0
31
5
4/9 v5
2
v1
8 4/6
0
0 1
4/4 v6
5/5 5/6
2
5/7 v2 0
1
2/2
1 1 v7 T 4+3+5+2
S
2/3 2/3
v3 9
3/6
5 v8 Augmenting Bottle nick
3
path Capacity
v4 3/6 S-v1-v5-t 4
3 S-v4-v9-t 3
S-v2-v6-t 5
3/3 v9
S-v3-v7-t 2
32
5
4/9 v5
2
v1
8 4/6
0
0 1
4/4 v6
5/5 5/6
2
5/7 v2 0
1
2/2
1 1 v7 T 4+3+5+2+3
S
2/3 2/3
6
v3 3/9
6/6 2
0 3/5 v8 Augmenting Bottle nick
path Capacity
v4 3/6 S-v1-v5-t 4
3 S-v4-v9-t 3
S-v2-v6-t 5
3/3 v9
S-v3-v7-t 2
S-v4-v9-t 3
Augmenting Path Bottle Nick Capacity 33
S - v1 - v5 - T 4
S - v4 - v9 - T 3
S - v2 - v6 - T 5
S - v3 - v7 - T 2
S - v4 - v9 - T 3
Maximum Flow = 4+3+5+2+3 = 17
Edges (E) = 14
Maximum Flow (F) = 17
= O (E * F)
= O (14 * 17)
Time Complexity = O (238)
Flow of Data 34
Real life
application
4
p1 p4
2 3
6 8
5 8 7
p2 p5 T
S
3 2 3 4
5
p3 p5
0
4/4
36
p1 p4
2 4
2 3
4/6 4/8
5 8 7
S
p2 p5 T 4
3 2 3 4
5
p3 p5 Augmenting Bottle nick
path Capacity
S-p1-p4-t 4
0
4/4
37
p1 p4
2 4
2 3
4/6 4/8
5 8 7
S
p2 p5 T 4+3
0
1
3/3 2 3 3/4
2
3/5
p3 p5 Augmenting Bottle nick
path Capacity
S-p1-p4-t 4
S-p3-p5-t 3
0
4/4
38
p1 p4
2 4
2 3
4/6 4/8
0 3 2
5/5 5/8 5/7
S
p2 p5 T 4+3+5
0
1
3/3 2 3 3/4
2
3/5
p3 p5 Augmenting Bottle nick
path Capacity
S-p1-p4-t 4
S-p3-p5-t 3
S-p2-p5-t 5
0
4/4
39
p1 p4
0 0 4
3 4/8
4/6 2/2
0 3 0
5/5 5/8 5/7
S
p2 p5 T 4+3+5+2
0
1
3/3 2 3 3/4
2
3/5
p3 p5 Augmenting Bottle nick
path Capacity
S-p1-p4-t 4
S-p3-p5-t 3
S-p2-p5-t 5
S-p1-p5-t 2
40
Augmenting Path Bottle Nick Capacity
S - p1 - p4 - T 4
S - p3 - p5 - T 3
S - p2 - p5 - T 5
S - p1 - p5 - T 2
Maximum Flow = 4+3+5+2 = 14
Edges (E) = 10
Maximum Flow (F) = 14
= O (E * F)
= O (10 * 14)
Time Complexity = O (140)
Flow of Train Network 41
Real life
application
8
6 s2 s3
8
s1
6 s4
8 6
s7 8
S T
s6 6
8
s5 4
4
43
0 6\8
6\6 s2 s3 2
6\8
s1
2 6 s4 0
6\8 6\6
s7 8
S T 6
4
s6 6
8
s5 4
S T 6+4
4
s6 4\6
4\8 2
4 s5 4\4
0
Augmenting path Bottle nick
S-s1-s2-s3-s4-T Capacity
S-s5-s6-T 6
4
45
0 6\8
6\6 s2 s3 2
6\8
s1 4
0 2\6 s4 0
8\8 6 6\6
s7 2\8
S T 6+4+2
4
s6 4\6
4\8 2
4 s5 4\4
0
Augmenting path Bottle nick Capacity
S-s1-s2-s3-s4-T 6
S-s5-s6-T 4
S-s1-s7-T 2
0 6\8
2
46
6\6 s2 s3
6\8
s1 4
0 2\6 s4 0
8\8 2 6\6
s7 6\8
0
S T 6+4+2+4
4\4
s6 4\6
8\8 2
0 s5 4\4
0
Augmenting path Bottle nick
S-s1-s2-s3-s4-T Capacity
S-s5-s6-T 6
S-s1-s7-T 4
S-s5-s7-T 2
4
47
Augmenting Path Bottle Nick Capacity
S - s1 - s2 - s3 - s4 - T 6
S - s5 - s6 - T 4
S - s1 - s7 - T 2
S - s5 - s7 - T 4
Maximum Flow = 6+4+2+4 = 16
Edges (E) = 11
Maximum Flow (F) = 16
= O (E * F)
= O (11 * 16)
Time Complexity = O (176)
Airline scheduling Network 48
Real life
application
15 11
p1 p4 p7
4 5 20
3 11
9
10 7 6 19
S p2 p5 p8 T
7
11 5 3
15
p3 p6 p9
9 8
Airline Scheduling Network 50
Real life
application
15 11
p1 p4 p7
4 5 20
3 11
9
4 0 13
1
6/10 6/7 6/6 6/19
S p2 p5 p8 T 6
7
11 5 3
15
p3 p6 p9
9 8
Augmenting Bottle nick
path Capacity
S-p2-p5-p8-t 6
51
11 7
4/15 4/11
0 p1 p4 p7 16
4/4 5 4/20
3 11
9
4 0 13
1
6/10 6/7 6/6 6/19
S p2 p5 p8 T 6+4
7
11 5 3
15
p3 p6 p9
9 8
7
5 3
8/11 8/15
3 p3 7
p6 p9
8/9 8/8
1 0
Augmenting Bottle nick
path Capacity
S-p2-p5-p8-t 6
S-p1-p4-p7-t 4
S-p3-p6-p9-t 8
11
4/15
p4
4
7/11
53
0 p1 p7 13
4/4 5 7/20
3/3 11
0 9
1 0 13
1
9/10 6/7 6/6 6/19
S p2 p5 p8 T 6+4+8+3
7
5 3
8/11 8/15
3 p3 7
p6 p9
8/9 8/8
1 0
Augmenting Bottle nick
path Capacity
S-p2-p5-p8-t 6
S-p1-p4-p7-t 4
S-p3-p6-p9-t 8
S-p2-p4-p7-t 3
11
4/15
p4
4
7/11
54
0 p1 p7 13
4/4 5 7/20
3/3 11
0 9
1 0 10
1
9/10 6/7 6/6 9/19
S p2 p5 p8 T 6+4+8+3+3
7
3/5 3
11/11 8/15
2
0 p3 7
p6 p9
8/9 8/8
1 0
Augmenting Bottle nick
path Capacity
S-p2-p5-p8-t 6
S-p1-p4-p7-t 4
S-p3-p6-p9-t 8
S-p2-p4-p7-t 3
S-p3-p8-t 3
11
4/15
p4
4
7/11
55
0 p1 p7 13
4/4 5 10 7/20
3/3 1/11
0 1/9
0 8 0 10
0
10/10 7/7 6/6 9/19
S p2 p5 p8 T 6+4+8+3+3+1
7
3/5 3
11/11 8/15
2
0 p3 7
p6 p9
8/9 8/8
1 0
Augmenting Bottle nick
path Capacity
S-p2-p5-p8-t 6
S-p1-p4-p7-t 4
S-p3-p6-p9-t 8
S-p2-p4-p7-t 3
S-p3-p8-t 3
S-p2-p5-p4-t 1
Augmenting Path Bottle Nick Capacity 56
S - p2 - p5 - p8 - T 6
S - p1 - p4 - p7 - T 4
S - p3 - p6 - p9 - T 8
S - p2 - p4 - p7 - T 3
S - p3 - p8 - T 3
S - p2 - p5 - p4 - T 1
Maximum Flow = 6+4+8+3+3+1 = 25
Edges (E) = 16
Maximum Flow (F) = 25
= O (E * F)
= O (16 * 25)
Time Complexity = O (400)
Internet Connection 57
Real life
application
9 14
d1 d4 d7
11 15
8 8 6
4 8
5
7
20 12 15 18
S d2 d5 d9 T
4 2 2 11
6
9 6
d3 d6 d10
8 8
5
59
0
9/9 9/14
2 d1 d4 d7 6
9/11 9/15
8 8 6
4 8
5
7
20 12 15 18
S d2 d5 d9 T 9
4 2 2 11
6
9 6
d3 d6 d10 Augmenting Bottle nick
8 8 path Capacity
S-d1-d4-d7-t 9
5
60
0
9/9 9/14
2 d1 d4 d7 6
9/11 9/15
8 8 6
4 8
5
8 7 6
0 3
12/20 12/12 12/15 12/18
S d2 d5 d9 T 9+12
4 2 2 11
6
9 6
d3 d6 d10 Augmenting Bottle nick
8 8 path Capacity
S-d1-d4-d7-t 9
S-d2-d5-d9-t 12
5
61
0
9/9 9/14
2 d1 d4 d7 6
9/11 9/15
8 8 6
4 8
5
8 7 0 3 6
12/20 12/12 12/15 12/18
S d2 d5 d9 T 9+12+6
4 2 2 11
6
6/9 6/6
3 0 Augmenting Bottle nick
d3 d6 d10
6/8 6/8 path Capacity
2 2 S-d1-d4-d7-t 9
S-d2-d5-d9-t 12
S-d3-d6-d10-t
6
5
62
0
9/9 9/14
2 d1 d4 d7 6
9/11 9/15
8 8 6
4 8
5
8 7 0 3 4
12/20 12/12 12/15 14/18
S d2 d5 d9 T 9+12+6+2
4
4 2 2 11
2/6
8/9 6/6
1 0 Augmenting Bottle nick
d3 d6 d10
8/8 6/8 path Capacity
0 2 S-d1-d4-d7-t 9
S-d2-d5-d9-t 12
S-d3-d6-d10-t
S-d3-d6-d9-t 6
2
5
63
0
9/9 9/14
0 d1 d4 d7 6
11/11 9/15
8 8 6
4 5 8
5
8 2/7 0 3 2
12/20 12/12 12/15 16/18
S d2 d5 d9 T 9+12+6+2+2
2
4 2 2 11
4/6
8/9 6/6
1 0 Augmenting Bottle nick
d3 d6 d10
8/8 6/8 path Capacity
0 2 S-d1-d4-d7-t 9
S-d2-d5-d9-t 12
S-d3-d6-d10-t
S-d3-d6-d9-t 6
S-d1-d6-d9-t 2
2
5
64
0
9/9 9/14
0 d1 d4 d7 6
11/11 9/15
2 8 8 6
2/4 3 8
5
6 4/7 0 3 0
14/20 12/12 12/15 18/18
S d2 d5 d9 T 9+12+6+2+2+2
0
4 2 2 11
6/6
8/9 6/6
1 Augmenting Bottle nick
d3 d6 d10 0
8/8 6/8 path Capacity
S-d1-d4-d7-t 9
0 2 S-d2-d5-d9-t 12
S-d3-d6-d10-t
S-d3-d6-d9-t 6
S-d1-d6-d9-t 2
S-d2-d1-d6- 2
d9-t
2
Augmenting Path Bottle Nick Capacity 65
S - d1 - d4 - d7 - T 9
S - d2 - d5 - d9 - T 12
S - d3 - d6 - d10 - T 6
S - d3 - d6 - d9 - T 2
S - d1 - d6 - d9 - T 2
S- d2 - d1 - d6 - d9 - T 2
Maximum Flow = 9+12+6+2+2+2 = 33
Edges (E) = 15
Maximum Flow (F) = 33
= O (E * F)
= O (15 * 33)
Time Complexity = O (495)
Electrical Network 66
Real life
application
We have electrical network. We can flow current from grade(source) to house(sink). The
current will flow from grade to house through different transformers(intermediate
nodes). Now every transformer has different capacity for the flow of current. We have
problem here that the capacity of every transformer is different. So we will find that how
many maximum current we can flow from grade to house using network flow diagram
and also find time complexity.
Electrical network 67
Real life
application
9
p1 p4
11
10 9
8 8
9 7 14
S p2 p5 T 9
8 8
11
9
p3 p6
5
68
0
9/9
p1 p4 2
1
9/11
9/10 9
8 8
9 7 14
S p2 p5 T 9
8 8
11
9
p3 p6
5 Augmenting Bottle nick
path Capacity
S-p1-p4-t 9
69
0
9/9
p1 p4 2
1
9/11
9/10 9
8 8
2 0 7
7/9 7/7 7/14
S p2 p5 T 9+7
8 8
11
9
p3 p6
5 Augmenting Bottle nick
path Capacity
S-p1-p4-t 9
S-p2-p5-t 7
70
0
9/9
p1 p4 2
1
9/11
9/10 9
8 8
2 0 7
7/9 7/7 7/14
S p2 p5 T 9+7+5
8 8
5/11
5/9
6 p3 p6 4
5/5 Augmenting Bottle nick
0 path Capacity
S-p1-p4-t 9
S-p2-p5-t 7
S-p3-p6-t 5
71
0
9/9
p1 p4 2
1 7
6 9/11
9/10 2/9
6 2/8
0 0 5
9/9 7/7 9/14
S p2 p5 T 9+7+5+2
8 4
5/11
5/9
6 p3 p6 4
5/5 Augmenting Bottle nick
0 path Capacity
S-p1-p4-t 9
S-p2-p5-t 7
S-p3-p6-t 5
S-p2-p4-p5-t 2
72
0
9/9
p1 p4 2
1 2
1 9/11
9/10 7/9
6 7/8
0 0 0
9/9 7/7 14/14
S p2 p5 T 9+7+5+2+5
3
5/8 4
10/11
5/9
1 p3 p6 4
5/5 Augmenting Bottle nick
0 path Capacity
S-p1-p4-t 9
S-p2-p5-t 7
S-p3-p6-t 5
S-p2-p4-p5-t 2
S-p3-p2-p4-
p5-t 5
73
0
9/9
p1 p4 2
1 1
0 9/11
9/10 8/9
6 8/8
0 0 0
9/9 7/7 14/14
S p2 p5 T 9+7+5+2+5+1
2 3
6/8 1/4
11/11
6/9 Augmenting Bottle nick
0 p3 p6 3 path Capacity
5/5 S-p1-p4-t 9
0 S-p2-p5-t 7
S-p3-p6-t 5
S-p2-p4-p5-t 2
S-p3-p2-p4-
p5-t 5
S-p3-p2-p4-
p5-p6-t 1
Augmenting Path Bottle Nick Capacity 74
S - p1 - p4 - T 9
S - p2 - p5 - T 7
S - p3 - p6 - T 5
S - p2 - p4 - p5 - T 2
S - p3 - p2 - p4 - p5 - T 5
S-p3-p2-p4-p5-p6-t 1
Maximum Flow = 9+7+5+2+5+1 = 29
Edges (E) = 13
Maximum Flow (F) = 29
= O (E * F)
= O (13 * 29)
Time Complexity = O (377)
75