efficient algorithms for center problems in cactus networks

25
Efficient Algorithms for Center Problems in Cactus Graphs Boaz Ben-Moshe Departments of Computer Science, College of Judea and Samaria, 837 Ariel, Israel Binay Bhattacharya 1 Qiaosheng Shi * School of Computing Science, Simon Fraser University, Burnaby B.C., Canada. V5A 1S6 Arie Tamir School of Mathematical Sciences, Tel Aviv University, Ramat Aviv, Tel Aviv 69978, Israel Abstract Efficient algorithms for solving the center problems in weighted cactus graphs are presented. In particular, we have proposed the following algorithms for the weighted cactus graphs of size n: an O(n log n) time algorithm to solve the 1-center problem, an O(n log 3 n) time algorithm to solve the weighted continuous 2-center problem. We have also provided improved solutions to the general p-center problems in cactus networks. The developed ideas are then extended to solve the obnoxious 1-center problem in weighted cactus networks. 1 Introduction In this paper we focus on the center location problems in undirected cactus networks. A cactus network is a connected graph where any two simple cycles * Corresponding author. Email addresses: [email protected] (Boaz Ben-Moshe), [email protected] (Binay Bhattacharya), [email protected] (Qiaosheng Shi), [email protected] (Arie Tamir). 1 Research of the second author was partially supported by MITACS and NSERC Preprint submitted to Elsevier Science 11 April 2006

Upload: ariel

Post on 21-Jan-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

Efficient Algorithms for Center Problems in

Cactus Graphs

Boaz Ben-Moshe

Departments of Computer Science, College of Judea and Samaria, 837 Ariel,Israel

Binay Bhattacharya 1 Qiaosheng Shi ∗School of Computing Science, Simon Fraser University, Burnaby B.C., Canada.

V5A 1S6

Arie Tamir

School of Mathematical Sciences, Tel Aviv University, Ramat Aviv, Tel Aviv69978, Israel

Abstract

Efficient algorithms for solving the center problems in weighted cactus graphs arepresented. In particular, we have proposed the following algorithms for the weightedcactus graphs of size n: an O(n log n) time algorithm to solve the 1-center problem,an O(n log 3n) time algorithm to solve the weighted continuous 2-center problem.We have also provided improved solutions to the general p-center problems in cactusnetworks. The developed ideas are then extended to solve the obnoxious 1-centerproblem in weighted cactus networks.

1 Introduction

In this paper we focus on the center location problems in undirected cactusnetworks. A cactus network is a connected graph where any two simple cycles

∗ Corresponding author.Email addresses: [email protected] (Boaz Ben-Moshe), [email protected]

(Binay Bhattacharya), [email protected] (Qiaosheng Shi),[email protected] (Arie Tamir).1 Research of the second author was partially supported by MITACS and NSERC

Preprint submitted to Elsevier Science 11 April 2006

in the graph have at most one vertex in common. In the p-center problem, pcenters are to be located in the network so that the weighted distance from thefarthest demand point (client) in the network to a nearest center is minimized.To formulate the center location models mathematically, let X represent thecandidate location set for the facilities in G and Y represent the set of demandpoints located in G. These locations may occur anywhere along the edges ofthe network or restricted to vertices. Each demand point may be weighted. Fora given undirected cactus network G, let V (G) and A(G) denote the set of allvertices and continuum set of points on the edges of G respectively. A locationproblem in G will be characterized as weighted/unweighted X/Y/p problemwhere the candidate facility location set and the demand points set are eitherthe set V (G) or the set A(G). Note that the weighted version of a p-centerproblem with Y = A(G) is not defined, and therefore weighted V (G)/A(G)/pand weighted A(G)/A(G)/p problems are ignored in this paper.

The p-center problem in general networks is NP-hard [18]. Kariv and Hakimi[18] proposed an O(mn log n) algorithm to compute 1-center in general net-works. They then proposed an O(mpn2p−1/(p−1)! log n) algorithm to solve theweighted p-center problem A(G)/V (G)/p in general networks. Later, Tamir[27] improved the above bound to O(mpnp log nα(n)) where α(n) is the inverseAckermann’s function.

The location problems in tree networks are well studied problems [10,11,18,21,23].The following table summarizes the current-best results for the p-center prob-lem in trees.

Table 1Current best results for the p-center problem in tree networks

Problem Unweighted Weighted

V(G)/V(G)/p O(n) [10] O(n log2 n) [24]

O(pn log n) [17]

A(G)/V(G)/p O(n) [10] O(n log2 n) combining [23] and [9]

O(pn log n) [17]

V(G)/A(G)/p O(n) [10] −A(G)/A(G)/p O(pn log 2n/p)[11] −

O(n log2 n) combining [23] and [9]

Although most of the reported works on the center problems are for trees orfor general networks, more and more attentions are being paid for the classesof networks that are between these two extremes [13]. The location problemsin cactus networks [11,19,30], in series-parallel networks [15], and in partial

2

k-trees [12] networks are worth mentioning. For the case where the demandpoints are unweighted, Lan et al. [19] designed a linear time algorithm tosolve the unweighted V (G)/V (G)/1 problem in cactus networks [19]. In [4]Burkard and Dollani solved the unweighted A(G)/V (G)/1 problem in cactusnetworks in linear time. Frederickson and Johnson [11] solved the unweightedV (G)/V (G)/p problem in cactus networks in O(n log n) time.

A p-center problem is called obnoxious if the weights of the demand pointsare all negative. For trees Tamir [27,28] gives two algorithms of O(n log2 n)and O(sn log2 n) time, respectively, where s is a parameter that depends onthe structure of the tree. The second algorithm was improved to O(sn log n)by the use of different data structures [5]. Zmazek and Zerovnik [30] proposedan algorithm that finds the obnoxious 1-center problem in cactus networks inO(cn) time, c here is the number of distinct vertex weights.

The following table summarizes the results reported in this paper.

Table 2Complexity bounds of the algorithms presented in this paper for the p-center prob-lems in cactus networks

Problems Unweighted Weighted

A(G)/V(G)/1 − O(n log n)

A(G)/V(G)/2 − O(n log3 n)

Obnoxious A(G)/V(G)/1 − O(n log3 n)

V(G)/V(G)/p − O(n log2 n)

A(G)/V(G)/p − O(n2)

A(G)/A(G)/p O(n2 log3 n) -

The basic technique used in developing the algorithms is the combination ofthe divide-and-conquer technique with the parametric searching. One impor-tant feature of the algorithm to solve the 2-center problem is to compute, inthe query mode, the service cost of an arbitrary point in G in sublinear time.For this purpose, we have proposed a two-level tree decomposition structureon a cactus network. This structure can be easily extended to general partialk-tree networks for fixed k.

The rest of the paper is organized as follows. Section 2 begins with defini-tions and problem formulations. The well-known tree structure of a cactusgraph is also reviewed in this section. Section 3 provides a simple O(n log n)-time algorithm to solve the weighted A(G)/V (G)/1 problem in cactus net-works. Our algorithm for the weighted A(G)/V (G)/2 problem in cactus net-works is presented in Section 4. Section 5 describes some new results on theweighted/unweighted p-center problems. Section 6 gives a brief summary ofthe results and future possibilities.

