0% found this document useful (0 votes)
38 views115 pages

Maximum Flow in Graphs: Ford-Fulkerson

This document provides an overview of maximum flow algorithms. It begins with an introduction to flow networks, defining key concepts like flow, capacity, and residual graphs. It then describes the Ford-Fulkerson method for finding the maximum flow in a network. This method works by finding augmenting paths in the residual graph to incrementally increase the flow from the source to the sink. The document provides examples to illustrate flow networks and residual graphs.

Uploaded by

Vishnu Mukundan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views115 pages

Maximum Flow in Graphs: Ford-Fulkerson

This document provides an overview of maximum flow algorithms. It begins with an introduction to flow networks, defining key concepts like flow, capacity, and residual graphs. It then describes the Ford-Fulkerson method for finding the maximum flow in a network. This method works by finding augmenting paths in the residual graph to incrementally increase the flow from the source to the sink. The document provides examples to illustrate flow networks and residual graphs.

Uploaded by

Vishnu Mukundan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CSI3020

Advanced Graph Algorithms (Mod – 4)

By,
Dr. Kovendan AKP,
Senior Assistant Professor,
Department of Database Systems,
School of Computer Science and Engineering,
Vellore Institute of Technology, Vellore.

Email: kovendan.akp@vit.ac.in Mobile: +91-9677190102 Cabin: PRP 208-C


Module 4: Maximum Flow
Maximum Flow – Flow networks – The Ford-Fulkerson method –
Maximum bipartite matching – Push relabel algorithms – The relabel-
to-front algorithm.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 2


Flow Networks
Flow Network
• Directed graph G(V,E)
• Source – s
• Sink – t
• Edge (u,v) – Non negative
• Each edge has got a capacity c(u,v)
• Amount of traffic through the network edge.
• c(u,v) >=0
• No self loops allowed.
• If (u,v) is a edge that belongs to E, then the graph cannot contain an edge (v,u)
• Each vertex lies in some path from source to sink.
• s -> v -> t
• Each vertex other than s has at least one entering edge.
• |E| >= |V| - 1

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 4


Example Flow Network

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 5


Flow
• In a flow graph or flow network, the capacity is fixed.
• Flow is the actual amount passing through the network.
• Eg: Car passing through an edge.
• Flow representation
• Flow / Capacity
• Flow : Capacity

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 6


Flow – Formal Definition
• Let G=(V,E) be a flow network with a capacity function c.
• A flow in G is a real valued function f: V x V -> R that satisfies two
properties,
1. Capacity Constraint
• For all (u,v) ∈ V, 0 ≤ f(u,v) ≤ c(u,v)
• Flow ≤ Capacity
2. Flow Conservation Law
• Total flow into a node is equal to
total flow out of the node.
• 𝑓 𝑖𝑛 𝑢 = σ𝑣∈𝑉 𝑓(𝑣, 𝑢)
• 𝑓 𝑜𝑢𝑡 𝑢 = σ𝑣∈𝑉 𝑓(𝑣, 𝑢)
• 𝑓 𝑖𝑛 𝑢 = 𝑓 𝑜𝑢𝑡 (𝑢)

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 7


Example Flow graph Conservation Law:

Node a: in= 1+1 = 2


2/2
a d out = 2
1/3 2/3
Node b: in=2
1/3 1/1
1/3 out = 2
S t

Flow Value:
1/2
2/2
b c
2/3 |f| = V(f) = fout(s)
= fin (t)
=3

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 8


Test your understanding
Fill ? With appropriate flow values.
?/4
a d
3/4 ?/10

1/7 2/6
S ?/6 t

?/4
9/11
b c
10/15

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 9


Test your understanding - Solution

4/4
a d
3/4 8/10

1/7 2/6
S 6/6 t

4/4
9/11
b c
10/15

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 10


Other points to remember in flow graph
Rational Capacities
b b
3 5
Multiply every 9 10
2 3 capacity by 6

a d a 6 d
1

1 7 2 21
c c
3 2

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 11


Other points to remember in flow graph
Antiparallel Edges
4
Anti parallel edge – a’
Not Allowed b
9
b 5 9 10
9 10
a 6 d
a 6 d

2 21
c
2 21
c

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 12


Other points to remember in flow graph
Multiple Source and Sink

t1 t1
∞ s1 ∞
s1
Internal Internal
s ∞
Node t2 Node t2 t

s2 s2 ∞
t3 t3

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 13


The Ford-Fulkerson method
Residual Graph - Gf
• Gf consists of edges with capacities that represent how we can
change the flow on an edge of G.
• Gf may contain edges that are not in G.
• It only contains capacity.
• |Ef|<= 2|E|
• Given a flow f over G,

𝑐 𝑢, 𝑣 − 𝑓 𝑢, 𝑣 , 𝑖𝑓 (𝑢, 𝑣) ∈ 𝐸
𝑐𝑓 𝑢, 𝑣 = ൞ 𝑓 𝑣, 𝑢 , 𝑖𝑓(𝑣, 𝑢) ∈ 𝐸
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 15
Residual Graph Example 1

b b
1 1
1/1 1

a d a 1 1 d
1/2

1 1
1 1/1 c
c

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 16


Residual Graph Example 2

5/7
a d
3/3 5/8

