Index
Help
Created with Snap
Created with Snap
1
25
2
25
3
4
5
6
7
8
9
10
11
12
-100
13
14
15
16
17
18
19
20
25
21
22
23
25
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
eps = 0
4x
.25x
.5x
1x
2x
4x
?
def
AdmissibleEdge(v,eps):
for
w
in
Neighborhood(v):
if
ReducedCosts((v,w)) < 0:
return
(v,w)
return
None
def
ReducedCosts((u,v)):
return
cost[(u,v)] + pot[u] - pot[v]
eps = RecalculateCosts()# for integer eps
while
eps > 1:
for
e
in
Edges():
if
ReducedCosts(e) > 0:
flow[e] = 0
elif
ReducedCosts(e) < 0:
flow[e] = cap(e)
IsFlow = False
while
not
IsFlow:
v = ActiveVertex()
if
v:
e = AdmissibleEdge(v,eps)
if
e:
delta = Min(res(e),excess(v))
if
ForwardEdge(e[0],e[1]):
flow[(e[0],e[1])] = flow[(e[0],e[1])] + delta
else
:
flow[(e[1],e[0])] = flow[(e[1],e[0])] - delta
else
:
Lower(v,eps / 2)
else
:
IsFlow = True
eps = eps / 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Edge (1,15) - flow: 0 of 101
Edge (1,16) - flow: 0 of 81
Edge (2,15) - flow: 0 of 80
Edge (2,3) - flow: 0 of 105
Edge (3,26) - flow: 0 of 105
Edge (3,24) - flow: 0 of 103
Edge (4,26) - flow: 0 of 65
Edge (5,17) - flow: 0 of 72
Edge (6,13) - flow: 0 of 119
Edge (6,28) - flow: 0 of 70
Edge (7,27) - flow: 0 of 76
Edge (8,28) - flow: 0 of 108
Edge (8,6) - flow: 0 of 100
Edge (9,25) - flow: 0 of 69
Edge (10,11) - flow: 0 of 80
Edge (10,29) - flow: 0 of 63
Edge (10,9) - flow: 0 of 92
Edge (11,12) - flow: 0 of 92
Edge (11,30) - flow: 0 of 55
Edge (13,12) - flow: 0 of 83
Edge (14,25) - flow: 0 of 78
Edge (15,3) - flow: 0 of 83
Edge (15,4) - flow: 0 of 55
Edge (15,16) - flow: 0 of 96
Edge (16,4) - flow: 0 of 88
Edge (16,19) - flow: 0 of 75
Edge (17,4) - flow: 0 of 69
Edge (17,7) - flow: 0 of 95
Edge (17,18) - flow: 0 of 64
Edge (18,7) - flow: 0 of 66
Edge (19,4) - flow: 0 of 122
Edge (19,5) - flow: 0 of 62
Edge (20,16) - flow: 0 of 60
Edge (20,21) - flow: 0 of 77
Edge (20,19) - flow: 0 of 93
Edge (21,22) - flow: 0 of 69
Edge (21,19) - flow: 0 of 71
Edge (22,19) - flow: 0 of 77
Edge (23,3) - flow: 0 of 64
Edge (24,10) - flow: 0 of 123
Edge (24,9) - flow: 0 of 59
Edge (24,14) - flow: 0 of 115
Edge (25,29) - flow: 0 of 79
Edge (25,28) - flow: 0 of 71
Edge (26,8) - flow: 0 of 82
Edge (27,8) - flow: 0 of 66
Edge (27,6) - flow: 0 of 72
Edge (28,30) - flow: 0 of 71
Edge (29,30) - flow: 0 of 71
Edge (30,13) - flow: 0 of 49
Vertex 1 - excess: 25
Vertex 2 - excess: 25
Vertex 3 - excess: 0
Vertex 4 - excess: 0
Vertex 5 - excess: 0
Vertex 6 - excess: 0
Vertex 7 - excess: 0
Vertex 8 - excess: 0
Vertex 9 - excess: 0
Vertex 10 - excess: 0
Vertex 11 - excess: 0
Vertex 12 - excess: -100
Vertex 13 - excess: 0
Vertex 14 - excess: 0
Vertex 15 - excess: 0
Vertex 16 - excess: 0
Vertex 17 - excess: 0
Vertex 18 - excess: 0
Vertex 19 - excess: 0
Vertex 20 - excess: 25
Vertex 21 - excess: 0
Vertex 22 - excess: 0
Vertex 23 - excess: 25
Vertex 24 - excess: 0
Vertex 25 - excess: 0
Vertex 26 - excess: 0
Vertex 27 - excess: 0
Vertex 28 - excess: 0
Vertex 29 - excess: 0
Vertex 30 - excess: 0
Edge (6,28)
Edge (8,6)
Edge (11,30)
Edge (17,4)
Edge (18,7)
Edge (21,19)
Edge (22,19)
Edge (25,28)
Edge (27,8)
Vertex 1 - excess: 25
Vertex 2 - excess: 25
Vertex 3 - excess: 0
Vertex 4 - excess: 0
Vertex 5 - excess: 0
Vertex 6 - excess: 0
Vertex 7 - excess: 0
Vertex 8 - excess: 0
Vertex 9 - excess: 0
Vertex 10 - excess: 0
Vertex 11 - excess: 0
Vertex 12 - excess: -100
Vertex 13 - excess: 0
Vertex 14 - excess: 0
Vertex 15 - excess: 0
Vertex 16 - excess: 0
Vertex 17 - excess: 0
Vertex 18 - excess: 0
Vertex 19 - excess: 0
Vertex 20 - excess: 25
Vertex 21 - excess: 0
Vertex 22 - excess: 0
Vertex 23 - excess: 25
Vertex 24 - excess: 0
Vertex 25 - excess: 0
Vertex 26 - excess: 0
Vertex 27 - excess: 0
Vertex 28 - excess: 0
Vertex 29 - excess: 0
Vertex 30 - excess: 0
Edge (10,9)
Edge (14,25)
Edge (10,29)
Edge (16,4)
Edge (20,16)
Edge (15,16)
Edge (19,4)
Edge (15,3)
Edge (4,26)
Edge (2,15)
Edge (29,30)
Edge (24,14)
Edge (15,4)
Edge (1,15)
Edge (21,22)
Edge (20,21)
Edge (17,18)
Edge (25,29)
Edge (9,25)
Edge (24,9)
Edge (10,11)
Edge (11,12)
Edge (2,3)
Edge (3,24)
Edge (1,16)
Edge (16,19)
Edge (19,5)
Edge (5,17)
Edge (17,7)
Edge (7,27)
Edge (20,19)
Edge (23,3)
Edge (24,10)
Edge (27,6)
Edge (6,13)
Edge (8,28)
Edge (3,26)
Edge (26,8)
Edge (30,13)
Edge (28,30)
Edge (13,12)