3

2 Definitions and Problem Formulations

Let G = (V (G), E, w, l) be a simple (i.e., no parallel edges and self-loops)cactus network with vertex set V (G), |V (G)| = n, and edge set E, |E| = m,where each vertex v ∈ V (G) is associated with a nonnegative weight w(v) andeach edge e ∈ E is associated with a positive length l(e). We also use uv todenote edge e if u and v are the two incident vertices of e. An edge is identifiedwith a line segment of length l(e = uv) so that any “point” on uv at a distancet from u and l(e)− t from v can be referred. The set of all such points of thegraph is denoted by A(G). For a subgraph G′ of G, let V (G′), E(G′), A(G′)denote the vertex set, the edge set and the continuum set of points on theedges of G′, respectively. For u, v ∈ A(G), let Pu,v denote the shortest pathin G from u to v, and its length is represented by du,v. Let D be the set ofthe demand points located in G. We consider only two possibilities: eitherD = V (G) or D = A(G). As discussed earlier, when D = A(G), the demandpoints are unweighted (i.e weights are the same). We denote the maximumcost of serving the demand points in D from a point x in G by r(x,G), thatis,

r(x,G) = maxv∈D

{w(v)dx,v}

r(x,G) is also known as the radius of G from x. The above definition can begeneralized to r(F, G) where r(F,G) denotes the maximum service cost of Dfrom a set of p facilities F : {α1, α2, . . . , αp}. i.e

r(F, G) = maxv∈D

{w(v)dF,v}, where dF,v = minj=1,...,p

dαj ,v.

In order to facilitate the overview of the proposed algorithms for the centerproblems in cactus graphs, we start with the well known tree structure ofa cactus graph [6]. The vertex set V (G) is partitioned into three differentsubsets. A C-vertex is a vertex of degree 2 which is included in exactly onecycle. A G-vertex is a vertex not included in any cycle. The remaining vertices,if any, will be referred to as H-vertices or hinges (See Fig.1(a) for reference).We use the dotted ellipses to emphasize components, called grafts.

It’s not difficult to see that a cactus consists of blocks where each block iseither a cycle or a graft, and these blocks are glued with H-vertices. So, wecan use a tree TG = (VG, EG) to represent the important structure of G, whereeach node in VG represents a block or a hinge vertex in G (see Fig.1(b)). LetBb denote the block represented by a block node b ∈ VG. There is an edgebetween a block node b and a hinge node h if h ∈ V (Bb).

4

9

7

10

h1

h7

3

B2

B1

h4

(a) Cactus graph G (b) Tree structure TG over G

h1

h5

8

h5

B8

h2

5

h3

B5B10

B7B3

h6 B9

B6

6

h7

2h3

h6

h44

h2

1

B4

Fig. 1. A cactus graph and its corresponding tree structure

The weighted A(G)/V (G)/p problem (also known as the weighted continuousp-center problem) in cactus networks G seeks to find a set F : {α1, . . . , αp} ⊂A(G) that minimizes r(F, G). When the centers are restricted to the vertices ofG, the problem is known as the weighted V (G)/V (G)/p problem (also knownas the weighted discrete p-center problem).

For the case when p = 1, let α∗G ∈ A(G) be an optimal 1-center of G andlet γG denote the radius r(α∗G, G) of G. Let G′ be a subgraph of G. We callx∗ ∈ A(G′) local center in G′ of G if r(x∗, G) = minx∈A(G′) r(x,G).

3 Weighted Continuous 1-Center Problem

We know that the radius function r(α, G) is convex on every simple path inG if G is a tree [18]. Unfortunately, this convexity property does not hold incactus networks (even when it is just a cycle) [18]. Here we show that a similarconvexity property of a 1-center in a cactus can be established by adding extrapoints in A(G), and this provides the basis for the proposed algorithm. LetG1, . . . , Gk denote the connected components hanging from a hinge vertex h.If the maximum radius of r(h,G1), . . . , r(h,Gk) is attained at more than onecomponent then h itself is the 1-center. On the other hand, if the maximumis attained in a unique Gi, then the center must lie in Gi.

Based on this observation, it is easy to find (in linear time), for any hinge vertexh, either the optimal solution or a sub-cactus where an optimal 1-center lies.The proposed algorithm consists of two steps which are described in Section3.1 and Secton 3.2. Similar steps were also discussed in [8]. Our version hereis slightly modified keeping in mind of the fact that our underlying networkis a cactus.

5

3.1 Locating block B∗ containing α∗G

Let o be the centroid node of TG, i.e. o is a vertex with the property thateach of the subtrees of T (G) rooted at o has no more than half of the graftand block nodes of TG. Similar decomposition was used in [18]. o can be easilyidentified in linear time. The vertex o could be a hinge vertex or a block vertexin G. These cases are separately considered below.

(b) o is a block node(a) o is a hinge vertex

Gk

v2Bo

G1

v1

G1

o

Gk

Fig. 2. Locate the sub-cactus where the center lies

Case 1: o is a hinge vertex. See Fig.2(a). If there exist subgraphs Gi andGj adjacent to o, i 6= j, such that r(o,Gi) = r(o,Gj) ≥ r(o,Gl) for everyother Gl adjacent to o, then o itself is an optimal 1-center α∗G. Suppose thatthe subgraph Gi with the largest r(o,Gi) is unique. In this case an optimalcenter lies in Gi. Since Gj, 1 ≤ j ≤ k are pairwise disjoint, it follows thatr(o,Gj), 1 ≤ j ≤ k can be evaluated in linear time.

Case 2: o is a block node. See Fig.2(b). If there are two subgraphs Gi andGj adjacent to Bo, such that r(vi, Gi) = r(vj, Gj) ≥ r(vl, Gl) for every otherGl adjacent to Bo, then the center should be in the block Bo (So Bo is B∗).Suppose that the subgraph Gi with the largest value of r(vi, Gi) is unique.Now, an optimal weighted 1-center lies in either block Bo or in sub-cactusGi. We compare r(vi, Gi) with r(vi, G \Gi). If r(vi, Gi) < r(vi, G \Gi), thenan optimal center certainly lies in block Bo (in this case Bo is B∗). Similarly,if r(vi, Gi) > r(vi, G \Gi), then an optimal center lies in Gi. The remainingcase is when r(vi, Gi) = r(vi, G \Gi). In this case, the hinge vertex vi itselfis the center α∗G. All of these steps clearly require linear time to determine.

Thus we have the following situations: either α∗G is found and in this case thealgorithm terminates, B∗ is found and in this case the the algorithm in Section3.2 to locate α∗G is used, or a sub-cactus Gi containing α∗G is found, and in thiscase the process is repeated on Gi.

Lemma 3.1 It takes at most O(n log n) time to locate B∗.

We note that the above process leading to Lemma 3.1, is also valid for generalgraphs. Specifically, we can identify a biconnected component containing aweighted 1-center of a general network in O(n log n) time, provided that the