2/2 1/1
S 1/1 t

2/3
4/5
b c
3/3

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 17


Residual Graph Example 2 - Solution
5
a d
3 2
5
3
2 1 1
S t
1 1
4 2
b c
3

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 18


Residual Graph
• Residual graph is not a flow graph as it violates the property of anti
parallel edges.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 19


Augmentations
• Augmentation is adding a path from source to sink in the residual
network.
• Its purpose is to increase the flow of the flow graph.
• If f is a flow in the flow graph and f’ is the flow in the residual network
we define f ↑ f’, the augmentation of flow f by f’, to be a function
from V x V to R defined by,

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 20


Flow graph a Residual graph
a 3
3
0/3
0/3
1 4 1
1/5 1/2 s b c t
1/1
s b c t 1 1
4 3
0/4 0/3
d e
d e 2
0/2

Path in Residual
Graph
a a Augment the Path in
3 C(P’)=min{3,3,1}=1 1/3 Flow Graph
3 1/3
1 4 1 1/5 2/2
s b c t 1/1
s b c t
1 1
4 3 0/4 0/3
d e d e
2 0/2
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 21
Maximum Flow - The Ford-Fulkerson method
• We try to find out the max flow value of a graph.
• Max(V(f))

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 22


Example Problem – Ford Fulkerson Method

a
0/3 Flow initialized to
0/3
Zero
0/1 0/5 0/2
s b c t

0/4 0/3
d e
0/2

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 23


Flow graph a Residual graph
a 3
3
0/3
0/3
1 5 2
0/5 0/2 s b c t
0/1
s b c t
4 3
0/4 0/3
d e
d e 2
0/2

Path in Residual
Graph
a Augment the Path in
a C(P’)=min{1,5,5}=1 0/3 Flow Graph
3 0/3
3
1/1 1/5 2/2
1 s b c t
5 2
s b c t
0/4 0/3
4 3
d e
Monday, 03 July 2023 d e Instructor: Dr. Kovendan AKP
0/2 24
2
Flow graph a Residual graph
a 3
3
0/3
0/3
1 4 1
1/5 1/2 s b c t
1/1
s b c t 1 1
4 3
0/4 0/3
d e
d e 2
0/2

Path in Residual
Graph
a a Augment the Path in
3 C(P’)=min{3,3,1}=1 1/3 Flow Graph
3 1/3
1 4 1 1/5 2/2
s b c t 1/1
s b c t
1 1
4 3 0/4 0/3
d e d e
2 0/2
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 25
a Flow graph a Residual graph
1/3 1 1
1/3 2 2

1/5 2/2 1 4
1/1 s b c t
s b c t
1 2
0/4 0/3 4 3

d e d e
0/2 2

Path in Residual
Graph
a a Augment the Path in
1 C(P’)=min{2,2,1,4,2,3}=1 2/3 Flow Graph
1 2/3
2 2
1 4 1/1 0/5 2/2
s b c t s b c t
1 2
4 3 1/4 1/3
d e d e
Monday, 03 July 2023 2 Instructor: Dr. Kovendan AKP
1/2 26
a Flow graph a Residual graph
2 2
2/3 1 1
2/3
0/5 2/2 1 5
1/1 s b c t
s b c t 2
1 1
3 2
1/4 1/3 1
d e d e
1/2 1

Path in Residual
Graph
a Final Flow graph
a
Not a valid path !!! 2/3 Maximum Flow
2 2 2/3
1 1 V(f)=3

1 1/1 0/5 2/2


5 s b c t
s b c 2 t

1 1 1/3
3 2 1/4
1
d e d e
Monday, 03 July 2023 1 Instructor: Dr. Kovendan AKP
1/2 27
Homework
• Apply Ford Fulkerson method to find the maximum flow in the given
graph.

Question

Solution

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 28


Cuts of flow network
• The Ford-Fulkerson method repeatedly augments the flow along
augmenting paths until it has found a maximum flow.
• How do we know that when the algorithm terminates, we have
actually found a maximum flow?
• The max-flow min-cut theorem, tells us that a flow is maximum if
and only if its residual network contains no augmenting path.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 29


Cut
• A cut (S,T) of flow network G =(V,E) is a partition of V into S and T such
that T= V – S and s ∈ S and t ∈ T.
• It consists of edges with one end point in S and the other end point in
T.
S
• This cut is referred as S-T cut. a
3
• Eg: S={s,a,c} T={b,d,e,t} 3

1 5 2
s b c t

4 3
d e T
2
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 30
a S

Capacity of a Cut 3
3

1 5 2
s b c t
• The capacity of a S-T cut is denoted by C(S,T).
4 3
𝐶 𝑆, 𝑇 = ෍ ෍ 𝐶(𝑢, 𝑣) d e T
𝑢∈𝑆 2
𝑣∈𝑇
• Summation of capacity of outgoing edges from S to T.
• Eg: S={s,a,c} T={b,d,e,t}
Outgoing edges={(s,b),(c,t)}
C(S,T) = 1+2
C(S,T) = 3
• A min cut in a S-T cut is defined as a cut with minimum capacity.
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 31
Flow across the cut
• It is also referred to a the net flow.
• If f is the flow in the graph G, then the net flow f(S,T) across the cut
(S,T) is defined as follows,

