Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
26 views

An Incremental Algorithm For The Maximum

The document discusses an incremental algorithm for solving the maximum flow problem in a network. It first provides background on sequential algorithms for maximum flow, including augmenting path and preflow push approaches. It then motivates incremental algorithms and proposes an efficient incremental implementation of maximum flow after inserting or deleting an edge in the network based on the preflow push approach.

Uploaded by

rmshewale24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

An Incremental Algorithm For The Maximum

The document discusses an incremental algorithm for solving the maximum flow problem in a network. It first provides background on sequential algorithms for maximum flow, including augmenting path and preflow push approaches. It then motivates incremental algorithms and proposes an efficient incremental implementation of maximum flow after inserting or deleting an edge in the network based on the preflow push approach.

Uploaded by

rmshewale24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Journal of Mathematical Modelling and Algorithms 2: 1–16, 2003.

1
© 2003 Kluwer Academic Publishers. Printed in the Netherlands.

An Incremental Algorithm for the Maximum


Flow Problem ⋆

S. KUMAR and P. GUPTA


Department of Computer Science and Engineering, Indian Institute of Technology Kanpur,
Kanpur-208 016, India. e-mail: pg@iitk.ac.in

(Received: 21 September 2001; in final form: 4 November 2002)


Abstract. An incremental algorithm may yield an enormous computational time saving to solve
a network flow problem. It updates the solution to an instance of a problem for a unit change in
the input. In this paper we have proposed an efficient incremental implementation of maximum
flow problem after inserting an edge in the network G. The algorithm has the time complexity of
O((n)2 m), where n is the number of affected vertices and m is the number of edges in the
network. We have also discussed the incremental algorithm for deletion of an edge in the network G.

Mathematics Subject Classifications (2000): 90B10, 90C27.

Key words: incremental computation, maximum flow, combinatorial optimization, network flows.

1. Introduction
Maximum flow problem with edge capacities is an interesting and well studied
problem in operation research and other fields [1]. The max-flow problem can be
defined as follows. Let G = (V , E) be a directed graph having a set V of n vertices
and a set E of m edges. There are two distinguished vertices in G: one is the source
vertex s, while other one is the sink vertex t. Further, a positive real-valued capacity
c(v, w) is associated with each edge (v, w). For simplicity, we assume zero valued
capacity for each nonexisting edge, i.e., c(v, w) = 0 if (v, w) ∈ / E. A flow on G is
a real valued function f on V × V if it satisfies the following three conditions:

f (v, w) = −f (w, v), ∀(v, w) ∈ V × V , (1)


f (v, w)  c(v, w), ∀(v, w) ∈ V × V , (2)

f (v, w) = 0, ∀v ∈ V − {s, t}. (3)
w

The net flow is the value |f | = v∈V f (v, t) of a flow f into the sink t. The
maximum flow problem is to find a flow from the source s to the sink t having the
maximum net flow.
⋆ This work has been done as a part of the project sponsored by Department of Science and
Technology, India.
2 S. KUMAR AND P. GUPTA

The well-known sequential algorithms are mainly based on two approaches.


The first approach commonly known as Augmenting path approach finds the suc-
cessive paths from the source to the sink and sends the flow from the source to the
sink satisfying mass balance constraint which implies that total incoming flow
at a vertex, except source and sink, is equal to the total outgoing flow at that
vertex. Following this approach the first algorithm for max-flow problem which
is designed by Ford and Fulkerson [6] finds repeatedly the augmenting paths in the
network and sends flow on that path satisfying the mass balance constraint. The
complexity of the algorithm is O(nmU) where U is the maximum capacity of any
edge in the network. In [5] Edmonds and Karp have also used this approach to
present another algorithm having the complexity of O(nm2 ). It has used the idea of
sending the flow with the available shortest path. Later Dinic [4] has improved the
time complexity of the algorithm due to Edmonds and Karp [5] by first computing
all the shortest paths in one phase. The complexity of the improved algorithm is
O(n2 m).
The second approach is preflow push approach that floods the network so that
some vertices have excess. By flooding we mean a vertex v sends its flow to other
vertices without looking for the mass balance constraint. An excess is defined as
the amount of flow by which the incoming flow at a vertex exceeds its outgoing
flow, i.e.
 
excess(v) = f (x, v) − f (v, x).
(x,v)∈E (v,x)∈E