6

distance between a pair of nodes can be computed in constant time. Thisimproves upon the result in [8].

3.2 Determining α∗G in B∗

We now consider the problem of locating α∗G in B∗. If B∗ is a graft, r(x,G) isconvex on every simple path of B∗. In this case the algorithm in [18] can beused to determine α∗G with the center restricted to lie in B∗. This can be done inO(n log n) time. Also the linear-time algorithm for the weighted A(G)/V (G)/1problem in trees [21] can be applied here. Note that the structure of the cactusnetwork G, except for the part of B∗, can be transformed into a tree structure.

Suppose B∗ is a cycle block. Observe that locating α∗G in the cycle block B∗

is equivalent to locating 1-center in a cycle. Rayco et al. [25] just mentionedthat the weighted continuous 1-center problem (i.e. weighted A(G)/V (G)/1problem) in a cycle is solvable in O(n log n) time. Here, for completeness, wedescribe an algorithm to compute the weighted 1-center in a cycle.

3.3 Weighted continuous 1-center problem in a cycle block

Let v1, v2, . . . , vt be the vertices of a cycle C. Let α∗ denote the 1-center of Cwe are interested in computing. We notice that there is exactly one edge inC not used by α∗ to cover the vertices of C. We call this edge as the optimalcut-edge. Thus the 1-center on the path constructed by removing the optimalcut-edge from C is also the 1-center in C. So our idea is - consider each edge asa cut-edge and compute the 1-center on the resulting path. The data structuredescribed below is dynamic which allows efficient updating of the structure asthe cut-edge changes.

v2t−1v2

2v21v1

tv13v1

2v11

Fig. 3. Locate α∗ in a cycle block O

The algorithm is described as follows. Consider Figure 3 for reference. Thevertices on the cycle are indexed as v1, v2, . . . , vt in the counterclockwise orderand the edge connecting the vertices vi−1 and vi is indexed as ei−1, 1 < i ≤ t(et = vtv1). We put the 2t − 1 vertices {v1

1 = v1, v12 = v2, . . . , v

1t = vt, v

21 =

7

v1, . . . , v2t−1 = vt−1} on a real line. Let Pos(vi) denote the position of vi where

Pos(v11) = 0, Pos(v1

i ) = Pos(v1i−1) + l(ei) (1 < i ≤ t), Pos(v2

1) = Pos(v1t ) +

l(et), and so on.

The path constructed by removing edge ei from O is called the i-th path,which is the path from v1

i+1 to v2i . Let V i be the vertex set of the i-th path.

The service cost function f i(x) on the i-th path is defined as

f i(x) = maxv∈V i

w(v)|d(x, v11)− Pos(v)|,

where x is a point on the i-th path at a distance d(x, v11) from v1

1. Let xi denotethe 1-center of the i-th path. It is easy to compute f i(x) and determine xi inlinear time (see Section 3.2. in [4]). But, it’s not efficient to separately computefunctions f i(x), 1 ≤ i ≤ t.

v1 v2 v3

l3

l′3

xi

v4

l4

l′4x

l′1l′2

l2l1

f i(x)

Fig. 4. f i(x)

We can represent the function w(vi)|d(x, v11)−Pos(vi)| for all x by two straight

lines through point (Pos(vi), 0) with slopes w(v) and −w(v) (Fig. 4). Thenf i(x) is the upper envelope of 2t linear functions, in which t linear functionshave positive slopes and t linear functions have negative slopes (refer to Fig.4).Since f i(x) is convex, the optimal solution can be easily computed. Observethat the upper envelope of the lines generated by the (i + 1)-th path is con-structed from the upper envelope of the line generated by the i-path by simplyremoving the lines generated by v1

i+1 and inserting the lines generated by v2i+1.

The upper envelope can be maintained by the algorithm proposed by Her-shberger and Suri [16]. Each updating step can be performed in amortizedlogarithmic time. The algorithm in [16] needs to know the sequence of inser-tions and deletions before hand. In our case we know for each line when it isbeing inserted and when it is being deleted. Observe that the above approachalso works if some of the vertices in C are hinge vertices and are adjacent toother components. If v is a vertex in a component adjacent to a hinge ver-tex, say vi, the corresponding two lines generated by v will have slopes w(v)

8

and −w(v) and they will go through the point (Pos(vi), bv) where bv is theweighted distance of v to vi. Thus

Lemma 3.2 The optimal solutions corresponding to all the cut-edges in Ccan be computed in total O(n log n) time. The storage space requirement islinear.

To solve the discrete version it is sufficient to solve the distance problem on B∗.This can clearly be done by the above algorithm in O(n log n) time. Summingup, we have the following theorem.

Theorem 3.3 The weighted continuous/discrete 1-center problem in cactusnetworks can be solved in O(n log n) time using linear space.

4 Weighted Continuous 2-Center Problem

In this section, an efficient algorithm for the weighted A(G)/V (G)/2 prob-lem is proposed. Let F = {α1, α2} ⊂ A(G) be a set of two centers in G. LetVi ⊆ V be the set of vertices closest to αi ∈ F, i = 1, 2, ties being brokenin such a way that G(Vi) remains connected. The vertices of Vi are thus cov-ered or served by αi, i = 1, 2. The edges whose endpoints belong to differentsubgraphs G(Vi), i = 1, 2 are called split edges. Thus, locating the optimaltwo centers in a graph is equivalent to finding the set of split edges whoseremoval define two connected components and the weighted 1-center of eachsuch component, considered together, constitute the optimal weighted contin-uous 2-center solution of G.

In a tree graph, the number of split edges in a 2-center solution is just one.However, for a cactus network the number of split edges could be two. As amatter of fact, it can be shown that

Lemma 4.1 The split edges corresponding to any optimal 2-center solutionin a cactus network G lie in one block Bi. If Bi is graft, there is one split edge,otherwise (Bi is a cycle) the number of split edges is two.

e2v2

BjBi

v1

u2

e1

u1 h

Fig. 5. Lemma 4.1

9

PROOF. Suppose that the split edges of a set of two centers α1 and α2 liein more than one block. Let Bi be the block containing a split edge e1 = u1v1

and let Bj be the block containing the other split edge e2 = u2v2. See Figure5. Assume that u1 and u2 are served by α1 and v1 and v2 are served by α2.Let h be one hinge vertex lying between Bi and Bj, that is, the shortest pathbetween any vertex in Bi and any vertex in Bj goes through h. Such hingevertex h always exists because Bi and Bj are different blocks. Due to theconnectivity of the subgraph served by one center and h is in the shortestpaths Pu1,u2 and Pv1,v2 , we find that h is served by α1 and α2. This is notpossible. Hence, all the split edges of two centers must lie in one block of G.

Since the sub-network served by one center is connected, it’s easy to concludethat if the block containing the split edges is a graft, then the number of splitedges is one and if the block containing the split edges is a cycle, then thenumber of split edges is two. 2

Let R denote the set of split edges for the 2-center solution in G. Assume thatR satisfies the conditions of Lemma 4.1, i.e. if |R| = 2, both the edges comefrom one cycle of G. Let G1