• Summation of Flow of outward edge from S – Summation of Flow of


inward edge to S.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 32


Flow across the cut - Example
a S
1/3
1/3
f(S,T) = [f(s,b)+f(c,t)]-[f(b,c)]
1/1 1/5 2/2
= (1 + 2) – (1) s b c t

=2 0/4 0/3
d e T
0/2
f(v) = |f| = 2

f(S,T) = |f|

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 33


Example 2
• Net flow

• Capacity

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 34


Proof
• Let f be a flow in a flow network G with source s and sink t, and let
(S,T) be any cut of G. Then the net flow across (S,T) is f(S,T) = |f|.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 35


Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 36
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 37
Max Flow Min Cut Theorem

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 38


Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 39
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 40
The basic Ford-Fulkerson algorithm

O(E .|f*|)

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 41


Find the maximum flow for the given flow
graph using Ford Fulkerson algorithm.
0/4
a d
0/10 0/10

0/8
0/2 0/6
S t

0/10
0/10
b c
0/9

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 42


Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 43
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 44
Homework
• Find the maximum flow for the given flow graph using Ford Fulkerson
algorithm.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 45


Push Re-label Algorithm
Push Re-label Algorithm
• Used to calculate the maximum flow of a given flow graph.
• Source node has a height value=total no.of.nodes initially.
• Sink node has a heigh value of 0 and a excess flow of 0 initially.
• Each intermediate node has 2 values,
• Height: initially assigned to 0.
• Excess flow: initially assigned to 0.
• Flow is possible from a node at a greater height to a node at a lower
height.
• Flow is possible in all valid edges of the residual graph.
• The law of conservation is temporarily suspended until the computation is
done.
• There is no compromise with the capacity of each node.
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 47
Operations
• Push Forward
• Excess_flow(v) = min{excess_flow(u) , (C(u,v)-f(u,v))}
• Push Backward
• Excess_flow(v) = min{excess_flow(u), f(v,u)}
• Re-label
• Increase the height by 1.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 48


Algorithm and Time Complexity Analysis
O(V2.E)
Step 1: Begin
Step 2: Initialize h(s)=total number of nodes. Initialize other node heights as 0 and
excess_flow as 0.
Step 3: Push the maximum capacity from s to all the nodes with a valid path.
Step 4: Find the node with maximum excess_flow value and set it as the active
node.
Step 5: If all the excess_flow values are zero, go to step 7.
Step 6: For the active node perform the following.
Step 6.1: Check if there is a possibility of flow from the active node to other nodes.
Step 6.1.1: If yes, then perform push forward or push backward operation satisfying the capacity of the link.
Step 6.1.2: If no, perform re-label operation and increase the active nodes height by 1.
Step 6.2: Go to 4.
Step 7: End
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 49
Example - 1
• Find the maximum flow of the given graph by using push relabel
algorithm.
a
5 4

s 6 t

8 5
b

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 50


h(a)=0
e(a)=0 Initialize the height of source node as follows,

a h(s)= Total no.of nodes = 4


5 4

h(t)=0 Initialize the height and excess flow of other


h(s)=4 s 6 t nodes.
e(t)=0

8 5
h(a) = 0 ; e(a) = 0
b h(b) = 0 ; e(b) = 0
h(t) = 0 ; e(t) = 0
h(b)=0
e(b)=0

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 51


h(a)=0 h(a)=0
e(a)=0 e(a)=5

a a
5 4 5/5 4

h(t)=0 h(t)=0
h(s)=4 s t h(s)=4 s 6 t
6 e(t)=0 e(t)=0

8 8/8 5
5
b b

h(b)=0 h(b)=0
e(b)=0 e(b)=8

h(s) > 0 (greatest height) and as s is the source


node perform the following:

Push(s,a)=5 => e(a)=5


Push(s,b)=8 => e(b)=8

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 52


h(a)=0 h(a)=0
e(a)=5 e(a)=11

a a
5/5 4 5/5 4

h(t)=0 h(t)=0
h(s)=4 s 6 t h(s)=4 s 6/6 t
e(t)=0 e(t)=0

8/8 5 8/8 5
b b

h(b)=0 h(b)=1
e(b)=8 e(b)=2

Active Node: b (greatest excess value) Push(b,a) = 6 => e(a)=6+5 = 11


Neighbours : {s,a,t} => e(b)=2

Re-label Operation: h(b)=h(b)+1 = 1


h(b) > h(a) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 53


h(a)=0 h(a)=1
e(a)=11 e(a)=7

a a
5/5 4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s t h(s)=4 s 6/6 t
6/6 e(t)=0 e(t)=4

8/8 5 8/8 5
b b

h(b)=1 h(b)=1
e(b)=2 e(b)=2

Active Node: a (greatest height) Push(a,t) = 4 => e(t) = 4


Neighbours : {s,b,t} => e(a)=7

Relabel Operation: h(a)=h(a)+1=1


h(a) > h(t) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 54


h(a)=1 h(a)=2
e(a)=7 e(a)=1

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 6/6 t h(s)=4 s 0/6 t
e(t)=4 e(t)=4

8/8 5 8/8 5
b b

h(b)=1 h(b)=1
e(b)=2 e(b)=8