Now, if at any vertex v, except source and the sink, the incoming flow exceeds the
outgoing flow then that vertex is termed as active vertex. This approach processes
these active vertices and relieve them from excess by pushing flow from vertex
toward the sink or toward the source vertex.
Based on this approach the generic preflow push algorithm having O(n2m) com-
plexity has been proposed by Goldberg and Tarjan [11]. The time complexity of the
algorithm depends the way of prcessing the active vertices. If the active vertices are
processed in First-In-First-Out order, the complexity is of O(n3 ). But if they √ are
processed in the order of their distance labels then the complexity is of O(n2 m).
Preflow push algorithm has the better time complexity than the augmenting path
algorithms.
The first parallel algorithm for the max-flow problem is due to Shiloach and
Vishkin [15]. They have used the idea of Dinic [4] to design the parallel algorithm
which takes O(n2 log n) using O(n) processors on CREW PRAM model. Gold-
berg and Tarjan [11] also presented the parallel version of preflow push algorithm
with the same complexity as that of Shiloach and Vishkin but √ with less space.
Later Goldberg [12] observed that there was a gap of O(n/ m log n) between
running time of one variation of the sequential push-relabel algorithm and the
processor-time product of the parallel algorithm of Goldberg and Tarjan [11]. He
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 3

has presented an algorithm


√ that reduces the gap with O(n2 log n) time complexity
but using only O( m) processors.
Many cases a change in an input may result a change in the corresponding
output. So, computing the whole output for this input needs some change in the
batch algorithm to concentrate on only these changes and compute the new output
efficiently. The incremental algorithm exactly does this. Formally, an incremental
algorithm is used for updating the solution of a problem when the problem under-
goes changes. For a problem P the incremental algorithm takes the ‘batch input’ x,
the ‘batch output’ P (x), possibly some auxiliary information and a description of
the ‘change in batch input’ x. The algorithm computes the ‘new batch output’
P (x + x), where x + x represents the modified input, and updates the auxiliary
information as necessary. To the best of our knowledge there does not exist any
efficient algorithm which finds the maximum flow of this modified network. In this
paper, we have proposed incremental algorithms to find the modified maximum
flow of a given network after insertion and deletion of an edge in the network.
The idea used here is based on the algorithm due to Goldberg and Tarjan [11].
We have discussed the algorithm and have presented some results in the next sec-
tion. Section 3 discusses the incremental algorithms for max-flow problem after
insertion and deletion of an edge. Experimental results are analysed in the next
section. Concluding remarks are given in the last section.

2. The Generic Preflow Push Algorithm


The generic preflow push algorithm [11] tries to find the maximum flow by manip-
ulating a preflow f on the network. A preflow f is a real-valued function on the
vertex pairs satisfying conditions (1) and (2) and the weaker form of condition (3)
which is as follows:

f (u, v)  0, ∀v ∈ V \{s}, (4)
u∈V

i.e. the total incoming flow in any vertex v ∈ V − {s} does not exceed the total
outgoing flow. Excess ef (v) of a vertex v is defined as the net flow into v. A vertex
v ∈ V − {s, t} with a positive excess (i.e. ef (v) > 0) is termed as an Active vertex.
The preflow push algorithm works by examining each of these active vertices and
pushing its excess towards one of its adjacent estimated to be closer to the sink t,
with the goal of getting as much excess as possible to t. If t is not reachable then
the excess is pushed back to the source by pushing the excess towards the vertex
estimated to be closer to the source. This estimation is done by using a distance
labelling which is described later. Finally the algorithm reaches a state where the
excess of each vertex (except the source and the sink vertices) is zero. At this point
preflow f becomes the maximum flow.
To find the vertices to which the excess will be pushed from a vertex the resid-
ual graph is used. Residual capacity rf (v, w) of an edge (v, w) with respect to a
4 S. KUMAR AND P. GUPTA

preflow f is defined as c(v, w) − f (v, w). Residual graph Gf (V , Ef ) with respect


to a preflow f is subset of the original graph G, with a vertex set V and has an
edge (v, w) if and only if rf (v, w) > 0. The algorithm to perform push the flow is
given below.

Push_Operation Algorithm

Push(v, w)
Applicability : v is active, rf (v, w) > 0 and, d(v) = d(w) + 1.
Action: Send δ = min{ef (v), rf (v, w)} units of flow from v to w as follows
f (v, w) ← f (v, w) + δ ; f (w, v) ← f (w, v) − δ ;
ef (v) ← ef (v) − δ ; ef (w) ← ef (w) + δ ;