R, G2R denote the two subgraphs that result after

the split edges in R are removed from G. Let γGiR

be the optimal service cost of

the problem A(GiR)/V (Gi

R)/1, i = 1, 2. Let φ(R) = max {γG1R, γG2

R} denote the

service cost function of G corresponding to the split-edge set R. A split-edgeset R∗ is called an optimal split-edge set of G if φ(R∗) = minR⊆Bi,i=1,...,t φ(R),where B1, B2, . . . , Bt are the blocks in G.

4.1 Locating the optimal split-block B∗

We now focus on exploring the property of the split-edge set in an optimal2-center solution in cactus networks.

Lemma 4.2 (Refer to Fig.2(a).) Given a hinge vertex o ∈ V , let G1, . . . , Gk

be the sub-networks of G hanging from o. After O(n log n) processing one caneither identify an optimal split edge set or determine the component Gi thatcontains an optimal split edge set.

PROOF. Suppose that r(o,G1) ≥ r(o,G2) ≥ r(o,Gj), j = 3, . . . , k, wherer(o,Gi) denotes the service cost of Gi from o. Let Ri denote the set of edgesincident to o in Gi, i = 1, . . . , k. Clearly, |Ri| ≤ 2. We first show that there isan optimal split-edge set in G1 or in G2. The service cost φ(R) with a split edgeset R, not contained in G1 and G2, must be greater than max {γG1 , r(o,G2)}since G1 and G2 must be served by one center. But, the service cost φ(R1)

10

is no more than max {r(o,G2), γG1}. Three cases are possible based on theservice costs φ(R1) and φ(R2).

• φ(R1) is determined by the service cost of the center in sub-cactus G1. Thisimplies that G1 contains an optimal split edge set.

• φ(R2) is determined by the service cost of the center in sub-cactus G2. Thisimplies that G2 contains an optimal split edge set.

• φ(R1) is determined by the service cost of the center in sub-cactus G \ G1

and φ(R2) is determined by the service cost of the center in sub-cactusG \ G2. This implies that if φ(R1) ≤ φ(R2), R1 contains the optimal splitedges, otherwise (φ(R2) ≤ φ(R1)) R2 contains the optimal split edge set.

In the previous section we have shown that the weighted A(G)/V (G)/1 prob-lem in cactus networks can be solved in O(n log n) time. 2

Lemma 4.3 (Refer to Fig.2(b).) Given a block Bo, let G1, . . . , Gk be the sub-networks of G hanging from Bo. After O(n log n) processing, we can eitheridentify an optimal split edge set, locate the split block B∗ or determine thecomponent Gi that contains an optimal split edge set.

The proof of Lemma 4.3 is very similar to that of Lemma 4.2. Using these twolemmas, we can recursively search an optimal split-edge set in a componentwhich has at most half of the blocks as that in the previous component. Thusafter an O(n log n · log |VG|) processing, either we already have an optimalsplit-edge set or know the block B∗ that contains optimal split-edge set R∗.

4.2 Computing R∗ in B∗

When B∗ is a graft, R∗ contains exactly one edge. We can locate an optimalsplit edge recursively using the centroid decomposition of B∗. Each recursivestep takes O(n log n) time (Lemma 4.2 also works for G-vertices). Therefore,in this case it takes O(n log n · log |B∗|) time to obtain R∗.

For the other case, an optimal split-edge set contains two edges. Let v1, v2, . . . , vt,be the vertices of B∗ in counterclockwise order, and let e1 = v1v2, . . . , et = vtv1

be the edges of B∗ in counterclockwise order. Let [ei..ej] denote the chain ofB∗ in counterclockwise order from ei to ej in B∗. Similarly, let [vi..vj] denotethe sequence of vertices in counterclockwise order from vi to vj in B∗.

If one of the two optimal split edges is known, we can locate the other one inO(n log n·log |B∗|) time since it is equivalent to locating one optimal split edgein a graft. Here the graft is a path. With respect to one split edge ei, an edgee′i ∈ E(B∗) is called match-edge of ei if φ({ei, e

′i}) = minek∈E(B∗) φ({ei, ek}).

11

The match-edge of an edge ei may not be unique. All match-edges are con-secutive. For uniqueness, refer to the first one (counterclockwise). We cannotafford to separately find the match-edge of each edge in B∗. However, thefollowing simple observation is helpful. Assume that e′i is the match-edge ofei, i = 1, . . . , t, and ej ∈ (ei..e

′i). The match-edge e′j of ej should be in [e′i..ei].

Our algorithm to locate R∗ in B∗ proceeds as follows. Start from e1. Afterthe match-edge e′i of ei is found, the first edge ej ∈ [e′i, ei], which satisfiesφ({ei+1, ej}) < φ({ei+1, ej+1}), is the match-edge e′i+1 of ei+1. This is due tothe unimodality property: when one split-edge e in a split-edge set is fixed, themaximum service cost function φ({e, e′}) once starts increasing will continueto increase on the path B∗ \ {e}. Thus, the running time of computing R∗ inB∗ is dependent on the complexity of computing the maximum service costfor a given split-edge set R.

4.2.1 Computing φ(R = {ei, ej})

Let v1, v2, . . . , vt be the vertices of B∗ in counterclockwise order. Let G′k de-

note the subgraph hanging from vk. Assume that r(vi1 , G′i1) ≥ r(vi2 , G

′i2) ≥

r(vk, G′k), 1 ≤ k ≤ t, i1 6= i2, and k 6= i1, i2. The following lemma is crucial to

our algorithms.

Lemma 4.4 Let G′k denote the subgraph hanging from vk and let r(vi1 , G

′i1)

≥ r(vi2 , G′i2) ≥ r(vk, G

′k), 1 ≤ k ≤ t, i1 6= i2, and k 6= i1, i2. There exist

two centers for the given split-edge set R ∈ B∗ which lie in either block B∗,component G′

i1or component G′

i2.

PROOF. Assume that the vertices vi+1, . . . , vj are contained in V (G1R) where

R = {ei, ej}. It’s easy to see that the 1-center of G1R (resp. G2

R) must lie eitherin B∗ or in the component G′

k that satisfies k ∈ [i + 1, j] and r(vk, G′k) ≥

r(vf , G′f ), f ∈ [i + 1, j] (resp. k ∈ [j + 1, i] and r(vk, G

′k) ≥ r(vf , G

′f ), f ∈

[j + 1, i]).

Suppose that one of the two centers, say α1, lies in one G′k for some k 6= i1, i2.

In this case we can use the vertex vk as the center instead without increasingthe service cost φ(R) due to the following reasons. Firstly, both the verticesvi1 , vi2 are served by α2. Hence, the service cost γG2

Rmust be at least r(vi2 , G

′i2).

Secondly, the service cost γG1R

must be less than or equal to r(vk, G′k) if

α1 lies in G′k. That is, γG1

R≤ r(vk, G

′k) ≤ r(vi2 , G

′i2) ≤ γG2

R. Therefore,