Active Node: a Push(a,b) = 6 => e(b) = 2+6=8


Neighbours : {s,b,t} => e(a)=7-6 = 1

Relabel Operation: h(a)=h(a)+1=2


h(a) > h(b) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 55


h(a)=2 h(a)=2
e(a)=1 e(a)=1

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 0/6 t h(s)=4 s 0/6 t
e(t)=4 e(t)=9

8/8 5 8/8 5/5


b b

h(b)=1 h(b)=1
e(b)=8 e(b)=3

Active Node: b Push(b,t) = 5 => e(t) = 4+5=9


Neighbours : {s,a,t} => e(b)=8-5 =3

h(b) > h(t) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 56


h(a)=2 h(a)=2
e(a)=1 e(a)=1

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 0/6 t h(s)=4 s 0/6 t
e(t)=9 e(t)=9

8/8 5/5 8/8 5/5


b b

h(b)=1 h(b)=2
e(b)=3 e(b)=3

Active Node: b
Neighbours : {s,a,t}

Relabel Operation: h(b)=h(b)+1=2

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 57


h(a)=2 h(a)=2
e(a)=1 e(a)=4

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 0/6 t h(s)=4 s 3/6 t
e(t)=9 e(t)=9

8/8 5/5 8/8 5/5


b b

h(b)=2 h(b)=3
e(b)=3 e(b)=0

Active Node: b Push(b,a) = 3 => e(a)=1+3=4


Neighbours : {s,a,t} => e(b)=0

Relabel Operation: h(b)=h(b)+1=3


h(b)>h(a), So flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 58


h(a)=2 h(a)=3
e(a)=4 e(a)=4

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 3/6 t h(s)=4 s 3/6 t
e(t)=9 e(t)=9

8/8 5/5 8/8 5/5


b b

h(b)=3 h(b)=3
e(b)=0 e(b)=0

Active Node: a
Neighbours : {s,b,t}

Relabel Operation: h(a)=h(a)+1=3

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 59


h(a)=3 h(a)=4
e(a)=4 e(a)=1

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 3/6 t h(s)=4 s 0/6 t
e(t)=9 e(t)=9

8/8 5/5 8/8 5/5


b b

h(b)=3 h(b)=3
e(b)=0 e(b)=3

Active Node: a Push(a,b)=3 (As per residual path) => e(b)=0+3=3


Neighbours : {s,b,t} => e(a) = 4-3 = 1

Relabel Operation: h(a)=h(a)+1=4


h(a)>h(b), So flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 60


h(a)=4 h(a)=4
e(a)=1 e(a)=1

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 0/6 t h(s)=4 s 0/6 t
e(t)=9 e(t)=9

8/8 5/5 8/8 5/5


b b

h(b)=3 h(b)=4
e(b)=3 e(b)=3

Active Node: b
Neighbours : {s,a,t}

Relabel Operation: h(b)=h(b)+1=4

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 61


h(a)=4 h(a)=4
e(a)=1 e(a)=1

a a
5/5 4/4 5/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 0/6 t h(s)=4 s 0/6 t
e(t)=9 e(t)=9

8/8 5/5 5/8 5/5


b b

h(b)=4 h(b)=5
e(b)=3 e(b)=0

Active Node: b Push(b,s) = 3 => e(b)=0


Neighbours : {s,a,t}

Relabel Operation: h(b)=h(b)+1=5


h(b)>h(s)

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 62


h(a)=4 h(a)=5
e(a)=1 e(a)=0

a a
5/5 4/4 4/5 4/4

h(t)=0 h(t)=0
h(s)=4 s 0/6 t h(s)=4 s 0/6 t
e(t)=9 e(t)=9

5/8 5/5 5/8 5/5


b b

h(b)=5 h(b)=5
e(b)=0 e(b)=0

Active Node: a Push(a,s) = 1 => e(a)=0


Neighbours : {s,b,t}

Relabel Operation: h(a)=h(a)+1=5


h(a)>h(s)

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 63


h(a)=5
e(a)=0

a
4/5 4/4
No excess in the intermediate
h(t)=0
h(s)=4 s 0/6 t nodes !!!
e(t)=9
So, Stop.
5/8 5/5
b

h(b)=5
e(b)=0

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 64


Example - 2
• Find the maximum flow of the given graph by using push relable
algorithm.
15
a b
10 3

s 5 8 t

12 17
c d
6

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 65


h(a)=0 h(b)=0
e(a)=0 e(b)=0
15
a b
10 3

5 8 h(t)=0
h(s)=6 s t
e(t)=0
12 17
c d
6
h(c)=0 h(d)=0
e(c)=0 e(d)=0

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 66


h(a)=0 h(b)=0 h(a)=0 h(b)=0
e(a)=0 e(b)=0 e(a)=10 e(b)=0
15 15
a b a b
10 3 10/10 3

5 8 h(t)=0 h(t)=0
h(s)=6 s t h(s)=6 s 5 8 t
e(t)=0 e(t)=0
12 17 12/12 17
c d c d
6 6
h(c)=0 h(d)=0 h(c)=0 h(d)=0
e(c)=0 e(d)=0 e(c)=12 e(d)=0

h(s) > 0 (greatest height) and as s is the source


node perform the following:

Push(s,a)=10 => e(a)=10


