Almost Linear Time Algorithms For Some Problems On
Almost Linear Time Algorithms For Some Problems On
5.1 Introduction
Recently, many parts of the world have been affected by disasters including earth-
quakes, nuclear plant accidents, volcanic eruptions, and flooding, highlighting the
urgent need for orderly evacuation planning. One powerful tool for evacuation plan-
ning is the dynamic flow model introduced by Ford and Fulkerson [10], which repre-
sents movement of commodities over time in a network. In this model, we are given a
graph with source vertices and sink vertices. Each source vertex is associated with a
positive weight, called a supply; each sink vertex is associated with a positive weight,
called a demand; and each edge is associated with a positive length and capacity.
An edge capacity limits the amount of supply that can enter the edge per unit time.
One variant of the dynamic flow problem is the quickest transshipment problem, in
which the objective is to send exactly the right amount of supply out of sources into
sinks while satisfying demand constraints in the minimum overall time. Hoppe and
Tardos [17] provided a polynomial time algorithm for this problem in the case where
the transit times are integral. However, the complexity of their algorithm is very high.
Finding a practical polynomial time solution to this is still an open problem. Readers
are referred to a recent survey by Skutella [20] on dynamic flows.
This chapter discusses related problems called k-sink problems [3, 5–9, 14–16,
18], in which the objective is to find the locations of k sinks in a given dynamic
flow network so that all the supply is sent to the sinks as quickly as possible. The
following two criteria can be naturally considered for determining the optimality of
the locations: minimization of evacuation completion time and aggregate evacuation
time (i.e., average evacuation time). We call the k-sink problem that requires finding
the locations of k sinks that minimize the evacuation completion time (resp., the
aggregate evacuation time) the minmax (resp., minsum) k-sink problem. Although
several papers have studied minmax k-sink problems in dynamic flow networks [3,
7–9, 14, 15, 18], minsum k-sink problems in dynamic flow networks have not been
studied except for the case of path networks [5, 6, 15, 16].1 Tables 5.1 and 5.2
summarize the previous results for the minmax k-sink problems and the minsum
k-sink problems, respectively.
There are two models for the evacuation method. Under the confluent flow model,
all the supply leaving a vertex must evacuate to the same sink through the same
edges, and under the non-confluent flow model, there is no such restriction. To our
knowledge, almost all of the papers that deal with the k-sink problems [3, 5–9, 15]
adopt the confluent flow model, while only one paper [16] handles both of the models.
Although it may seem natural to model the evacuation behavior of people by
treating each supply as a discrete quantity as in [17, 18], almost all of the previous
papers on sink problems [3, 7–9, 14–16] have treated each supply as a continuous
1 Note that the minsum 1-sink problem in general networks can be solved in polynomial time
by applying the following two facts: (1) Baumann and Skutella [2] provided a polynomial time
algorithm for the problem of computing a dynamic flow to a fixed sink in a general network while
minimizing the aggregate evacuation time. (2) For the minsum 1-sink problem in general networks,
one can prove that there exists an optimal sink located at a vertex in a similar manner to the
well-known node optimality theorem for the 1-median problem [12].
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 67
quantity since it is easier to treat the problems mathematically and the effect is
negligible when the number of people is large. Throughout this chapter, we adopt
the model with continuous supplies.
We also give an overview of two of our recent results [7, 16] on the problems
of locating multiple sinks on dynamic flow path networks such that the max/sum of
evacuation times for all the people to sinks is minimized, and we focus on algorithmic
frameworks that enable solving the problems in almost linear time.
5.2 Preliminaries
For two real values a, b with a < b, let [a, b] = {t ∈ R | a ≤ t ≤ b}, [a, b) =
{t ∈ R | a ≤ t < b}, (a, b] = {t ∈ R | a < t ≤ b}, and (a, b) = {t ∈ R | a < t <
b}, where R is the set of real values. For two integers i, j with i ≤ j, let [i.. j] = {h ∈
Z | i ≤ h ≤ j}, where Z is the set of integers. A dynamic flow path network P is given
as a 5-tuple (P, w, c, l, τ ), where P is a path with vertex set V = {vi | i ∈ [1..n]} and
edge set E = {ei = (vi , vi+1 ) | i ∈ [1..n − 1]}, w is a vector w1 , . . . , wn of which
each component wi is the weight of vertex vi representing the amount of supply (e.g.,
the number of evacuees or cars) located at vi , c is a vector c1 , . . . , cn−1 of which
each component ci is the capacity of edge ei representing the upper bound on the
flow amount that can enter ei per unit time, l is a vector 1 , . . . , n−1 of which each
component i is the length of edge ei (i.e., the distance between two end vertices of
ei ), and τ is the time taken for unit supply to move unit distance along any edge.
We say that a point p lies on path P = (V, E), denoted by p ∈ P, if p lies on
a vertex v ∈ V or an edge e ∈ E. We assume that path P can be represented by a
horizontal line segment along which the vertices v1 , v2 , . . . , vn are arranged in order
from left to right. For two points p, q ∈ P, p ≺ q means that p lies to the left side of q.
For two points p, q ∈ P, p q means that p ≺ q or p and q lie at the same location.
For two points p, q ∈ P such that p q, p divides an edge (vi , vi+1 ) in the ratio
r p : 1 − r p , and q divides an edge (v j , v j+1 ) in the ratio rq : 1 − rq , let L( p, q) be the
j−1
distance between p and q, that is, L( p, q) = (1 − r p )i + rq j + h=i+1 h (where
i i−1
h=i+1 h = 0 and h=i+1 h = −i ). Let us consider two integers i, j ∈ [1..n]
with i < j. We denote by Pi, j a subpath of P from vi to v j , and by Pi, j a subnetwork
68 Y. Higashikawa et al.
of P consisting of subpaths Pi, j . Let L i, j be the distance between vi and v j , that is,
j−1
L i, j = h=i h , and let Ci, j be the minimum capacity among all the edges between
vi and v j , that is, Ci, j = min{ch | h ∈ [i.. j − 1]}. For i ∈ [1..n], we denote the sum of
weights from v1 to vi by Wi = ij=1 w j . Note that, given a dynamic flow path network
P, if we construct two lists of Wi and L 1,i for all i ∈ [1..n] in O(n) preprocessing
time, we can obtain Wi for any i ∈ [1..n] and L i, j = L 1, j − L 1,i for any i, j ∈ [1..n]
with i < j in O(1) time. In addition, Ci, j for any i, j ∈ [1..n] with i < j can be
obtained in O(1) time with O(n) preprocessing time, which is known as the range
minimum query [1, 4].
A k-sink x is a k-tuple (x1 , . . . , xk ) of points on P such that xi ≺ x j for any i < j.
We assume that no two sinks lie on the same edge.2 We define the function Id for
point p ∈ P as follows: the value Id( p) is an integer such that vId( p) p ≺ vId( p)+1
holds, that is, if p lies on edge (vi , vi+1 ) or at vertex vi , Id( p) = i. A divider d is
a (k − 1)-tuple (d1 , . . . , dk−1 ) of real values such that 0 ≤ di < d j ≤ Wn for any
i < j. A pair (x, d) is called valid if and only if WId(xi ) ≤ di ≤ WId(xi+1 ) holds for
any i. A valid pair (x, d) determines what amount of supply from which vertex flows
to which sink so that the portion di − di−1 of supply is assigned to flow to sink xi ,
where d0 = 0 and dk = Wn . More precisely, given a valid pair (x, d), the portion
WId(xi ) − di−1 of supply that originates from the left side of xi flows to sink xi , and
the portion di − WId(xi ) of supply that originates from the right side of xi also flows to
sink xi . For instance, under the non-confluent flow model, if Wh−1 < di < Wh where
h ∈ [1..n], the portion di − Wh−1 of the wh supply at vh flows to sink xi and the rest
of the Wh − di supply flows to sink xi+1 . The difference between the confluent flow
model and the non-confluent flow model is that the confluent flow model requires
that each value di of a divider d must take a value in {W1 , . . . , Wn }, whereas the
non-confluent flow model does not. For a dynamic flow path network P and a valid
pair (x, d), the evacuation completion time CT(P, x, d) is the time at which all the
supply completes the evacuation. The aggregate evacuation time AT(P, x, d) is the
sum of the evacuation completion time for all the supply. Explicit definitions of these
are given in Sect. 5.3.
Suppose that we are given a divider d = (d1 , . . . , dk−1 ). This d implies that we have
k 1-sink subproblems. The ith subproblem consists of a subnetwork Ph,h such that
the weight of v j is w j for j ∈ [h + 1..h − 1], while those of vh and vh are Wh − di−1
and di − Wh −1 , respectively, where Wh−1 < di−1 ≤ Wh and Wh −1 < di ≤ Wh . To
explicitly define the evacuation completion time and the aggregate evacuation time,
2 It turns out that this assumption does not result in a loss of generality once the cost function is
introduced later. If some adjacent two sinks xi and xi+1 lie on edge (v j , v j+1 ), that is, v j ≺ xi ≺
xi+1 ≺ v j+1 , moving xi to v j or moving xi+1 to v j+1 does not increase the cost.
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 69
we first consider the case of the 1-sink problem, and then extend the argument to the
general case of the k-sink problem.
Using these, the evacuation completion time CT(P, (x), ()) is given by
CT(P, (x), ()) = max θ x,+ (Wn ), θ x,− (0) . (5.3)
We can generalize formulae (5.1) and (5.2) to the case of any z ∈ [0, Wn ] as follows:
and
70 Y. Higashikawa et al.
Fig. 5.1 The blue (resp., red) thick half-open segments indicate the function θ x,+ (z) (resp.,
θ x,− (z)). The gray area indicates AT(P , (x), ())
Then, the aggregate evacuation times for the supply on the right and left sides of x
are
Wn Wi
θ (z)dz and
x,+
θ x,− (z)dz,
Wi 0
respectively. Thus, the aggregate evacuation time AT(P, (x), ()) is given by
Wi Wn
AT(P, (x), ()) = θ x,− (z)dz + θ x,+ (z)dz. (5.8)
0 Wi
where d0 = 0 and dk = Wn . The aggregate evacuation times for the supply on the
right and left sides of xi are
di WId(xi )
xi ,+
θ (z)dz and θ xi ,− (z)dz,
WId(xi ) di−1
where d0 = 0 and dk = Wn .
In this section, we consider the minmax k-sink problems on path networks under the
confluent flow model, which is precisely defined as
(Minmax-k-Sink-Path-Confluent-Flow)
Input: A dynamic flow path network P = (P, w, c, l, τ ).
Goal: Find a solution (x, d) to the problem
min. CT(P, x, d)
s.t. x = (x1 , . . . , xk ) ∈ P k , x h ≺ xl ∀h < l,
d = (d1 , . . . , dk−1 ) ∈ {Wh | h ∈ [1..n]}k−1 , WId(xh ) ≤ dh ≤ WId(xh+1 ) ∀h.
algorithm based on the parametric search method, and the other is an O(n log3 n)
time algorithm based on the sorted matrix method.
Both algorithms require repeatedly solving the problems of locating 1-sink for
multiple choices of different subnetworks. Note that the optimal solution for the prob-
lem of locating 1-sink on Pi, j is a point x ∗ that minimizes the following expression
over x ∈ Pi, j
CT(Pi, j , (x), ()) = max θ x,+ (W j ), θ x,− (Wi−1 ) . (5.11)
Both algorithms also require repeatedly performing feasibility tests for multiple
choices of different subnetworks. We say that Pi, j is (t, q)-feasible if and only if
the answer of the following decision problem is “yes”:
(Feasibility-Test-for-Subpath)
Input: A dynamic flow path network P = (P, w, c, l, τ ), a positive real t ∈ R+ ,
integers q, i, j satisfying q ∈ [1..k] and i, j ∈ [1..n] with i < j.
Goal: Determine whether there exists a pair of vectors (x , d ) such that
CT(Pi, j , x , d ) ≤ t,
q
x = (x1 , . . . , xq ) ∈ Pi, j , x h ≺ xl ∀h < l,
d = (d1 , . . . , dq−1 ) ∈ {Wh | h ∈ [i.. j]}
q−1
, WId(xh ) ≤ dh ≤ WId(xh+1 ) ∀h.
Note that [7] developed a data structure called the CUE tree to efficiently compute
θ x,− (Wi−1 ) and θ x,+ (W j ) for any integers i, j ∈ [1..n] with i < j and any x ∈ Pi, j .
For the case of general edge capacities, the CUE tree can be constructed in O(n log n)
time, and θ x,− (Wi−1 ) and θ x,+ (W j ) can be computed in O(log2 n) time by using the
CUE tree. See [7] for more detail.
Lemma 5.1 ([7]) Given a dynamic flow path network P = (P, w, c, l, τ ) with n
vertices, the CUE tree can be constructed in O(n log n) time. Moreover, if the capac-
ities of P are uniform, the CUE tree can be constructed in O(n) time.
Lemma 5.2 ([7]) Given a dynamic flow path network P = (P, w, c, l, τ ) with n
vertices, suppose that the CUE tree is available. Then, for any integers i, j ∈ [1..n]
with i < j and any x ∈ Pi, j , θ x,− (Wi−1 ) and θ x,+ (W j ) can be computed in O(log2 n)
time. Moreover, if the capacities of P are uniform, θ x,− (Wi−1 ) and θ x,+ (W j ) can be
computed in O(log n) time.
In the rest of this section, we first describe how feasibility tests are performed
in Sect. 5.4.1 and how the 1-sink problem for a subnetwork is solved in Sect. 5.4.2,
and then show the frameworks of the parametric search method in Sect. 5.4.3 and the
sorted matrix method in Sect. 5.4.4.
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 73
Lemma 5.3 ([7]) Given a dynamic flow path network P = (P, w, c, l, τ ) with n
vertices, suppose that the CUE tree is available. For integers q, i, j satisfying
q ∈ [1..k] and i, j ∈ [1..n] with i < j, the (t, q)-feasibility of Pi, j can be tested
in O(min{n log2 n, k log3 n}) time. Moreover, if the capacities of P are uniform, the
(t, q)-feasibility of Pi, j can be tested in O(min{n, k log n}) time.
Proof We prove only the case of general capacities. For the case of uniform capacity,
see [7].
To determine the (t, q)-feasibility of Pi, j , we first place the sinks consecutively
from left to right as far to the right as possible. We then compute the maximum
integer h such that θ vh ,− (Wi−1 ) ≤ t and θ vh+1 ,− (Wi−1 ) > t holds. Next, we solve
for α. If α < 1, we move the leftmost sink x1 to the point that divides edge eh =
(vh , vh+1 ) at a ratio of 1 − α : α, otherwise we place x1 at vh . We then compute the
maximum integer l1 such that θ x1 ,+ (Wl1 ) ≤ t and θ x1 ,+ (Wl1 +1 ) > t holds. We thus
determine the maximal subnetwork Pi,l1 such that CTOPT (1, i, l1 ) ≤ t. In the same
manner, we repeatedly isolate the maximal subnetworks Pi,l1 , Pl1 +1,l2 , Pl2 +1,l3 , . . .,
and if the qth subnetwork is found to have lq < j, then Pi, j is not (t, q)-feasible,
otherwise it is (t, q)-feasible.
Let us now look at the time complexity. Isolating Pi,l1 consists of (a) computing
h, (b) solving the equation for α, and (c) computing l1 . Obviously (b) takes O(1)
time. For (a), applying a binary search takes O(log3 n) time because we compute
θ va ,− (Wi−1 ) over a ∈ [i.. j] O(log n) times and each θ va ,− (Wi−1 ) can be computed in
O(log2 n) time using the CUE tree by Lemma 5.2. Similarly (c) takes O(log3 n) time
by binary search. In this way, we can isolate at most q subnetworks in O(q log3 n) =
O(k log3 n) time. However, if we simply scan from left to right instead of using
a binary search for (a) and (c), that is, if we compute θ va ,− (Wi−1 ) for a = i, i +
1, . . . , h, h + 1 and θ x1 ,− (Wb ) for b = h + 1, h + 2, . . . , l1 , l1 + 1, it takes O((l1 −
i) log2 n) time to determine Pi,l1 . In this way, we can isolate at most p subnetworks
in O(( j − i) log2 n) = O(n log2 n) time.
74 Y. Higashikawa et al.
Lemma 5.4 ([7]) Given a dynamic flow path network P = (P, w, c, l, τ ) with n
vertices, suppose that the CUE tree is available. For any integers i, j satisfying i, j ∈
[1..n] with i < j, CTOPT (1, i, j) can be computed in O(log3 n) time. Moreover, if
the capacities of P are uniform, CTOPT (1, i, j) can be computed in O(log n) time.
Proof We prove only the case of general capacities. See [7] for the case of uniform
capacity.
Recalling Eq. (5.11), we have
Because θ x,+ (W j ) and θ x,− (Wi−1 ) are monotonically decreasing and monotonically
increasing, respectively, in x ∈ Pi, j , if an integer h ∈ [i.. j] satisfies θ vh ,− (Wi−1 ) ≤
θ vh ,+ (W j ) and θ vh+1 ,− (Wi−1 ) > θ vh+1 ,+ (W j ), then there exists x ∗ that minimizes
CT(Pi, j , (x), ()) on edge eh including vh and vh+1 . We can apply binary search
to compute this h, which can be done in O(log3 n) time using the CUE tree (see
Lemma 5.2). Once h is determined, x ∗ can be computed as follows: We solve
In the parametric search method, we first compute the maximum integer i 1 such
that Pi1 +1,n is not (CTOPT (1, 1, i 1 ), k − 1)-feasible and store t1 = CTOPT (1, 1, i 1 +
1) as a feasible value. Note that t ∗ = CTOPT (k, 1, n) satisfies CTOPT (1, 1, i 1 ) <
t ∗ ≤ t1 . To compute i 1 , we apply binary search by executing O(log n) tests for
(CTOPT (1, 1, a), k − 1)-feasibility of Pa+1,n over 1 ≤ a ≤ n. For an integer a, we
can compute CTOPT (1, 1, a) in O(log3 n) time by Lemma 5.4. Also, by Lemma 5.3,
we can test whether Pa+1,n is (CTOPT (1, 1, a), k − 1)-feasible in O(k log3 n) time.
Summarizing these arguments, we can compute i 1 and t1 in {O(log3 n) + O(k log3 n)}
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 75
× O(log n) = O(k log4 n) time. Next, we compute the maximum integer i 2 such that
Pi2 +1,n is not (CTOPT (1, i 1 + 1, i 2 ), k − 2)-feasible and store t2 = CTOPT (1, i 1 +
1, i 2 + 1) as a feasible value, which can be done in O(k log4 n) time in the same man-
ner as in the computation of (i 1 , t1 ). Sequentially, we determine (i 3 , t3 ), . . . , (i k−1 ,
tk−1 ) in (k − 3) × O(k log4 n) time and eventually compute tk = CTOPT (1, i k−1 +
1, n) in O(log3 n) time. Note that t ∗ = min{ti | i = 1, 2, . . . , k} holds, which can be
computed in O(k) time. We then execute a (t ∗ , k)-feasibility test for P in O(k log3 n)
time, so that the optimal k-sink is obtained. We thus see that the problem can be solved
in (k − 1) × O(k log4 n) + O(log3 n) + O(k) + O(k log3 n) = O(k 2 log4 n) time
once the CUE tree is constructed. Since it takes O(n log n) time to construct the
CUE tree by Lemma 5.1, the total time complexity is O(n log n + k 2 log4 n).
For the case of uniform capacity, the same argument holds. Applying
Lemmas 5.1, 5.3, and 5.4, we have a total time complexity of O(n + k 2 log2 n).
A matrix A is sorted if and only if each row and column of A is sorted in non-
decreasing order. The sorted matrix method is based on the following lemma shown
in [11]:
Lemma 5.5 ([11]) Consider a minimization problem Q with an instance I of size n.
Suppose that the feasibility of any value for I can be tested in g(n) time. Let A be an
n × n sorted matrix such that each element can be computed in f (n) time. Then, the
minimum element of A that is feasible for Q can be found in O(n f (n) + g(n) log n)
time.
In [7], an n × n matrix A is defined such that the (i, j)th entry of A is given by
CTOPT (1, n − i + 1, j) if n − i + 1 ≤ j
A[i, j] = (5.15)
0 otherwise.
Note that we do not actually compute all the elements of A, but compute the element
A[i, j] on demand as needed.
Let us confirm that matrix A is sorted. It is also clear that matrix A includes
CTOPT (1, l, r ) for every pair of integers (l, r ) such that l, r ∈ [1..n] with l < r . In
addition, there exists a pair (l, r ) such that CTOPT (1, l, r ) = CTOPT (k, 1, n). These
facts imply that the minimum element A[i, j] such that P is (A[i, j], k)-feasible is
CTOPT (k, 1, n), and hence we can apply Lemma 5.5 to solve the Minmax- k- Sink-
Path- Confluent- Flow problem as follows: Once the CUE tree is constructed,
we have f (n) = O(log3 n) by Lemma 5.4 and g(n) = O(n log2 n) by Lemma 5.3,
so the problem can be solved in O(n log3 n) time. Because it takes O(n log n) time
to construct the CUE tree by Lemma 5.1, the total time complexity is O(n log n) +
O(n log3 n) = O(n log3 n).
76 Y. Higashikawa et al.
For the case of uniform capacity, the same argument holds. Applying
Lemmas 5.1, 5.3, and 5.4, we have a total time complexity of O(n log n).
In this section, our task is to find a valid pair (x, d) that minimizes the aggregate
evacuation time AT(P, x, d). This task can be precisely represented as follows:
(Minsum-k-Sink-Path)
Input: A dynamic flow path network P = (P, w, c, l, τ ).
Goal: Find a solution (x, d) to the problem
min. AT(P, x, d)
s.t. x = (x1 , . . . , xk ) ∈ P k , x h ≺ xl ∀h < l,
d = (d1 , . . . , dk−1 ) ∈ R k−1
, WId(xh ) ≤ dh ≤ WId(xh+1 ) ∀h.
(Minsum-k-Sink-Path-Confluent-Flow)
Input: A dynamic flow path network P = (P, w, c, l, τ ).
Goal: Find a solution (x, d) to the problem
min. AT(P, x, d)
s.t. x = (x1 , . . . , xk ) ∈ P k , x h ≺ xl ∀h < l,
d = (d1 , . . . , dk−1 ) ∈ {Wh | h ∈ [1..n]}k−1 , WId(xh ) ≤ dh ≤ WId(xh+1 ) ∀h.
For the Minsum-k-Sink-Path problem, [16] reported the following result, which
is the best so far:
For the confluent flow model, it was shown in [6, 15] that for the minsum k-sink
problems, there exists an optimal k-sink such that all of the k sinks are at vertices.
[16] extended this fact to the non-confluent flow model.
Lemma 5.6 ([6, 15, 16]) For the minsum k-sink problem in a dynamic flow path
network, there exists an optimal k-sink such that all of the k sinks are at vertices
under the confluent/non-confluent flow model.
Lemma 5.6 implies that it is sufficient to consider only the case where every sink is
at a vertex. Thus, we suppose x = (x1 , . . . , xk ) ∈ V k , where xi ≺ x j for i < j.
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 77
k
min. w (ai−1 , ai )
i=1
s.t. ai ∈ [0..n], a0 = 1, ak = n, ah < al ∀h < .
where ATOPT (i, j) is the optimal aggregate evacuation time required to move all
the supply between vi and v j to one of two sinks vi or v j . On the weighted com-
plete DAG G constructed as above, let us consider a (k + 1)-link path (va0 =
3Note that we assume that the weight function w is not given explicitly, but that a value w (i, j)
can be obtained in constant time whenever required.
78 Y. Higashikawa et al.
v0 , va1 , . . . , vak , vak+1 = vn+1 ) from v0 to vn+1 , where a1 , . . . , ak are integers sat-
isfying 0 < a1 < a2 < · · · < ak < n + 1. The sum of weights of this (k + 1)-link
path is
k k−1
w (ai , ai+1 ) = AT(P1,a1 , (va1 ), ()) + ATOPT (ai , ai+1 ) + AT(Pak ,n , (vak ), ()).
i=0 i=1
This value is equivalent to mind AT(P, x, d) for a k-sink x = (va1 , va2 , . . . , vak ),
which implies that a minimum (k + 1)-link path on G corresponds to an optimal
k-sink location for a dynamic flow path network P.
Let us consider the following subtasks:
(Minsum-Flow-for-Subpath)
Input: A dynamic flow path network P = (P, w, c, l, τ ), integers i, j ∈ [1..n] with
i < j.
Goal: Find a value d such that
(Minsum-Flow-for-Subpath-Confluent-Flow)
Input: A dynamic flow path network P = (P, w, c, l, τ ), integers i, j ∈ [1..n] with
i < j.
Goal: Find a value d such that
Note that [16] developed a data structure to efficiently solve both of these prob-
lems. This data structure can be constructed in O(n log2 n) time and can be used to
solve Minsum-Flow-for-Subpath/Minsum-Flow-for-Subpath-Confluent-
Flow in O(log3 n) time. See [16] for details.
Lemma 5.8 ([16]) For a given dynamic flow path network P with n vertices, there
exists a segment tree T that satisfies the following conditions:
Because w satisfies the concave Monge property (see Sect. 5.5.2), Lemmas 5.7
and 5.8 lead to Theorem 5.2.
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 79
In the rest of this section, we first observe the properties of the aggregate evacuation
time in Sect. 5.5.1 and then show that the weighted function w obtained by the
reduction satisfies the concave Monge property in Sect. 5.5.2.
Recalling that we consider only the case where every sink is at a vertex, we simply
use θ i,+ (z) and θ i,− (z) instead of θ vi ,+ (z) and θ vi ,+ (z), respectively.
We next give the general form of the aggregate evacuation time. Let φ i,+ (z) denote
the aggregate evacuation time when the first z − Wi of supply on the right side of vi
flows to sink vi . Similarly, we denote by φ i,− (z) the aggregate evacuation time when
the first Wi−1 − z of supply on the left side of vi flows to sink vi . Therefore, we have
z z
φ i,+ (z) = θ i,+ (t)dt = θ i,+ (t)dt and
Wi 0
Wi−1 Wn z
φ i,−
(z) = θ i,−
(t)dt = θ i,−
(t)dt = − θ i,− (t)dt (5.17)
z z Wn
Fig. 5.2 Thick half-open segments represent the function θ i,+ (t) and the gray area represents
φ i,+ (z) for some z > Wi
80 Y. Higashikawa et al.
= φ Id(x1 ),− (0) + φ Id(xi ),Id(xi+1 ) (di ) + φ Id(xk ),+ (Wn ). (5.20)
i∈[1..k−1]
In the rest of this section, we show the important properties of φ i, j (z). Let us first
confirm that by Eq. (5.17), both φ i,+ (z) and φ j,− (z) are convex in z since θ i,+ (z)
and −θ j,− (z) are non-decreasing in z, and therefore φ i, j (z) is convex in z. We have
a more useful lemma that gives the conditions for the minimizer of φ i, j (z).
Lemma 5.9 ([16]) For any i, j ∈ [1..n] with i < j, there uniquely exists
Proof By Eqs. (5.4) and (5.5), θ i,+ (z) is strictly increasing in z ∈ [Wi , Wn ]. Simi-
larly, by Eqs. (5.6) and (5.7), θ j,− (z) is strictly decreasing in z ∈ [0, W j−1 ]. Thus,
there uniquely exists z ∗ ∈ [Wi , W j−1 ].
We then see that for any z ∈ [Wi , z ∗ ],
In the following sections, this z ∗ is called the pseudo-intersection point4 of θ i,+ (z)
and θ j,− (z).
We now show that the function w defined in Eq. (5.16) satisfies the concave Monge
property under the non-confluent flow model. We omit the proof for the confluent
flow model, since the proof can be constructed similarly to the one for the confluent
flow model. See [16] for details.
Let us give some observations of ATOPT (i, j). Under the non-confluent flow
model, for any i, j ∈ [1..n] with i < j, ATOPT (i, j) = minz∈[Wi ,W j−1 ] φ i, j (z).
Lemma 5.9 implies that φ i, j (z) on [Wi , W j−1 ] is minimized when z is the pseudo-
intersection point of θ i,+ (z) and θ j,− (z). For any i, j ∈ [1..n] with i < j, let α i, j
denote the pseudo-intersection point of θ i,+ (z) and θ j,− (z).
Thus, we have
α i, j Wn
ATOPT (i, j) = φ i, j (α i, j ) = θ i,+ (z)dz + θ j,− (z)dz. (5.21)
0 α i, j
hold.
Proof We give the proof of only θ i,+ (z) ≥ θ i+1,+ (z) because the other case can be
proved in a similar way. By Eq. (5.5), for any j ∈ [i + 2..n], we have
4 The reason why we use the term “pseudo-intersection” is that the two functions θ i,+ (z) and
θ j,− (z) are not continuous, in general, whereas the “intersection” is usually defined for continuous
functions.
82 Y. Higashikawa et al.
⎧
⎪
⎨ 0z−W if z ≤ W j−1 ,
θ i,+, j
(z) − θ i+1,+, j
(z) = C
j−1
+ τ · L i, j if W j−1 < z ≤ W j ,
⎪ i, j
⎩ (z−W j−1 )(Ci+1, j −Ci, j ) + τ · if z > W .
Ci, j Ci+1, j i j
hold.
Proof We give the proof of only α i, j ≤ α i+1, j because the other cases can be proved
in a similar way. For any i, j ∈ [1..n] with i < j and positive constant , we have
because θ i,+ (z) ≥ θ i+1,+ (z) holds by Lemma 5.10 and θ j,− (z) is a non-increasing
function. This implies that α i, j ≤ α i+1, j holds, which completes the proof.
Let us show that the function w defined in Eq. (5.16) satisfies the concave Monge
property under the non-confluent flow model.
Lemma 5.12 ([16]) The weight function w defined in Eq. (5.16) satisfies the con-
cave Monge property under the non-confluent flow model.
holds, thus completing the proof. Note that condition (5.22) holds for i = 0 and
j = n, because the right-hand side of (5.22) contains w (0, n + 1) = ∞ and other
terms are finite. Let us consider the following three cases: (1) 0 < i < j < n, (2)
i = 0 and 0 < j < n, (3) 0 < i < n and j = n.
Case 1. Consider the case of 0 < i < j < n. By Eq. (5.16), for any (i , j ) ∈
{(i, j), (i, j + 1), (i + 1, j), (i + 1, j + 1)}, we have w (i , j ) = ATOPT (i , j ).
Recall that α i, j is the pseudo-intersection point of θ i,+ (z) and θ j,− (z), and we have
α i, j Wn
w (i, j) = ATOPT (i, j) = φ (α ) = i, j i, j
θ i,+
(z)dz + θ j,− (z)dz.(5.23)
0 α i, j
For any i, j ∈ [1..n − 1] with i < j, Eq. (5.23) and Lemma 5.11 state that
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 83
w (i, j + 1) + w (i + 1, j) − w (i, j) − w (i + 1, j + 1)
= φ i, j+1 (α i, j+1 ) + φ i+1, j (α i+1, j ) − φ i, j (α i, j ) − φ i+1, j+1 (α i+1, j+1 )
αi, j+1 αi+1, j+1
= θ (z)dz +
i,+
θ j+1,− (z)dz
α i, j α i, j+1
α i+1, j α i+1, j+1
− θ j,− (z)dz − θ i+1,+ (z)dz. (5.24)
α i, j α i+1, j
min{θ i,+ (z), θ j+1,− (z)} ≥ max{θ j,− (z), θ i+1,+ (z)}
holds. First, for any z ∈ [0, Wn ], θ i,+ (z) ≥ θ i+1,+ (z) and θ j,− (z) ≤ θ j+1,− (z) hold
by Lemma 5.10. For any z ≥ α i, j , θ i,+ (z) ≥ θ j,− (z) holds because α i, j is the pseudo-
intersection point of θ i,+ (z) and θ j,− (z). Similarly, for any z < α i+1, j+1 , we have
θ i+1,+ (z) ≤ θ j+1,− (z). Therefore, for any z ∈ [α i, j , α i+1, j+1 ), min{θ i,+ (z), θ j+1,−
(z)} ≥ max{θ j,− (z), θ i+1,+ (z)} holds.
Thus, Eq. (5.24) continues as
w (i, j + 1) + w (i + 1, j) − w (i, j) − w (i + 1, j + 1)
αi+1, j+1 αi+1, j+1
≥ min{θ i,+ (z), θ j+1,− (z)} − max{θ j,− (z), θ i+1,+ (z)}dz
α i, j α i, j
≥ 0,
and then condition (5.22) holds for any i, j with 0 < i < j < n.
Case 2. Consider the case of i = 0 and j ∈ [1..n − 1]. Recall that w (0, j) =
φ j,− (0) and w (0, j + 1) = φ j+1,− (0) by Eq. (5.16). In this case, we have
where the last equality uses α 1, j ≤ α 1, j+1 by Lemma 5.11. By Lemma 5.10, we have
θ j+1,− (z) ≥ θ j,− (z) for any z ∈ [0, Wn ]. Using the same argument as in the previous
case, for any z < α 1, j+1 , we have θ 1,+ (z) < θ j+1,− (z). Thus, we have
84 Y. Higashikawa et al.
Case 3. Consider the case of j = n and i ∈ [1..n − 1]. Recall that w (i, n + 1) =
φ i,+ (Wn ) and w (i + 1, n + 1) = φ i+1,+ (Wn ) by Eq. (5.16). Similar to the second
case, we use the facts that α i,n ≤ α i+1,n by Lemma 5.11, θ i,+ (z) ≥ θ i+1,+ (z) for any
z ∈ [0, Wn ] by Lemma 5.10, and θ i,+ (z) ≥ θ n,− (z) for any z ≥ α i,n . Then, we have
Thus, for any i, j ∈ [0..n] with i < j, condition (5.22) holds. This implies that
the function w satisfies the concave Monge condition.
References
1. S. Alstrup, C. Gavoille, H. Kaplan, T. Rauhe, Nearest common ancestors: a survey and a new
distributed algorithm, in Proceedings of the fourteenth annual ACM symposium on Parallel
algorithms and architectures (2002), pp. 258–264
2. Nadine Baumann, Martin Skutella, Earliest arrival flows with multiple sources. Math. Operat.
Res. 34(2), 499–512 (2009)
3. R. Belmonte, Y. Higashikawa, N. Katoh, Y. Okamoto, Polynomial-time approximability of the
k-sink location problem. CoRR (2015). arXiv:abs/1503.02835
4. M.A. Bender, M. Farach-Colton, The lca problem revisited, in Latin American Symposium on
Theoretical Informatics (Springer, Berlin, 2000), pp. 88–94
5 Almost Linear Time Algorithms for Some Problems on Dynamic Flow Networks 85
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0
International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing,
adaptation, distribution and reproduction in any medium or format, as long as you give appropriate
credit to the original author(s) and the source, provide a link to the Creative Commons license and
indicate if changes were made.
The images or other third party material in this chapter are included in the chapter’s Creative
Commons license, unless indicated otherwise in a credit line to the material. If material is not
included in the chapter’s Creative Commons license and your intended use is not permitted by
statutory regulation or exceeds the permitted use, you will need to obtain permission directly from
the copyright holder.