In order to estimate the distance of a vertex from the source s or the sink t a valid
labeling d is used d(s) = n, d(t) = 0 and d(v)  d(w)+1, ∀(v, w) ∈ Gf (V , Ef ).
A distance label d(v) < n is the lower bound on the distance of v from t. While
d(v)  n means d(v) − n is the lower bound on the distance from v to s and t is
not reachable from v in residual graph Gf . The following algorithm performs the
relabel operation which may be used to maintain the distance labels.

Relabel_Operation Algorithm

Relabel(v)
Applicability : v is active and ∀w ∈ V , rf (v, w) > 0 ⇒ d(v)  d(w)
Action : relabel d(v) = min{d(w) + 1 : rf (v, w) > 0}

The generic preflow push algorithm begins with the preflow f that is equal to
the edge capacity on each edge leaving the source s and zero on all other edges,
and f with some initial sink labeling d. The algorithm repeatedly performs the
basic operations Push and Relabel. The basic operations modify the preflow f
and the labelling d. A push from v to w increases f (v, w) and ef (w) by δ =
min{ef (v), rf (v, w)} and decreases f (w, v) and ef (v) by the same amount. After
the push from v to w, if rf (v, w) = 0, then the push is termed as saturating push;
otherwise it is a non-saturating push. A relabeling of a vertex v sets its label, i.e.
d(v) equal to the largest value allowed by the valid labeling constraints. When there
does not exist any active vertices the algorithm terminates. The generic preflow
push algorithm is given below.
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 5

Generic preflow push Algorithm


Generic_preflow_push algorithm(v, E, s, t, c)
begin
<<Initialize Preflow >>
∀(v, w) ∈ (V − {s}) × (V − {s}) do begin
f (v, w) ← 0; f (w, v) ← 0;
end;
<< Initialize labels and excesses >>
d(s) ← n;
∀v ∈ V − {s} do begin
d(v) ← 0;
ef (v) ← f (s, v);
end
<< loop >>
while ∃ a basic operation that applies do
select a basic operation and apply it;
return(f );
end.

Once we have got the solution to an instance of the maxflow problem and the
final residual graph Gf for network G, we can have the following lemmas for the
unit change in G which is applicable for the residual graph Gf .

LEMMA 2.1. For some vertex v if d(v) < n in Gf , no extra flow can be sent from
the source s to the vertex v.
Proof. This can be proved by the method of contradiction. Let us assume that
we can send fa (s, v) units of flow from s to v. Since d(v) < n, there exists a
path from v to t in residual graph. Let the capacity of this path be bounded by
fa (v, t). So, we can now send δ = min{fa (s, v), fa (v, t)} from s to t. It means
the maximum flow calculated earlier by preflow push algorithm can be increased
by δ units. In that case the flow calculated is not the maximum flow. Hence, it is a
contradiction. ✷

LEMMA 2.2. For some vertex v if d(v)  n in Gf , no more flow can be sent from
the vertex v to the sink t.
Proof. This can again be proved by method of contradiction. Let us assume that
we can send fa (v, t) units of flow from v to t. Since v is at a distance n − d(v)
from s. There exists a path from s to v in the residual graph and let its flow capacity
be bounded by fa (s, v). So, we are now able to send δ = min{fa (s, v), fa (v, t)}
from s to t. In that case the maximum flow calculated is increased by δ. Thus the
6 S. KUMAR AND P. GUPTA

maximum flow calculated by preflow push algorithm is not maximum. Hence, it is


a contradiction. ✷

3. Incremental Algorithms
In this section we present incremental algorithms which update the solution of the
max-flow problem after a single edge is inserted or deleted into the edge set E
of the network G. Note that inserting (deleting) an edge is equivalent to increasing
(decreasing) the capacity of an edge. This is because of the fact that the insertion of
an edge can be considered as the special case of an edge capacity being increased
from 0 to a larger value and the increase in an edge capacity can be considered as
the insertion of a new edge parallel to the relevant edge. Similarly is the case of
deletion of an edge and decreasing the edge capacity.
Our algorithms work in two phases. Let us consider the case of inserting an
edge. When an edge v → w is inserted in the network there may exist new
augmenting paths from source to sink through which some more additional flow
can be sent. Let all the vertices which lie in at least one of these augmenting
paths be termed as affected vertices and form a set AFFECTED. In first phase we
generate the set AFFECTED. Next phase tries to use the Mod_Max-Flow algorithm
to route the additional flow through the augmenting paths consisting of these ver-
tices.