Push(s,c)=12 => e(c)=12

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 67


h(b)=0 h(a)=0 h(b)=0
h(a)=0
e(b)=0 e(a)=10 e(b)=0
e(a)=10
15 15
a b a b
3 10/10 3
10/10
h(t)=0 5 8 h(t)=0
h(s)=6 5 8 h(s)=6 s t
s t e(t)=0
e(t)=0

17 12/12 17
12/12 c d
c d 6/6
6
h(c)=0 h(c)=1 h(d)=0
h(d)=0
e(c)=12 e(c)=6 e(d)=6
e(d)=0

Active Node: c (greatest excess value) Push(c,d) = 6 => e(d)=6


Neighbours : {s,a,d} => e(c)=12-6=6

Re-label Operation: h(c)=h(c)+1 = 1


h(c) > h(d) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 68


h(a)=0 h(b)=0 h(a)=1 h(b)=0
e(a)=10 e(b)=0 e(a)=0 e(b)=10
15 10/15
a b a b
10/10 3 10/10 3
h(t)=0 5 8 h(t)=0
h(s)=6 s 5 8 t h(s)=6 s t
e(t)=0 e(t)=0

12/12 17 12/12 17
c d c d
6/6 6/6
h(c)=1 h(d)=0 h(c)=1 h(d)=0
e(c)=6 e(d)=6 e(c)=6 e(d)=6

Active Node: a (greatest excess value) Push(a,b) = 10 => e(b)=10


Neighbours : {s,c,b} => e(a)=10-10=0

Re-label Operation: h(a)=h(a)+1 = 1


h(a) > h(b) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 69


h(a)=1 h(b)=0 h(a)=1 h(b)=1
e(a)=0 e(b)=10 e(a)=0 e(b)=2
10/15 10/15
a b a b
3 10/10 3
10/10
h(t)=0 5 8/8 h(t)=0
h(s)=6 s 5 8 t h(s)=6 s t
e(t)=0 e(t)=0

12/12 17 12/12 17
c d c d
6/6 6/6
h(c)=1 h(d)=0 h(c)=1 h(d)=0
e(c)=6 e(d)=6 e(c)=6 e(d)=14

Active Node: b (greatest excess value) Push(b,d) = 8 => e(d)=6+8=14


Neighbours : {a,d,t} => e(b)=10-8=2

Re-label Operation: h(b)=h(b)+1 = 1


h(b) > h(d) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 70


h(a)=1 h(b)=1 h(a)=1 h(b)=1
e(a)=0 e(b)=2 e(a)=0 e(b)=2
10/15 10/15
a b a b
10/10 3 10/10 3

8/8 h(t)=0 5 8/8 h(t)=0


h(s)=6 s 5 t h(s)=6 s t
e(t)=0 e(t)=14

12/12 17 12/12 14/17


c d c d
6/6 6/6
h(c)=1 h(d)=0 h(c)=1 h(d)=1
e(c)=6 e(d)=14 e(c)=6 e(d)=0

Active Node: d (greatest excess value) Push(d,t) = 14 => e(t)=14


Neighbours : {b,c,t} => e(d)=0

Re-label Operation: h(d)=h(d)+1 = 1


h(d) > h(t) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 71


h(a)=1 h(b)=1 h(a)=1 h(b)=1
e(a)=0 e(b)=2 e(a)=5 e(b)=2
10/15 10/15
a b a b
10/10 3 10/10 3

5 8/8 h(t)=0 5/5 8/8 h(t)=0


h(s)=6 s t h(s)=6 s t
e(t)=14 e(t)=14

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=1 h(d)=1 h(c)=2 h(d)=1
e(c)=6 e(d)=0 e(c)=1 e(d)=0

Active Node: c (greatest excess value) Push(c,a) = 5 => e(a)=5


Neighbours : {s,a,d} => e(c)=6-5=1

Re-label Operation: h(c)=h(c)+1 = 2


h(c) > h(a) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 72


h(a)=1 h(b)=1 h(a)=2 h(b)=1
e(a)=5 e(b)=2 e(a)=0 e(b)=7
10/15 15/15
a b a b
10/10 3 10/10 3

8/8 h(t)=0 5/5 8/8 h(t)=0


h(s)=6 s 5/5 t h(s)=6 s t
e(t)=14 e(t)=14

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=2 h(d)=1 h(c)=2 h(d)=1
e(c)=1 e(d)=0 e(c)=1 e(d)=0

Active Node: a (greatest excess value) Push(a,b) = 5 => e(b)=2+5=7


Neighbours : {s,b,c} => e(a)=0

Re-label Operation: h(a)=h(a)+1 = 2


h(a) > h(b) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 73


h(a)=2 h(b)=1 h(a)=2 h(b)=1
e(a)=0 e(b)=7 e(a)=0 e(b)=4
15/15 15/15
a b a b
10/10 3 10/10 3/3

8/8 h(t)=0 5/5 8/8 h(t)=0


h(s)=6 s 5/5 t h(s)=6 s t
e(t)=14 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=2 h(d)=1 h(c)=2 h(d)=1
e(c)=1 e(d)=0 e(c)=1 e(d)=0

Active Node: b (greatest excess value) Push(b,t) = 3 => e(t)=14+3=17