r({vk, α2}, G) ≤ max {r(vk, G1R), r(α2, G

2R)} = r(α2, G

2R) = φ(R). 2

12

Suppose that vi1 ∈ V (G1R). We can compute φ(R) by computing

• the local optimal center α′1 in the part of B∗ of G1R,

• the local optimal center α′′1 in G′i1

of G1R

• the local optimal center α′2 in the part of B∗ of G2R, and

• the local optimal center α′′2 in G′i2

of G2R if vi2 ∈ V (G2

R), otherwise α′′2 isundefined.

α′1 and α′2 are restricted to be on a path. Hence, they can be found by thealgorithms in Kariv and Hakimi [18] in O(n log n) time.

Since computing α′′2 is similar to computing α′′1, we concentrate on computingα′′1 only. Let G′ = G1

R \ G′i1. G′ changes as R changes, see Fig.6(a). Let β1

denote the weighted 1-center of G′i1, and B denote the block in G′

i1where β1

lies.

Lemma 4.5 (Refer to Fig.6(b).) The local center α′′1 lies in one of the blocksthat the shortest path Pvi1

,β1 goes through.

PROOF. Suppose that α′′1 lies in some block B′ that Pvi1,β1 doesn’t go

through. Let h denote the closest vertex of the path Pvi1,β1 to α′′1. Clearly,

h is a hinge vertex. We can see that the service cost r(h,G1R) is less than the

service cost r(α′′1, G1R). 2

vi1

β1

h

vi1

(a) (b)

B′G′i1

G1R

G′ = G1R \G′i1

Current split-edge set R

G′i1

G′

Fig. 6. Example with a split edge set R

4.2.2 Forcing the convexity of r(x,G′i1) on an edge

Unlike in tree structures, the service cost function r(x,G) in a cactus graphmay not be convex even on an edge. Fortunately, for a cactus graph we canforce the service cost function convex on each edge of the block path P (vi1 , β1),which includes all the blocks that the shortest path Pvi1

,β1 goes through. This

13

is done by adding extra vertices as follows. If a block on the block path isa graft, then clearly the service cost function is convex on each edge of thisblock. Otherwise (the block is a cycle), for every vertex v in this block, findthe match-point v′ in the block such that dc

v,v′ = dccv,v′ where dc

v,v′ (dccv,v′) is the

clockwise (counterclockwise) distance from v to v′. We assign weight zero tothese added vertices. In this way, the service cost function r(x, v), for every vis monotone as x ranges over an edge. Due to the introduction of the match-points, the service cost function on each edge is also convex. The total numberof match-points added to force the convexity is no more than 2n. These match-points can easily be determined in O(n) time.

4.2.3 The algorithm to locate α′′1 in G′i1

In the following we assume that G′i1

contains the match-points of the verticesin the cycle blocks of G′

i1. In the following it is assumed that G1

R, G′ and G′i1

arepreprocessed along the lines that are discussed in Appendix A. The algorithmto compute α′′1 consists of two parts. First we determine the block containingα′′1 and then determine α′′1 within this block. Suppose u1 = vi1 , u2, . . . , uk arethe hinge vertices lying on the path Pvi1

,β1 .

Locating the block containing α′′1

Observe that the farthest (weighted) vertex v′j in G′i1

to uj must lie below uj

(further away from vi1 compared to uj), otherwise, β1 cannot be a weighted1-center of G′

i1. Therefore,

Lemma 4.6 For any j, 1 ≤ j ≤ k, if the farthest (weighted) vertex to uj inG1

R comes from G′, then α′′1 can not lie on block path P (uj, β1); otherwise,i.e.,the farthest (weighted) vertex to uj lies in G′

i1, α′′1 can not lie on the block path

P (vi1 , uj).

Using Lemma 4.6, we can locate the block that contains α′′1 in O(log n) steps.In each step, we need to compute r(ui, G

1R), i ∈ [1, k]. We can precompute

r(ui, G′i1) for all the vertices in G′

i1in O(n log 2n) time (see Appendix A).

Since r(ui, G1R) = max {r(ui, G

′), r(ui, G′i1)}, we need to compute r(ui, G

′)fast. Observe that the upper envelope f i(x) of the lines generated by thevertices of G′ can be dynamically maintained. There are O(n) insertions anddeletions in all, and each operation costs O(log n) amortized time [16]. Oncef i(x) is known, r(ui, G

1R) can be computed in O(log n) time for any ui. Hence,

Lemma 4.7 After O(n log 2n) preprocessing, the block of G′i1

containing α′′1,say Bu∗i , can be found in O(log 2n) time. The storage space requirement isO(n log n).

14

Locating α′′1 within the block Bu∗i

w1

w2

v′u′

u

v

Fig. 7. Local center on an edge uv

We first show that the local 1-center of G′i1

restricted to lie on an edge e = uvof G′

i1can be computed in O(log 3n) time. We first compute the two-level

tree decomposition of G′i1, denoted by TD(G′

i1), as discussed in Appendix A.

Let u be the counterclockwise neighbor of v (see Figure 7). Let Vu be theset of vertices w in G′

i1with dw,u ≤ dw,v and Vv = V (G′

i1) \ Vu. Note that,

as observed in Appendix A, there are O(log n) subtrees of TD(G′i1), say H,

spanning all the vertices of G′i1

and there is a 2-separator (or 1-separator, butit is safe to only consider 2-separator) between the edge uv and each of thesesubtrees H. This is possible if we start from a node of TD(G′

i1) that contains

both the vertices u and v. Let w1 and w2 be the 2-separator between u and v,and a subtree G′′, an element of H. We can compute d(u,wi) and d(v, wi) inconstant time [7]. Clearly, if w1, w2 ∈ Vu (or w1, w2 ∈ Vv) then all the verticesG′

i1in G′′ belong to Vu (or Vv); if w1 ∈ Vu, w2 ∈ Vv (resp. w1 ∈ Vv, w2 ∈ Vu)

then all the vertices of G′i1

in G′′, whose shortest path to u goes through w1,belong to Vu (resp. Vv) and the other vertices in G′′ belong to Vv (resp. Vu).This can be observed in Figure 7. Let u′ and v′ be the match-points of u andv, respectively, on the cycle block that contains the edge e. All the verticeson the counterclockwise path from u to v′ together with the vertices in thecomponents adjacent to the path are closer to u than v. The shortest pathsfrom u to these vertices do not use the edge v′u′. These vertices determine Vu.Similarly, all the vertices on the clockwise path from v to u′ together with thevertices in the components adjacent to the path are closer to v than u. Theshortest paths from v to all these vertices also do not use the edge v′u′. Thesevertices determine Vv. From TD(G′

i1) the vertices of G′

i1in G′′ that belong

to Vu can be reported in a sorted list of distances from w1 in O(log n) time.Similarly, all distances from w2 to the vertices of G′

i1in G′′ that belong to Vv

can be reported in a sorted list in O(log n) time. Therefore, Vu and Vv can berepresented by O(log n) sorted lists and the maximum service cost function ofeach such list is monotone on uv. More precisely, the maximum service costfunction of each list in Vu monotonically increases on uv from u to v and the