3.1. FINDING AFFECTED VERTICES


When a unit change δ is made to the original network G, the number of augmenting
paths in new network G + δ can vary. In case of insertion (deletion) of an edge the
number of augmenting paths can increase (decrease) in the new network G + δ as
compared to the number of augmenting paths in the original network G. One can
observe that that the change in the flow will be either routed from source to sink or
pushed back from sink to source through only these augmenting paths. The vertices
that constitute these augmenting paths are termed as affected vertices and form the
set AFFECTED.
When an edge is inserted in the network, the flow in the network may increase.
It can be easily observed that the change in the flow value, say f , will be passing
through this newly inserted edge and when f is added to previously computed
flow f it will give the max-flow in the modified network. Any flow in the network
starts from the source, passes through different vertices and finally reaches to the
sink. In our case the additional flow f starts from source passes through newly
inserted edge v → w and finally reaches to the sink. So, the affected vertices lie
on the augmenting paths from source to v and w to the sink. First set of affected
vertices from the source s to v can be found by the Backward Breadth First Search
(BBFS) algorithm from v to source while another set by the Forward Breadth First
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 7

Search (FBFS) algorithm from w to the sink t. As all the augmenting paths from u
to v will consist of edges with positive capacity, in BBFS (FBFS) from v to u
we take only the vertices which have an incoming (outgoing) edge with positive
capacity. Both BBFS and FBFS algorithms are given below and are illustrated later
with the help of examples.

BBFS Algorithm

BBFS(v, u)
Applicability : Find all the affected vertices from v to u
Action :
[1]WORKSET = {v}
[2]AFFECTED = {v}
[3]while(WORKSET = φ )do
[4]begin
[5] remove an element x from WORKSET
[6] if x = u break;
[7] for all edges (y → x) ∈ E(G) do
[8] begin
[9] if (c[y][x] > 0)do
[10] begin 
[11] AFFECTED = AFFECTED  {y}
[12] WORKSET = WORKSET {y}
[13] end
[14] end
[15] end

In case of deletion of an edge v → w, the flow in the network may decrease.


The flow will be affected on the edges that constitute the different augmenting
paths from source to sink that also contains the edge v → w. These vertices can
be found by the BBFS algorithm from v to source and by the FBFS algorithm from
sink to w.
Let us now analyze the complexity of finding the affected vertices. The loop
in lines 3–15 of the BBFS algorithm and the FBFS algorithm performs exactly
|AFFECTED| iterations, once for each affected vertex x. The iteration corresponding
to vertex x takes O(|Pred(x)|) time in case of BBFS and O(|Succ(x)|) in case
of the FBFS algorithm. Consequently, the running time of the BBFS algorithm
and the FBFS algorithm are O( x∈AFFECTED |Pred(x)|) = O(||AFFECTED||← ) and

O(||AFFECTED||→ ) respectively.
8 S. KUMAR AND P. GUPTA

FBFS Algorithm

FBFS(v, u)
Applicability : Find all the affected vertices from v to u
Action :
[1]WORKSET = {v}
[2]AFFECTED = {v}
[3]while(WORKSET = φ )do
[4]begin
[5] remove an element x from WORKSET
[6] if x = u break;
[7] for all edges (x → y) ∈ E(G) do
[8] begin
[9] if (c[x][y] > 0)do
[10] begin 
[11] AFFECTED = AFFECTED  {y}
[12] WORKSET = WORKSET {y}
[13] end
[14] end
[15]end

3.2. INSERTION OF AN EDGE


Observe that after insertion of an edge v → w in G there is a possibility of increase
in the maximum flow and any such increase δ is passing through the inserted edge
v → w. In this subsection we propose an efficient incremental algorithm which
finds the modified value of maximum flow.
With the preflow push algorithm, the idea is to flood minimum number of ver-
tices of G with excess of flow and later relieve these vertices from the excess.
Flooding means that a vertex x tries to push as much flow as it can towards an
admissible edge x → y (by admissible we mean that the difference of the distance
labels of x and y may vary by 1). The vertices to be flooded should be chosen
in such a way that they may be able to route the maximum additional flow to the
sink. When this additional flow is added to the previously computed maximum
flow, it should be able to generate the true value of maximum flow in the new
network. These vertices are termed as affected vertices. Then the additional flow
is to be routed through these vertices. As in case of basic preflow push algorithm
where the flow from a vertex is pushed towards to the vertex estimated to be closer
to the sink or the source, our algorithm also does the same thing but the flow is
pushed towards one of the affected vertices estimated to be closer to the sink or the
source. This estimation is done by using the distance labels. There exist basically
two problems with this approach, and they are (i) finding the affected vertices and
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 9