Neighbours : {a,d,t} => e(b)=4

h(b) > h(t) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 74


h(a)=2 h(b)=1 h(a)=2 h(b)=2
e(a)=0 e(b)=4 e(a)=4 e(b)=0
15/15 11/15
a b a b
10/10 3/3 10/10 3/3
h(t)=0 5/5 8/8 h(t)=0
h(s)=6 s 5/5 8/8 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=2 h(d)=1 h(c)=2 h(d)=1
e(c)=1 e(d)=0 e(c)=1 e(d)=0

Active Node: b (greatest excess value) Push(b,a) = 4 => e(a)=4


Neighbours : {a,d,t} => e(b)=0

Re-label Operation: h(b)=h(b)+1=2


h(b) > h(t) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 75


h(a)=2 h(b)=2 h(a)=3 h(b)=2
e(a)=4 e(b)=0 e(a)=0 e(b)=0
11/15 11/15
a b a b
3/3 10/10 3/3
10/10
h(t)=0 1/5 8/8 h(t)=0
h(s)=6 s 5/5 8/8 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=2 h(d)=1 h(c)=2 h(d)=1
e(c)=1 e(d)=0 e(c)=5 e(d)=0

Active Node: a (greatest excess value) Push(a,c) = 4 => e(c)=1+4=5


Neighbours : {s,c,b} => e(a)=0

Re-label Operation: h(a)=h(a)+1=3


h(a) > h(c) => so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 76


h(a)=3 h(b)=2 h(a)=3 h(b)=2
e(a)=0 e(b)=0 e(a)=0 e(b)=0
11/15 11/15
a b a b
10/10 3/3 10/10 3/3

8/8 h(t)=0 1/5 8/8 h(t)=0


h(s)=6 s 1/5 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=2 h(d)=1 h(c)=3 h(d)=1
e(c)=5 e(d)=0 e(c)=5 e(d)=0

Active Node: c (greatest excess value)


Neighbours : {s,a,d}

Re-label Operation: h(c)=h(c)+1=3

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 77


h(a)=3 h(b)=2 h(a)=3 h(b)=2
e(a)=0 e(b)=0 e(a)=4 e(b)=0
11/15 11/15
a b a b
10/10 3/3 10/10 3/3

h(t)=0 5/5 8/8 h(t)=0


h(s)=6 s 1/5 8/8 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=3 h(d)=1 h(c)=4 h(d)=1
e(c)=5 e(d)=0 e(c)=1 e(d)=0

Active Node: c (greatest excess value) Push(c,a)=4 => e(a)=4


Neighbours : {s,a,d} => e(c) = 1

Re-label Operation: h(c)=h(c)+1=4


h(c)>h(a), So flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 78


h(a)=3 h(b)=2 h(a)=4 h(b)=2
e(a)=4 e(b)=0 e(a)=4 e(b)=0
11/15 11/15
a b a b
3/3 10/10 3/3
10/10
h(t)=0 5/5 8/8 h(t)=0
h(s)=6 s 5/5 8/8 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=4 h(d)=1 h(c)=4 h(d)=1
e(c)=1 e(d)=0 e(c)=1 e(d)=0

Active Node: a (greatest excess value)


Neighbours : {s,c,b}

Re-label Operation: h(a)=h(a)+1=4

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 79


h(a)=4 h(b)=2 h(a)=5 h(b)=2
e(a)=4 e(b)=0 e(a)=0 e(b)=0
11/15 11/15
a b a b
3/3 10/10 3/3
10/10
h(t)=0 1/5 8/8 h(t)=0
h(s)=6 s 5/5 8/8 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=4 h(d)=1 h(c)=4 h(d)=1
e(c)=1 e(d)=0 e(c)=5 e(d)=0

Active Node: a (greatest excess value) Push(a,c)=4 => e(c)=1+4=5


Neighbours : {s,c,b} => e(a)=0

Re-label Operation: h(a)=h(a)+1=5


h(a)>h(c), so flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 80


h(a)=5 h(b)=2 h(a)=5 h(b)=2
e(a)=0 e(b)=0 e(a)=0 e(b)=0
11/15 11/15
a b a b
10/10 3/3 10/10 3/3

1/5 8/8 h(t)=0 8/8 h(t)=0


h(s)=6 s t h(s)=6 s 1/5 t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=4 h(d)=1 h(c)=5 h(d)=1
e(c)=5 e(d)=0 e(c)=5 e(d)=0

Active Node: c (greatest excess value)


Neighbours : {s,a,d}

Re-label Operation: h(c)=h(c)+1=5

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 81


h(a)=5 h(b)=2 h(a)=5 h(b)=2
e(a)=0 e(b)=0 e(a)=4 e(b)=0
11/15 11/15
a b a b
10/10 3/3 10/10 3/3

8/8 h(t)=0 5/5 8/8 h(t)=0


h(s)=6 s 1/5 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=5 h(d)=1 h(c)=6 h(d)=1
e(c)=5 e(d)=0 e(c)=1 e(d)=0

Active Node: c (greatest excess value) Push(c,a)=4 => e(a)=4


Neighbours : {s,a,d} => e(c)=1

Re-label Operation: h(c)=h(c)+1=6


h(c) > h(a), So, flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 82