15

maximum service cost function of each vertex in Vv monotonically decreaseson uv from u to v. Since the maximum service cost to G′

i1of a point on uv

can be computed in O(log 2n) time (Lemma A-1.3), therefore,

Lemma 4.8 One can compute the optimal local 1-center restricted to lie onan edge of G′

i1in O(log 3n) time. The preprocessing step takes O(n log2 n) time

and O(n log n) space.

We will now prune away most of the edges of Bu∗i by using the information oflocal 1-center restricted to lie on an edge. Note that ui∗ is the closest hingevertex of Bu∗i to vi1 . We partition the edges of Bu∗i into two groups: πccw =[ui∗ , . . . , u

′i∗ ] and πcw = [ui∗ , . . . , u

′i∗ ] where u′i∗ is the match-point of ui∗ and

the edges of πccw and πcw are traversed in counterclockwise and clockwiseorientations respectively. The edges of πccw and πcw are, therefore, each orderedin increasing order from ui∗ .

We just consider πccw chain only. The process is similar for the other chain.The following lemma eliminates some edges of Bu∗i .

Lemma 4.9 If the local optimal center q of G′i1

restricted to lie on an edgee ∈ πccw has a larger service cost to G′

i1than a point p on another edge of πccw

closer to vi1, then α′′1 can’t lie on e.

PROOF. Clearly r(x,G1R) = max {r(x,G′), r(x, G′

i1)}. Since the local mini-

mum service cost to G′i1

on e is greater than r(p,G′i1) and p is closer to vi1

than any point in e, the service cost r(p,G1R) is always less than the service

cost of any point on e. 2

As a consequence of the above lemma we can order the edges of πccw in in-creasing distances from u∗i and with decreasing local optimal 1-center servicecosts. Similar ordering of the edges are performed on πcw. These orderings arepossible without the knowledge of G′, and therefore are done once. The rest ofthe edges of B∗

i are labeled and will not be considered further. We only needto consider the unlabeled edges to find α′′1. The following lemma allows us toprune the unlabeled edges of B∗

i further.

Lemma 4.10 Consider any unlabeled edge e = uv in πccw. If the service costof G1

R from u is determined by some vertex in G′, then all the unlabeled edgesin πccw[u, . . . , ui∗ ] cannot contain α′′1. Otherwise (r(u,G′) < r(u,G′

i1)), all the

unlabeled edges of πccw[ui∗ , . . . , u] cannot contain α′′1.

Therefore we can apply the binary-search technique to the unlabeled edges inπccw till we are left with one edge, say eccw. We can similarly determine ecw by

16

performing binary search on πcw. Since the service cost of any point in G1R to

G1R can be computed in O(log2 n) time (Lemma A-1.3), therefore,

Lemma 4.11 The number of candidate edges for α′′1 to lie on, can be narroweddown to at most two in O(log 3n) time.

The remaining step of locating α′′1 on eccw and ecw is very similar to computingthe local optimal 1-center of G′

i1restricted to lie on eccw and ecw.

The above results can now be summarized as follows. After an O(n log 2n)processing, either we already have an optimal split-edge set or know the blockB∗ that contains an optimal split-edge set R∗. If B∗ is a graft then it takes anadditional O(n log 2n) time to compute an optimal split edge and the optimalservice cost. Otherwise, B∗ is a cycle block. It is easy to see that findingG′

i1and G′

i2and adding match-points in them can be done in linear time.

Due to the unimodality property of split-edges on a simple path, we onlyneed to compute the service costs for O(|B∗|) pairs of split-edges. After anO(n log 3n) time preprocessing, the service cost for each pair of split-edges canbe computed in O(log 3n) time, as we shown in Section 4.2.1. Therefore, wecan claim that

Theorem 4.12 The weighted continuous 2-center problem in a cactus graphcan be solved in O(n log 3n) time complexity. The storage space complexity isO(n log n).

5 The p-center problems

As mentioned earlier, Frederickson and Johnson [11] designed an O(n log n)-time algorithm for the unweighted V (G)/V (G)/p problem in a cactus. Theyshowed that the feasibility test in an unweighted cactus can be performed inlinear time (Lemma 13 in [11]). A service cost t for the demand points inG is said to be feasible if there exists a set F of facilities of size p such thatr(F,G) ≤ t. Using this linear-time feasibility test and a succinct representationof the set of all the inter-vertex distances, the unweighted p-center problemV (G)/V (G)/p in a cactus network is solvable in O(n log n) time [11].

5.1 Weighted V (G)/V (G)/p problem

Actually, the feasibility test described in [11] can also be applied for the casewhen the demand points (clients) are weighted. In this case, for a given ser-vice cost t, the demand points may now have different covering radii. We

17

present below a simple transformation that transforms the feasibility test inthe weighted model to a feasibility test in a unweighted model.

In the weighted model, we have a cactus where each demand point node vi

is associated with a nonnegative covering radius ri = t/wi. The problem isto find a subset of nodes F of minimum cardinality, such that for each nodevi, r(F, vi) ≤ ri. Lemma 13 in [11] provides an O(n) algorithm for the casewhere ri = R, for each i. We can convert the above weighted model to anequivalent unweighted model as follows. Each node vi of G is augmented by anew edge, say viv′i of length R − ri, where R = max{rj : vj ∈ V }. Let G′ bethe augmented graph with 2n nodes. G′ is clearly a cactus. We now associatea radius R with each node vi and v′i. The feasibility test on G is equivalent toa feasibility test on G′, and therefore can be done in linear time. Thus

Lemma 5.1 The feasibility test in a weighted model of the cactus can be per-formed in O(n) time.

Frederickson and Johnson [11] gave a succinct representation of the inter-vertex distances of the vertices of a cactus. The representation allows one toimplement an efficient binary search on the distances. Similarly, the set of allinter-vertex distances in a partial 2-tree has a special structure that enablessearching the set without explicitly generating the entire set in advance. In-deed, the set of inter-vertex distances can be implicitly represented by a set ofO(n log n) sorted lists. Each sorted list is associated with weighted distancesfrom a given weighted vertex u to some subset Vu of the vertices of G whoseshortest path distances to u pass through a separator vertex. These distancesto the separator vertex are kept in sorted order. There are O(log n) such sortedlists for every node u. In this way the inter-vertex distances of any partial 2-tree can be represented by a set of O(n log n) sorted lists. This representationis very similar to the succinct representation of all inter-vertex distances in atree proposed by Megiddo et al. [24]. Therefore, using the method proposedby Megiddo and Tamir [24], one can solve the discrete p-center problem in aweighted cactus graph for any p, in O(n log 2n) time.

Theorem 5.2 The weighted V (G)/V (G)/p problem in a cactus graph can besolved in O(n log 2n) time. The storage space requirement is O(n log n).

5.2 Weighted/unweighted A(G)/V (G)/p problem