(ii) maintaining distance labels of the affected vertices in the new network. Now,
we have the following observations.
(1) Each flow starts from the source s and passes through v in route to the sink t.
Flow on other vertices that do not lead to v are useless because they return to
the source.
(2) From Lemma 2.1, from s to v, the vertices x with a distance label d(x)  n
are the actual candidates to be in the set of affected vertices.
(3) From Lemma 2.2, from w to t, the vertices x with distance label d(x) < n are
the actual candidates to be in the set of affected vertices.
(4) An edge x → y can route the additional flow if it has a positive residual
capacity (i.e., c(x, y) − f (x, y) > 0).
Based on the above observations, we can find the set AFFECTED from v to source
by invoking the BBFS algorithm with the arguments v and s and by adding two
more constraints d(x)  n and c(x, y) − f (x, y) > 0 at line 9 of the BBFS algo-
rithm. Similarly the affected vertices from w to sink t can be found and appended
in the set AFFECTED by invoking the FBFS algorithm with two arguments w and
sink t and by adding two more constraints d(x)  n and c(x, y) − f (x, y) > 0 at
line 9 of the FBFS algorithm.
In order to maintain the distance labels of each affected vertices we follow the
idea of the preflow push algorithm. The distance label of the source is initialized
to n and for all other affected vertices it is initialized to zero; i.e. d(s) = n and,
d(x) = 0, ∀x ∈ AFFECTED − {s}. For every residual edge (x, y) the distance label
in the intermediate residual graph is set as,

 = n, if x = s,

d(x) = 0, if d = t,

  d(y) + 1, otherwise.
The incremental algorithm first finds the affected vertices by calling the
BBFS(v, source) algorithm and the FBFS(w, sink) algorithm and then initial-
izes the preflow f by residual edge capacity on each edge leaving the source
to the affected vertices and zero on all other edges. This can be done by the
Mod_Preprocess algorithm as given below.
Mod_Preprocess Algorithm
Mod_Preprocess
Application : Initialize the additional preflow and distance label of all
vertices v ∈ AFFECTED
Action :
begin
compute the exact distance labels for all vertices i ∈ AFFECTED
f (s, j ) = f (s, j ) + rf (s, j )∀(s, j ) ∈ A(s) with j ∈ AFFECTED
d(s) = n
end
10 S. KUMAR AND P. GUPTA

The algorithm then follows the approach of basic preflow push algorithm. It
performs the basic operations, Push and Relabel. We modify the basic preflow
algorithm and design the Mod_Push_Relabel algorithm so that these operations
apply only on the affected vertices. The algorithm is given below.
Mod_Push_Relabel Algorithm

Mod_Push_Relabel(i)
begin
if (∃ (i, j ) ∈ Ef , j ∈ AFFECTED) do
begin
push δ = min{e(i), rf (i, j )} from i to j
f (j, i) = f (j, i) − δ; f (i, j ) = f (i, j ) + δ;
e(j ) = e(j ) + δ; e(i) = e(i) − δ
end
else
begin
replace d(i) by min{d(j ) + 1 : (i, j ) ∈ A(i) ∋ j ∈ AFFECTED &
rf (i, j ) > 0}
end
end

Finally the Mod_Maxflow algorithm which is given below, goes on applying


these two modified operations on the active vertices. The algorithm terminates
when there are no more active vertices. At that moment the addition flow f ,
if any, is added to the previously computed maximum flow f which gives the
maximum flow (f + f ) in the modified network. As the number of affected
vertices is n, the complexity of this algorithm is O((n)2m).
Mod_Maxflow Algorithm
Mod_Maxflow
begin
insert v → w into E(G)
if ((d(v)  n) & (d(w) < n)) do
begin
BBFS(v, s)
FBFS(w, t)
Mod_Preprocess()
while(there exists an active vertex) do
begin
select an active vertex i
Mod_Push_Relabel(i)
end
end
end
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 11

Figure 1. Original network and the network after computing max-flow.