h(a)=5 h(b)=2 h(a)=6 h(b)=2
e(a)=4 e(b)=0 e(a)=4 e(b)=0
11/15 11/15
a b a b
10/10 3/3 10/10 3/3

8/8 h(t)=0 5/5 8/8 h(t)=0


h(s)=6 s 5/5 t h(s)=6 s t
e(t)=17 e(t)=17

12/12 14/17 12/12 14/17


c d c d
6/6 6/6
h(c)=6 h(d)=1 h(c)=6 h(d)=1
e(c)=1 e(d)=0 e(c)=1 e(d)=0

Active Node: a (greatest excess value)


Neighbours : {s,c,b}

Re-label Operation: h(a)=h(a)+1=6

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 83


h(a)=6 h(b)=2 h(a)=7 h(b)=2
e(a)=4 e(b)=0 e(a)=0 e(b)=0
11/15 11/15
a b a b
10/10 3/3 6/10 3/3

5/5 8/8 h(t)=0 h(t)=0


h(s)=6 s t h(s)=6 s 5/5 8/8 t
e(t)=17 e(t)=17
12/12 14/17 12/12 14/17
c d c d
6/6 6/6
h(c)=6 h(d)=1 h(c)=6 h(d)=1
e(c)=1 e(d)=0 e(c)=1 e(d)=0

Active Node: a (greatest excess value) Push(a,s)=4 => e(a)=0


Neighbours : {s,c,b}

Re-label Operation: h(a)=h(a)+1=7


h(a)>h(s). So, Flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 84


h(a)=7 h(b)=2 h(a)=7 h(b)=2
e(a)=0 e(b)=0 e(a)=0 e(b)=0
11/15 11/15
a b a b
6/10 3/3 6/10 3/3

5/5 8/8 h(t)=0 8/8 h(t)=0


h(s)=6 s t h(s)=6 s 5/5 t
e(t)=17 e(t)=17
12/12 14/17 11/12 14/17
c d c d
6/6 6/6
h(c)=6 h(d)=1 h(c)=7 h(d)=1
e(c)=1 e(d)=0 e(c)=0 e(d)=0

Active Node: c (greatest excess value) Push(c,s)=1 => e(c)=0


Neighbours : {s,a,d}

Re-label Operation: h(c)=h(c)+1=7


h(c)>h(s). So, Flow is possible.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 85


h(a)=7 h(b)=2
e(a)=0 e(b)=0
11/15
No excess in the intermediate nodes !!!
a b
6/10 3/3
So stop.
h(s)=6 5/5 8/8 h(t)=0
s t
e(t)=17
11/12 14/17
c d
6/6
h(c)=7 h(d)=1
e(c)=0 e(d)=0

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 86


Application of Max Flow to
maximum matching problem
Application of Max Flow to maximum
matching problem
• Bipartite Matching

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 88


Matching

A set of edges which do not share a vertex is a


matching.

Application: Wireless Networks may consist of nodes with single radios, no


interference constraint

A set of links can be scheduled only if the set is a matching

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 89


Input Queued Switches

Monday, 03 July 2023 The links scheduled Instructor:


must beDr.aKovendan
matchingAKP 90
Maximum Matching

Matching of largest cardinality

A node is free if none of its incident edges is in a matching.

Augmenting path is a path of alternating sequence of matched and unmatched


edges with free end nodes.

e1 e2 e3

Size of matching increases if {e2} is replaced by {e1, e3}


Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 91
A  B = (A – B)  (B – A)

Suppose M is a matching and P is an augmenting path.

Then M  P is also a matching

Also, |M  P | = |M| + 1

A matching is maximum if and only if there is no augmenting path.

If there is no augmenting path, then the matching is not maximum.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 92