From the fact that Lemma 5.1 is applicable also for the test correspondingto the weighted A(G)/V (G)/p model, we can obtain an O(n2) algorithm forthe weighted A(G)/V (G)/p problem. Since the numeric operations of the fea-sibility test are additions/sutraction and comparisons, we can directly applythe generic parametric algorithm of Megiddo [20] and get the O(n2) time al-

18

gorithm. Therefore

Theorem 5.3 The unweighted/weighted A(G)/V (G)/p problem in a cactusgraph can be solved in O(n2) time.

5.3 Unweighted A(G)/A(G)/p problem

The candidate set for A(G)/A(G)/p model for a general graph is characterizedin the paper of Tamir [26]. In spite of the nice structure, this set is not ofpolynomial cardinality even for cactii. Nevertheless, in the discussions belowwe show that A(G)/A(G)/p problem is efficiently solvable.

The idea is to use the feasibility test parametrically (Megiddo [20]). Let p(e)denote the number of centers established at optimality on an edge e of lengthl(e). Therefore, l(e)

2r∗ −1 ≤ p(e) ≤ d l(e)2r∗ e+1 where r∗ is the optimal service cost.

It is shown in [26] that p−m ≤ L2r∗ ≤ p + m where m and L are the number

of edges and the total length of the edges in G respectively. Therefore

max {0, l(e)(p−m)

L− 1} ≤ p(e) ≤ min {p, l(e)(p + m)

L+ 1}.

Hence p(e) can apriori be bounded in a range of length O(n) for cactusnetworks. In particular, when applying the test parametrically we will needO(log n) test per edge to find the exact value of p(e). An O(n log n) test for amore general class is mentioned in [13,26]. Therefore,

Theorem 5.4 The A(G)/A(G)/p problem can be solved in O(n2 log3 n) time.

6 Conclusion and Future Work

In this paper we have studied the center problems in a tree-like graph: cac-tus, and proposed non-trivial algorithms to solve a variety of problems. Theresults are summarized in Table 2. We have proposed, for the first time, a sub-quadratic algorithm to solve the weighted continuous 1 and 2-center problemsin a cactus graph. Since, unlike trees, the service cost function on an edge isnot convex in a cactus graph, a simple mechanism has been suggested thatforces convexity on an edge in a cactus graph. The convexity property allowsone to compute the local minimum service cost on an edge in O(log 3n) timethat requires O(n log2 n) time preprocessing. This is also true for other servicecost functions such as the median cost, minimum cost. The obnoxious cen-ter problem in a cactus network is to locate a facility in A(G) such that the

19

weighted minimum cost of the demand points is maximized. Since we can com-pute the local optimum minimum cost of the network on an edge in O(log3 n)time, therefore,

Theorem 6.1 The obnoxious center problem in a cactus graph can be solvedin O(n log 3n) time.

This improves the previous result of O(cn) where c is the number of distinctvertex weights used in the graph [30]. In the worst case c is O(n).

Many issues are still unresolved. For instance, it would be interesting to findout whether there exists an optimal linear-time algorithm for the weighted1-center problem in a cactus graph.

We conjecture that the weighted A(G)/V (G)/p problem can be solved in sub-quadratic time by designing a polylog parallel algorithm for the feasibilitytest, and using the results in Megiddo [22]. For example, we suspect that theO(log3 n) parallel time algorithm of Wang [29] for the test on trees, can beextended to cactii. If indeed, there is an O(logk n) parallel algorithm for cactii(with O(n) processors), Megiddo [22] implies an O(n logk+1 n) serial algorithmfor the weighted A(G)/V (G)/p problem on cactus graphs.

To obtain the result in Theorem 5.4 we have used an existing O(n log n) fea-sibility test. We suspect that an O(n) test for A(G)/A(G)/p can be derivedby properly modifying the test for V (G)/V (G)/p in [11]. This will lead to theimproved bound O(n2 log n) for A(G)/A(G)/p.

The most challenging problem is to find efficient algorithms to solve theweighted p-center problems in partial k-trees of bounded treewidth.

References

[1] R. Benkoczi, “Cardinality constrainted facility location problems in trees”, Ph.D.Thesis, School of Computing Science, SFU, Canada (2004).

[2] M.de Berg, M.van Kreveld, M. Overmars and O. Schwarzkopf, “Computationalgeometry: algorithms and applications”, 2nd ed. Springer-Verlag, Berlin,Germany (2000).

[3] H.L. Bodlaender, “A linear time algorithm for finding tree-decompositions ofsmall treewidth”, SIAM J. Comput. 25:6 (1996) 1305–1317.

[4] R.E. Burkard and H. Dollani, “Center problems with pos/neg weights on trees”,European J. Oper. Res. 145 (2003) 483–495.

[5] R.E. Burkard, H. Dollani, Y. Lin and G. Rote, “The obnoxious center problemon a tree”, SIAM J. Discrete Math. 14 (2001) 498–509.

20

[6] R.E. Burkard and J. Krarup, “A linear algorithm for the pos/neg-weighted 1-median problem on cactus”, Computing 60 (1998) 498–509.

[7] S. Chaudhuri and C. D. Zaroliagis, “Shortest paths in digraphs of smalltreewidth. Part I: sequential algorithms”, Algorithmica 27:3 (2000) 212–226.

[8] M.-L. Chen, R.L. Francis and T.J. Lowe, “The 1-center problem: Exploitingblock structure,” Transportation Science 22, 1988, 259–269.

[9] R. Cole, “Slowing down sorting networks to obtain faster sorting algorithms”, J.ACM 34 (1987) 200–208.

[10] G.N. Frederickson, “Parametric search and locating supply centers in trees”,Workshop on Algorithms and Data Structures (WADS) (1991) 299–319.

[11] G.N. Frederickson and D.B. Johnson, “Finding kth paths and p-centers bygenerating and searching good data structures”, J. Alg. 4 (1983) 61–80.

[12] D. Granot and D. Skorin-Kapov, “On some optimization problems on k-treesand partial k-trees”, Discrete Applied Math. 48 (1994) 129–145.

[13] Y. Gurevich, L. Stockmeyer and U. Vishkin, “Solving NP-hard problems ongraphs that are almost trees and an application to facility location problems”,J. ACM 31:3 (1984) 459–473.

[14] S.L. Hakimi, “Optimum location of switching centers and the absolute centersand medians of a graph”, Oper. Res. 12 (1964) 450–459.

[15] R. Hassin and A. Tamir, “Efficient algorithms for optimization and selection onseries-parallel graphs”, SIAM J. Alg. Disc. Math. 7:3 (1986) 379–389.

[16] J. Hershberger and S. Suri, “Off-line maintenance of planar configurations”, J.Alg. 21 (1996) 453–475.

[17] M. Jeger and O. Kariv, “Algorithms for finding p-centers on a weighted tree(for relatively small p)”, Networks 15 (1985) 381–389.

[18] O. Kariv and S.L. Hakimi, “An algorithmic approach to network locationproblems, Part I. The p-centers”, SIAM J. Appl. Math. 37 (1979) 513–538.

[19] Y.-F. Lan, Y.-L. Wang and H. Suzuki, “A linear-time algorithm for solvingthe center problem on weighted cactus graphs”, Inform. Process. Lett. 71 (1999)205–212.