3.3. AN EXAMPLE
Let us consider an example to illustrate the incremental algorithm. Let G be the
original graph in Figure 1 with 7 vertices. let 1 be the source and 7 be the sink. The
figure also shows the residual graph G′ of G after calculating the max-flow. The
max-flow value in G is 20 units.
Now, suppose we insert the edge 3 → 5 in G with capacity of 10 units and we
like to compute the maxflow. First we find the affected vertices. As the distance
label of 3 is 8 which is greater than 7. Again the distance label of 5 is 1 and is
less than 7. So, there is a change in max-flow value in G. We find the affected
vertices by invoking the BBFS algorithm from 3 to 1. The set AFFECTED after this
phase consists 3 and, 1. Then the FBFS algorithm from 5 to 7 has been invoke
to include vertices 5 and 7 in the set AFFECTED. Now, the algorithm starts with a
preflow of 5 units from 1 to 3 and the set active consists 3. The algorithm stops
with an additional flow of 5 units. The overall max-flow in G is 25 units which
is same as the max-flow calculated by the generic preflow push algorithm in the
modified graph.

3.4. DELETION OF AN EDGE


In this section we have discussed an incremental algorithm to find the maximum
flow in the network after deleting an edge v → w in G. Note that if the maximum
flow moves through w, then only there is a possibility of changing the max-flow
due to the deletion of the edge v → w. Since the edge v → w is deleted, the flow
f (v, w) on this edge becomes zero. The flow f (v, w) calculated in the original
graph G must be pushed back to v and we should try to push much of the excess
at v towards t using alternate augmenting paths in the modified graph G′ . But, the
flow f (v, w) in G might be passing through different edges constituting different
augmenting paths from v to t. As the original flow is passing through different
augmenting paths and the edge v → w might be one of the edges in some of
these augmenting paths. Flow on all these augmenting paths may change due to the
deletion. We need to recalculate the new flow on all the edges constituting these
augmenting paths. Further, there can be some augmenting paths from v to t which
do not contain the edge v → w and are not saturated. So we can try to push the
12 S. KUMAR AND P. GUPTA

flow f (v, w) through these augmenting paths which may change the flow value on
these edges. To calculate the new value of flow on these two set of edges, the flow
is pushed from t to v on augmenting paths having the edge v → w and this flow
is to be subtracted from excess(t). We start the Mod_Push_Relabel algorithm with
set ACTIVE having two vertices v and w and try to push their excesses towards t
and s. Thus there are three processes to be performed – (i) Pushing flow from t
to w, (ii) Pushing flow from w to v and (iii) Pushing flow from v and w towards t
and s.
For the first process we use the graph GR obtained by reversing all the residual
edges in graph G. However, there is no need explicitly to construct the graph GR .
With this graph the basic preflow push problem remains same except with the new
source t and the sink w. Since not all the vertices constitute the augmenting paths
from t to w, we need to push this flow to the vertices which are on the augmenting
paths from t to w. For this, the FBFS algorithm is invoked with two arguments w
and t. As the flow will be returned only through the edges which have a positive
incoming flow, the constraint f (x, y) > 0 can be added at line 9 of the FBFS
algorithm.
Consider one such subproblem which is to push flow from t to w. We need
new set of distance labels d ′ to find the vertices estimated closer to w from t
in GR . These distance labels are initialized to zero except t and d ′ (t) is initial-
ized to |n|. The Mod_Push_Relabel algorithm modifies these distance labels to
give exact distance from t to w and pushes the flow from t to w. The algorithm
starts with pushing f (x, t) amount of flow from t to each incoming vertex x
such that (x, t) ∈ E(G). All these vertices x are added in the set ACTIVE. The
Mod_Push_Relabel algorithm is operated on this set ACTIVE until this set is empty.
Once the flow is pushed to the vertex w, this excess is sent to v; i.e., f (v, w)
amount of flow is sent from w to v. Then the edge v → w is deleted and flow on
this edge becomes zero. Observe that in case the distance label of v, i.e. if d(v)  n
then t is not reachable from v. In this case the excess at v simply routes back to s.
The different vertices that constitute augmenting paths from v to t and v to w are
found. Let these vertices be termed as affected vertices. If d(v)  n then we need
not to find the affected vertices from v to t. This can be done by using the FBFS
algorithm with arguments v and t and the BBFS algorithm with arguments v and s.
We have already calculated the set AFFECTED for vertex w. Observe that there are
two sets of AFFECTED; one is for v and other for w. To avoid working with these two
sets of AFFECTED at a time, we can first initiate the Mod_Push_Relabel algorithm
with set ACTIVE consisting w only.
After pushing flow from w to t and adding this new flow to excess of t, the
Mod_Push_Relabel algorithm with set ACTIVE consisting of vertex v is invoked.
The flow pushed towards t is added to excess of t to give the new value of max-
flow. Rest of the excess is pushed back to s. The incremental algorithm to find the
maximum flow in the network after deleting an edge v → w in G is given below.
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 13

