




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





0
2
4
6
8
10
2 4 6 8 10 12 14 16 18 20 heap parameter ( d )
time (s)
int cycle(int n, int p[]) { // Return 1 if the parent pointers, p, form a cycle. Else return 0. int u, v; int count; int *mark = new int[n+1]; // mark[u]=1 once we confirm that u // has a null ancestor, else mark[u]= for (u = 1; u <= n; u++) mark[u] = (p[u] == Null? 1 : 0); for (u = 1; u <= n; u++) { count = 0; for (v = u; mark[v] == 0; v = p[v]) if (count++ == n) return 1; for (v = u; mark[v] == 0; v = p[v]) mark[v] = 1; } return 0; }
have distance โ 1 with p(a)=b, p(b)=c and p(c)=d. At the end of the third pass, a and b will have distance โ 2 with no change in the parent pointers. At the end of the fourth pass, a will have distance โ 3 with no change in the parent pointers. Finally, at the end of the fifth pass, b will have distance โ 3
a b c d
โ 1
0
โ 1 โ 1 a b c d
โ 1
0
โ 1 โ 1
none of the distance labels exceeds (n โ 2) 1/2^ during the first phase, there are O(n 3/2^ ) relabelings
flow and the maximum flow is O(n 1/2^ ) after d(s)>(n โ 2) 1/2^. This means that O(n 1/2^ ) new augmenting
s
b
a
5,2,
e
d
t
capacity, cost, flow
c
s
b
a
e
d
t
residual capacity, cost
0,3 excess, label
c
s
b
a
5,2,
e
d
t
capacity, cost, flow
c
s
b
a
e
d
t
residual capacity, cost
0,3 excess, label
c
s
b
a
5,
4,โ 2
5,-
5,
6 ,โ 1
e
d
t
4,โ 1
6,
5,โ 3
2 ,
-5,
โโโโ 3 ,
โโ โโ 2 ,
3 ,
3,
2,
c
3, โโโโ 1
2,
3,
2,
2,
s
b
a
5,2,
3,1, 3
5,2,
5,2,
2,0, 2
3,2,0^ 5,1,
6,1, 6 2,1,
e
d
t
4,1,
6,3,
c 7,3,
s
b
a
5,
4,โ 2
5,-
5,
6 ,โ 1
e
d
t
4,โ 1
6,
5,โ 3
2 ,
-5,
โโโโ 3 ,
โโ โโ 2 ,
3 ,
3,
2,
c
3, โโโโ 1
2,
3,
2,
2,
s
b
a
5,
4,โ 2
5,-
5,
6 ,โ 1
e
d
t
4,โ 1
6,
5,โ 3
2 ,
-5,
โโโโ 3 ,
โโ โโ 2 ,
3 ,
3,
2,
c
3, โโโโ 1
2,
3,
2,
2,
s
b
a
5,2,
3,1, 3
5,2,
5,2,
2,0, 2
3,2,0^ 5,1,
6,1, 6 2,1,
e
d
t
4,1,
6,3,
s c 7,3,
b
a
5,2,
3,1, 3
5,2,
5,2,
2,0, 2
3,2,0^ 5,1,
6,1, 6 2,1,
e
d
t
4,1,
6,3,
c 7,3,
k
a
l g
d
m
n i q 0
0 0 0 0
(^0 )
1
b c e h j^ p
r
0 0 0 0 0 0
1
b
l g h
k
d e
a
n (^) m q
j
c
i
p
r
k
a
l g
d
m
n i q 0
0 0 0 0
(^0 )
1
b c e h j^ p
r
0 0 0 0 0 0
1
k
a
l g
d
m
n i q 0
0 0 0 0
(^0 )
1
b c e h j^ p
r
0 0 0 0 0 0
1
b c e h j^ p
r
0 0 0 0 0 0
1
b
l g h
k
d e
a
n (^) m q
j
c
i
p
r
b
l g h
k
d e
a
n (^) m q
j
c
i
p
r
b
l g h
k
d e
a
n (^) m q
j
c
i
p
r
(^) +
โ
โ
โ
โ
B
B
โ
โ
b
l g h
k
d e
a
n (^) m q
j
c
i
p
r
(^) +
โ
โ
โ
โ
B
B
โ
โ