[20] N. Megiddo, “Combinatorial optimization with rational objective functions”,Mathematics of Operations Research 4 (1979) 414–424.

[21] N. Megiddo, “Linear-time algorithms for linear programming in R3 and relatedproblems”, SIAM J. Comput. 12:4 (1983) 759–776.

[22] N. Megiddo, “Applying parallel computations algorithms in the design of serialalgorithms”, J. ACM 30 (1983) 852–865.

[23] N. Megiddo and A. Tamir, “New results on the complexity of p-centerproblems”, SIAM J. Comput. 12:4 (1983) 751–758.

21

[24] N. Megiddo, A. Tamir, E. Zemel and R. Chandrasekaran, “An O(n log 2n)algorithms for the kth longest path in a tree with applications to locationproblems”, SIAM J. Comput. 10:2 (1981) 328–337.

[25] M.B. Rayco, R.L. Francis and A. Tamir, “A p-center grid-positioning aggregatinprocedure”, Comput. & Oper. Res. 26 (1999) 1113–1124.

[26] A. Tamir, “On the solution value of the continuous p-center problem on agraph”, Mathematics of Operations Research 12 (1987) 345–363.

[27] A. Tamir, “Improved complexity bounds for center location problems onnetworks by using dynamic data structures”, SIAM J. Disc. Math. 1:3 (1988)377–396.

[28] A. Tamir, “Obnoxious facility location on graphs”, SIAM J. Discrete Math. 4(1991) 550–567.

[29] B.-F. Wang, “Finding r-dominating sets and p-centers on trees in parallel”,IEEE Trans. Parallel and Distributing Systems 15 (2004) 687–698.

[30] B. Zmazek and J. Zerovnik, “The obnoxious center problem on weighted cactusgraphs”, Disc. Appl. Math. 136 (2004) 377–386.

22

Appendix A: A Brief Description of the Two-Level TreeDecomposition

One of the most important properties of trees, which is useful in designingefficient algorithms, is the existence of a 1-separator between any two disjointsubtrees. Partial k-trees is more general class of graphs for which similar prop-erty is available. Such property is represented by a tree decomposition withbounded treewidth k, which can be found in linear time for fixed k [3]. In thiscase, there exists a k-separator between two subgraphs represented by twodisjoint subtrees of this tree decomposition.

a b

c

d

e

fg

h a, b, c b, g, h

b, c, g

c, g, d

d, e, f

2-separator {c, g}

(a) a cactus graph G (b) Tree decomposition TD of G

Fig. A-1. A cactus graph and its corresponding tree decomposition with tree-width2

Cactus graphs are partial 2-trees. There is an efficient linear-time algorithmto get a tree decomposition with treewidth 2 for a partial 2-tree [12]. Refer toFigure A-1. Assume that the tree decomposition TD(G) of G is known. Givena subgraph G′ represented by a subtree of TD(G), there is a 2-separator in G′

between G′ and a point outside G′. We preprocess the local information of G′

so that the service cost of an arbitrary facility (center) point located outsideof G′ to cover all the demand points in G′ can be quickly computed.

G′

pu1

u2

v

(a) (b)

δ1(v) = dv,u1 − dv,u2

Fig. A-2. 2-separator between p and G′

Refer to Figure A-2. Given any point p outside of G′, the service cost tocover v ∈ V (G′) is either w(v) · (dv,u1 + du1,p) or w(v) · (dv,u2 + du2,p) where{u1, u2} is the 2-separator of G′. Now the question is for a given p outsideG′, which of the paths to v should be used as the shortest path? Supposea = dp,u1 − dp,u2 and b = dv,u1 − dv,u2 . Clearly the shortest path from v top will go through u1 if a + b is negative, otherwise the shortest path fromv to p will go through u2. For each G′ of TD(G) we create two sorted lists

23

of increasing shortest path distance difference of all the vertices in G′ to theseparator vertices u1 and u2: δ1(v) = dv,u1 − dv,u2 and δ2(v) = dv,u2 − dv,u1

for all v ∈ G′. These two lists δ1 and δ2 are associated with the separatorvertices u1 and u2 respectively. We build two balanced binary search trees onsorted lists δ1 and δ2, (see Figure A-2(b)). Each search tree node representsthe set of vertices of G′ whose shortest path differences are in its subtree.At each node of the balanced binary search tree corresponding to δ1 (δ2), weprecompute the service cost function (weighted) of the vertices represented bythe search tree node with the origin at u1(respectively u2). For a given point poutside G′ that covers the vertices via {u1, u2}, there are O(log |G′|) sublists ofvertices, determined by δ1, whose shortest paths to p go through u1 and thereare O(log |G′|) sublists of vertices, determined by δ2, whose shortest paths to pgo through u2. These lists can be identified in O(log |G′|) time. The maximumservice cost of p to the vertices in a sublist can be computed in logarithmictime. Therefore, the total cost of computing the maximum service cost to thevertices in G′ is O(log2 |G′|). Note that the distance of p to u1 and u2 can becomputed in constant time after almost linear time preprocessing [7].

Since the tree decomposition TD(G) of G need not be balanced, we add an-other balanced tree structure over TD(G) such that the height of the newtree TD(G) is logarithmic. There are several methods to achieve this, such ascentroid tree decomposition, top-tree decomposition, spine tree decompositionetc [1]. Here, we prefer the spine tree decomposition which rearranges TD(G)to TD(G) because any algorithm developed using TD(G) extends to TD(G)naturally. Please refer to [1] for more details. In Fig.A-3, the bold part isTD(G). After the two-level tree decomposition of G, for each node in TD(G),there are O(log n) rooted subtrees of TD(G) containing all the other nodesin TD(G). Another important property of spine tree decomposition is thateach rooted subtree of TD(G), say Tx rooted at x, communicates with therest of the nodes in TD(G) via at most two nodes x1 and x2 of Tx. Hence, thepreprocessing step for each rooted subtree (corresponding to G′ in G) takesO(|G′| log |G′|) time (at most two 2-separators are needed to be considered).Thus, we get the following lemma:

Lemma A-1.2 The complete two-level tree decomposition data structure in apartial 2-tree can be computed in O(n log 2n) time requiring O(n log n) storagespace.

In particular, for each vertex in V (G) there are O(log n) sbgraphs, representedby rooted subtrees of TD(G), that contain the rest of the vertices in G. More-over, for every point p in A(G) (let uv be the edge containing p and let xbe the node in TD(G) containing both u and v) there are O(log n) rootedsubtrees of TD(G) containing all the vertices in G.

24

x

Tx

x2x1

root

Fig. A-3. An example of spine tree decomposition

Since distance queries in partial k-trees can be answered in constant time afteralmost linear-time preprocessing for fixed k [7], the following lemma is easyto establish.

Lemma A-1.3 The service cost of a point in a partial 2-tree can be answeredin O(log 2n) by the two-level tree decomposition data structure.

It’s not hard to see that this result can be extended to other service costfunctions such as the median cost, minimum cost (obnoxious).

25