As the number of affected vertices is n, we can easily show that like insertion
algorithm, the time complexity of this algorithm is also O((n)2m).

Mod_Maxflow_Deletion Algorithm

Mod_Maxflow_Deletion
begin
if (f [v][w] <> 0) then
begin
FBFS(w, t)
reverse the graph G. Let it be GR
assign a label 0 to distnace label set d ′ to all affected vertices
except the vertex t in GR
assign a label equal to the number of affected vericies to t in GR
Mod_Push_Relabel(w) in GR
delete v → w from E(G)
BBFS(v, s )
initialize label of distance label set d of all affected verticies to 0 in G
Mod_Push_Relabel(w)
Mod_Push_Relabel(v)
end
end

4. Experimental Results
In this section we are presenting some experimental results. We have collected dif-
ferent set of experimental data for different networks. The networks are generated
randomly. Further, we have considered the cases only when there is a change in
max-flow after inserting an edge.
Basically, Ev-ratio is the ratio of the number of edges to total number of ver-
tices in G. Observe that in both the algorithms, push and relabel are the two basic
operations. We have counted the number of each of these operations that are used
by each algorithm for the network of different sizes. Let N-Push, N-Relabel be
the number of push and relabel operations performed by the FIFO preflow-push
algorithm [11] and I-Push, I-relabel be the number of corresponding operations
performed by our incremental algorithm. Our algorithm first tries to find the af-
fected vertices on which these operations are performed. Let NAV be the number
of affected vertices. Av-ratio is used to denote the ratio of Number of affected
vertices to the total number of vertices in G. The Gain of our algorithm w.r.t. the
original graph may be defined as follows:

I-Push + I-Relabel
Gain = 1 − .
N-Push + N-Relabel
14 S. KUMAR AND P. GUPTA

Table I. Av-ratio and Gain for 500 vertices

NV Ev-ratio N-Push N-Relabel NAV I-Push I-Relabel Av-ratio Gain

500 2 24 24 170 14 14 0.3400 0.4167


500 3 13432 11201 236 8602 7201 0.4720 0.3585
500 4 148 132 272 102 91 0.5440 0.3107
500 5 120132 103481 314 88895 76576 0.6280 0.2601
500 6 168 122 372 133 97 0.7480 0.2069
500 7 101121 100342 459 90361 90348 0.9180 0.1030
500 8 407 369 496 374 342 0.9920 0.0773
500 9 1386 1201 500 1379 1204 1.0000 0.0015

Table II. Av-ratio and Gain for 1000 vertices

NV Ev-ratio N-Push N-Relabel NAV I-Push I-Relabel Av-ratio Gain

1000 2 9451 7386 105 98 85 0.1050 0.9891


1000 3 320632 220875 322 80883 55459 0.3220 0.7482
1000 4 575389 403975 405 197802 137364 0.4050 0.6578
1000 5 1083451 875648 522 436332 301916 0.5230 0.5601
1000 6 1121815 906731 623 620734 413823 0.6220 0.4912
1000 7 1161824 940121 668 765107 411981 0.6450 0.4401
1000 8 1220121 987822 701 719391 588593 0.7010 0.4077
1000 9 1256421 1014701 722 832765 603037 0.7220 0.3679
1000 10 1138537 940185 732 773296 630093 0.7320 0.3249
1000 11 1009561 876543 753 754811 542933 0.7530 0.3120
1000 12 45673 34523 768 34149 21627 0.7680 0.3046
1000 13 92778 83456 784 72460 52471 0.7840 0.2912
1000 14 1408616 1134022 810 850421 735129 0.8100 0.2764
1000 15 1104317 1014312 822 950162 716242 0.8220 0.2735
1000 16 1202001 1000246 836 930499 763622 0.8360 0.2307
1000 17 1206062 965487 876 996237 797596 0.8760 0.1732
1000 18 1001044 983212 910 990132 797767 0.9100 0.1205
1000 19 1141622 961122 930 1020142 93422 0.9300 0.1004
1000 20 1153742 970540 972 1073741 904837 0.9720 0.0686