Let there be a matching M` of greater cardinality than M.

Consider the graph M  M’

A vertex can have one incident edge from M, or one incident edge from M’, or one
incident edge from M and another from M’

Clearly, a vertex can have at most 2 incident edges

So the new graph consists of disjoint paths and cycles.

The cycles must be even cycles with alternating edges from M and M’

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 93


Paths will also have edges altering between M and M’

Since M’ has a cardinality greater than M, there must be at least one path
which starts and ends in M’.

This is an augmenting path for M.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 94


Maximum Matching Algorithm
Start with an empty set.

1) Search for an augmenting path.

If there is an augmenting path, then update the matching, else terminate.

Go to (1)

How does one find an augmenting path?

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 95


Bipartite Graph
Augmenting path can be found by Hungarian
tree method
Breadth first search like method

Consider one of the two partitions S.

S T
Start from the free vertices in S

All the edges from the free vertices are


in the tree.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 96


S T
Start from the free vertices in S

All the edges from the free vertices are


in the tree.

If we happen to reach a free vertex in T, then we have found an augmenting


path.

Suppose all the vertices in T are matched, then we follow the matched
edges back to S, and subsequently all free edges from the newly
encountered ones in S.

If we reach a free vertex in T we are done, otherwise again follow back the
matched edges into S.
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 97
Don’t include free edges from S into already reached vertices in T.
So vertices in T are never repeated

We would never reach the same vertices in S anyway.

Vertices in S are either matched or free.

We take only matched edges to reach S from T.

A matched edge can not reach a free vertex.


A matched edge can not reach an already reached matched vertex, because it has
been reached using a different matched edge.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 98


Hungarian tree search finishes in O(E)

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 99


Is it possible that there is an augmenting path, but the Hungarian tree does
not yield one?

An augmenting path has odd length.

Any odd length path must have one end in S and another end
in T.

An augmenting path must have one free vertex in S and another in


T.

Consider an augmenting path from the free vertex in S.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 100


The first edge is from a free vertex in S.
The second edge is a matched edge from T.
The third edge is a free edge from S.
The fourth is a matched edge from T….

We are looking at all such paths in the Hungarian method.

If there is an augmenting path, we would find one!

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 101


Complexity Analysis

Once an augmenting path is found, one new vertex is


matched.

Need to look for augmenting paths at most V times.

Looking for an augmenting path consume O(E).

So, overall O(VE).

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 102


Weighted Matching
Now, every edge has a weight.

Weight of a matching is the sum of the weights of its edges.

Need to find a maximum weighted matching.


More general case of maximum matching (maximum matching is
maximum weighted matching with edge weight 1)

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 103


Is it sufficiently general to consider a graph with nonnegative weights?

Is it sufficiently general to consider complete graphs? (A complete


graph is one where there is an edge between every pair of vertices).

For bipartite graphs, is it sufficient to consider equal size partitions only.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 104


Bipartite Graphs
Will consider bipartite graphs.
Partitions are X and Y and |X| = |Y|
We assume that there is always an edge between vertex x in partition X, and
vertex y in partition Y.
Every edge has a nonnegative weight.

A matching where every vertex is matched is a perfect matching.


Such a bipartite graph has a perfect matching.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 105


Vertex Labeling
We assign a nonnegative real number with each vertex. This nonnegative
real number is the label of the vertex.
Label of vertex x is l(x).

A label is feasible if for every edge (x, y), l(x) + l(y) 


w(x, y)

An example of a feasible label is l(y) = 0 for all vertices in Y and l(x) = maxyw(x,
y)

l(x) + l(y) = maxyw(x, y)  w(x, y)


Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 106
Equality Subgraph

Equality subgraph consists of all vertices. An edge (x, y) is included in the equality
subgraph if l(x) + l(y) = w(x, y).

If the equality subgraph Gl has a perfect matching M, then M is the


maximum weighted matching in the original graph G.

Weight of M = eM w(e)

= u, : u, is matchedl(u) (since M is a matching


and Gl is an equality
subgraph)
= u, : u, is in V l(u) (since M is a perfect
Monday, 03 July 2023 matching)
Instructor: Dr. Kovendan AKP 107
Consider any other matching M in the graph G.

Weight of M = eM w(e)

u, : u, is matched l(u) (since M is matching)

u, : u, is in V l(u) (since labels are nonnegative)

= Weight of M

So, if we can adjust the labels so that the equality subgraph has a perfect
matching, then we are done. Why?

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 108


If a perfect matching exists, then it is the maximum matching.

So, existence of a perfect matching can be tested by computing the maximum


matching in the equality subgraph.

Supposing, the equality subgraph had all the edges in the original graph.
Then it is a complete bipartite graph.
Hence, it would have a perfect matching.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 109


So, if the equality subgraph does not have a perfect matching, we should
adjust the labels so that the number of edges in the equality subgraph
increases.

However, any adjustment should be such that the labels are feasible.

Adjustment should aim at satisfying equality constraints in the edges.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 110


Maximum Weighted Matching Algorithm

Start with the following labels:

l(y) = 0 for all vertices in Y and l(x) = maxyw(x, y)

2. Construct the equality subgraph.

Find a maximum matching in the equality subgraph.

If this is a perfect matching, then stop. Otherwise, readjust the labels and go to step
(2).
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 111
Readjustment of Labels

Construct the Hungarian tree w.r.t. the current maximum matching in the
equality subgraph.

Start from the free vertices in X.


Free vertices exist since the matching is not perfect.

The hungarian tree will not yield an augmenting path in the equality
subgraph.

Let S be the set of vertices in X in the tree, and T be the set of vertices
in Y.
Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 112
Observe that there are no edges between S and Y – T in the equality
subgraph (else hungarian tree has not been grown properly).

At the same time, there are edges between S and Y – T in the original graph.

Reason: Current matching is not maximum in G, as G has a perfect matching, and this is
not a perfect matching.
So the hungarian tree must have an augmenting path in G.
But we know there is no augmenting path in the current hungarian tree.
This means that the current hungarian tree can grow further in G, and this is possible
only if there are edges between S and Y-T.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 113


Decrease the labels in S uniformly, and increase those in T uniformly so
that the labels are valid.

Edges between S and Y-T in G will now start entering the equality
subgraph.

Stop when the first edge enters.

A new vertex in Y is added to the Hungarian tree.


If this vertex is free we have an augmenting path, otherwise the
Hungarian tree grows.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 114


If this vertex is free, stop the relabelling and go to step (2).

Otherwise, relabel once again.

Hungarian tree can not grow indefinitely.


So we always improve the matching before going to step (2).

Now, we improve the matching till we find a perfect matching in


the equality subgraph.

Monday, 03 July 2023 Instructor: Dr. Kovendan AKP 115

You might also like