Chap. 26 Maximum Flow
26.5 The relabel-to-front algorithm
Presenter: Wu YongShou
From: Multimedia Networking lab
Date: April 26, 2008
Definitions[1/5]
• Definition
– List: list consisting of all vertices in V-{s,t}
– Neighbor list: Neighbors of the vertex
Neighbor lists[2/5]
• Neighbor List: N(x)
– Head[N[x]]
– Current(X)
– Next-neighbor(X)
Admissible edges and
networks[3/5]
• (u,v)is admissible if
• 1) cf(u,v)>0
• 2) h(u)=h(v)+1
– cf=capacity-flow
• We can deal with the excess
flow through admissible edge
• Admissible means there can be
a flow
Relabel, Push[4/5]
• Relabel: adjust height
• Push
Admissible edges and
networks[5/5]
• Admissible network is G f ,h (V ,, E f ,h )
where E f ,his set of admissible edges
• This network is consists of these
edges through which flow can be
pushed
Lemma 26.27 [1/4]
• If V (V , E ) is a flow network, f is a
preflow in G, and h is a height
function on G, then the admissible
network G (V , E ) is acyclic
f ,h
f ,h
• The admissible
network is acyclic
Lemma 26.28 [2/4]
•
Let V=(V,E) be a flow network, let f be a preflow in G, and
suppose that the attribute h is height function. If a vertex u is
overflowing and (u,v) is an admissible network, then Push(u,v)
applies. The operation does not create any new admissible
edge, but it may cause (u,v) to became inadmissible.
•
Push makes no
admissible edge,
but may make
edge inadmissible
Lemma 26.29 [3/4]
•
Let G=(V,E) be a flow network, let f be a preflow
in G, and suppose that the attribute h is a
height function. If a vertex u is overflowing and
there are no admissible edges leaving u, then
relabel(u) applies. After the relabel operation,
there is at least one admissible edge leaving u,
but there are no admissible edges entering u.
•
•
•
•
If (u,v) is admissible after relabel, then
h(v)=h(u)+1
So before relabel
h(v)>h(u)+1
By lemma 26.13 no residual edges exist
between vertices whose height differ
more than 1
So contradicted
Discharging an overflowing vertex
•
1.
2.
3.
4.
5.
6.
7.
8.
DISCHARGE(u)
While(e[u]>0)
Do v current[u]
if v=NIL
then Relabel(u)
current[u]head[N[u]]
elseif cf(u,v)>0, h[u]=h[v]+1
then push(u,v)
else current[u] next-neighbor[v]
• If there is admissible
edge, then push
• If there is no admissible
edge, then go to next
neighbor
• If get to NIL and e(u)>0,
then relabel
Discharging an overflowing
vertex[1/8]
Discharging an overflowing
vertex[2/8]
Discharging an overflowing
vertex[3/8]
Discharging an overflowing
vertex[4/8]
Discharging an overflowing
vertex[5/8]
Discharging an overflowing
vertex[6/8]
Discharging an overflowing
vertex[7/8]
Discharging an overflowing
vertex[8/8]
Lemma 26.30 [4/4]
1. If discharge calls Push(u,v) in line 7, then a push operation applies to u.
2. If discharge calls Relabel(u) in line 4, then a relabel operation applies to u
1. Self evident
2. Need to prove: by the time of relabel,
all edges leaving u is inadmissible
- relabel(u) means u is overflowing
- from 6,7,8 line we can see that by the
time relabel, all edges are
inadmissible
•
1.
2.
3.
4.
5.
6.
7.
8.
DISCHARGE(u)
While(e[u]>0)
Do v current[u]
if v=NIL
then Relabel(u)
current[u]head[N[u]]
elseif cf(u,v)>0, h[u]=h[v]+1
then push(u,v)
else current[u] next-neighbor[v]
The relabel-to-front algorithm
• We maintain a linked list consisting of all vertices in v-{s,t}
• A key property is that the vertices in L are topologically sorted
according to admissible network
•
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Pseudo code for relabel-to-front algorithm
Initialize-Preflow(G,s,t)
LV[G]-{s,t}
For each vertex u in V[G]-{s,t}
do current[u]head[N[u]]
Uhead[L]
While u!=NIL
do old-heighth[u]
Discharge(u)
if h[u]>old-height
then move u to the front of list L
unext[u]
Main flow of the algorithm
• Initialize preflow as push-relabel
• Discharge vertices one by one
The relabel-to-front algorithm[1/6]
The relabel-to-front algorithm[2/6]
The relabel-to-front algorithm[3/6]
The relabel-to-front algorithm[4/6]
The relabel-to-front algorithm[5/6]
The relabel-to-front algorithm[6/6]
Analysis
• We've already learned the running time of
– Relabel operation of each vertex is O(V)
– Relabel operation of all vertices is O(V2)
• Theorem
• The running time of relabel-to-front algorithm
on any flow G=(V,E) is O(V3)
Proof of the running time
•
•
•
•
“Phase”: time between two consecutive relabel operation
There are O(V2) phases
* Each phase consists of at most |V| calls to discharge
So running time of discharge is O(V3)
Proof of the running time
• Bound the Discharge
– There are three types of operation in
Discharge
– Relabel operation: O(v2) are performed
– Advanced pointer: O(VE) given by
handshaking lemma
– Push operation: total number of saturating
push operation is O(VE)
– So the running time of Relabel-to-front is
therefore O(V3+VE)=O(V3)
Conclusion
• We can solve the maximum flow
problem faster than O(V2E) which is the
running time of push-relabel algorithm
• The running time of relabel-to-front
algorithm is O(V3), which is
asymptotically at least as good as O(V2E),
and better for dense network
Thank you!
ANY QUESTIONS?
© Copyright 2026 Paperzz