We have tested and compared our algorithm with the FIFO preflow push algo-
rithm [11] on random graphs for NV number of vertices and Ev-ratio×NV number
of edges where NV = 100, 200, . . . , 1000 and Ev-ratio = 2, 3, 4, 5, . . . . Here we
have shown the results for the random graphs with 500 and 1000 vertices. We create
Tables I and II which give the information about affected vertex ratio and gain for
different Ev-ratio in a network with 500 and 1000 vertices, respectively. Using
AN INCREMENTAL ALGORITHM FOR THE MAXIMUM FLOW PROBLEM 15

Figure 2. Av-ratio vs Ev-ratio for 500 and 1000 vertices.

Figure 3. Gain vs Ev-ratio for 500 and 1000 vertices.

these tables we obtain two graphs – (i) Av-ratio vs Ev-ratio as shown in Figure 2
and (ii) Gain vs Ev-ratio as shown in Figure 3. Observe that Gain is more when
NAV is less. Both I-Push and I-Relabel go on increasing for increasing number of
Ev-ratio. As NAV tends to the total number of vertices in the network, Av-ratio
tends to 1 and Gain is reduced to zero.

References
1. Ahuja, R. K., Magnati, T. and Orlin, J. B.: Network Flows, Prentice-Hall, Englewood Cliffs,
1993.
2. Cheriyan, J. and Maheshawari, S. N.: Analysis of preflow push algorithms for maximum
network flow, SIAM J. Comput. 18 (1989), 1057–1086.
16 S. KUMAR AND P. GUPTA

3. Cherkasky,
√ R. V.: An algorithm for constructing maximum flows in networks with complexity
of O(V 2 (E)), Math. Methods Solution Econ. Probl. 7 (1977), 112–125.
4. Dinic, E. A.: Algorithm for solution of a problem of a maximum flow in networks with power
estimation, Soviet Math. Dokl. 11 (1970), 1277–1280.
5. Edmonds, J. and Karp, R. M.: Theoretical improvements in algorithmic efficiency for network
flow problems, J. Assoc. Comput. Mach. 19 (1972), 248–264.
6. Ford, L. R. and Fulkerson, D. R.: Maximal flows through a network, IRE Trans. Inform. Theory
2 (1956), 117–119.
7. Gabow, H. N.: Scaling algorithms for network problems, J. Comput. System Sci. 31 (1985),
148–168.
8. Galil, Z.: An O(V 5/3 E 2/3 ) algorithm for the maximum flow problem, Acta Inform. 14 (1980),
221–242.
9. Galil, Z. and Naamad, A.: An O(EV (log V )2 ) algorithm for the maximum flow problem,
J. Comput. System Sci. 21 (1980), 203–217.
10. Goldberg, A. V.: A new max-flow algorithm, Tech. Rep. MIT/LCS/TM-291, Laboratory for
Comp. Sci., MIT, Cambridge, Mass., 1985.
11. Goldberg, A. V. and Tarjan R. E.: A new approach to the maximum flow problem, J. Assoc.
Comput. Mach. 35 (1988), 921–940.
12. Goldberg, A. V.: Processor efficient implementation of a maximum flow algorithm, Inform.
Process. Lett. 38 (1991), 179–185.
13. Karzanov, A. V.: Determining the maximal flow in a network by the method of preflows, Soviet
Math. Dokl. 15 (1974), 434–437.
14. Malhotra, V. M., Kumar, P. and Maheshwari, M. N.: An O(|V |3 ) algorithm for finding
maximum flows in networks, Inform. Process. Lett. 57 (1978), 1251–1254.
15. Shiloach, Y. and Vishkin, U.: An O(n2 log n) parallel max-flow algorithm, J. Algorithms 3
(1982), 128–146.
16. Tarjan, R. E.: A simple version of Karzanov’s blocking flow algorithm, Oper. Res. Lett. 2 (1984)
265–268.
17. Goldberg, A. V. and Tarjan, R. E.: A new approach to the maximum flow problem, Proc. 18th
ACM Sympos. Theory of Computing, ACM, New York, 1986, pp. 136–146.
18. Yang, H. H. and Wang, D. F.: Processor efficient implementation of a maximum flow algorithm,
IEEE Trans. CAD 15 (1996), 1533–1540.

You might also like