- Email: [email protected]

A constrained minimum spanning tree problem夽 Guangting Chen *, Guochuan Zhang Hangzhou Institute of Electronics Engineering, Hangzhou 310037, People's Republic of China Institute of Mathematics, Zhejiang University, Hangzhou 310027, People's Republic of China Received 1 April 1998; received in revised form 1 April 1999

Abstract In this paper, we give an O(n) algorithm for "nding a point on a given line l which, if added to a given set of n points located on one side of l, will result in the minimum spanning tree. Scope and purpose The minimum spanning tree problem is one of the most important fundamental problems in combinatorial optimization. In this paper we consider a variant of such a problem which models a location problem. Given a line and a point set N located on one side of the line, the goal is to "nd just one point P on the line such that the minimum spanning tree for N6+P, is the shortest possible, which is denoted as the constrained minimum spanning tree problem (CMSTP). This problem has many applications in the real world such as transportation, communication, or location of some facilities. We apply the divide-and-conquer technique to reduce the complexity of our problem and provide an O(n) algorithm. 2000 Published by Elsevier Science Ltd. All rights reserved. MSC: 90C27; 68Q25 Keywords: Spanning tree; Divide-and-conquer; Algorithm

1. Introduction Suppose there are some residential quarters on the same side of a river, and we want to establish a waterworks on the bank of the river to supply these quarters. Our goal is to "nd a location for the waterworks so that the length of pipe used is as short as possible. 夽

This work has been supported by the National Natural Science Foundation of China (Grant No. 19801032) and National 973 Fundamental Research Project of China on Applied Theory and High-Performance Software for IT. * Corresponding author. E-mail addresses: [email protected] (G. Chen), [email protected] (G. Zhang) 0305-0548/00/$ - see front matter 2000 Published by Elsevier Science Ltd. All rights reserved. PII: S 0 3 0 5 - 0 5 4 8 ( 9 9 ) 0 0 0 6 1 - 1

868

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

Such a problem can be described as the following model. Let l be a straight line and N"+A , 2, A , be a set of n points in the Euclidean plane. All points of N are located on the same L side of l. The problem is to "nd a point P in l so that the length of ¹ is minimum where ¹ is the spanning tree of N6+P,. We de"ne this problem as the constrained minimum spanning tree problem (CMSTP) and ¹ as the constrained minimum spanning tree (CMH(N)). It is known that the minimum spanning tree (MST) problem can be solved in O(n log n) time when the points to be connected are on the plane, and the distance is the Euclidean distance [1]. For the CMSTP, it can be solved in polynomial time. If e and e are two edges connected to P in CMH(N), the angle formed by e and e is at least 603. Thus there are at most three points of N adjacent to P. Obviously an exhaustive O(n log n) algorithm can be immediately derived. In this paper we introduce a kind of partition of the line l which applies the technique of divide-and-conquer and give an e$cient way to update a minimum spanning tree. Finally we present an O(n) algorithm for the CMS¹P, and two computational examples are given to show how the algorithm works.

2. Partitioning the line l We regard l as a number axis. All points in N are located on the upper side of l. The coordinates of the leftmost point and the rightmost point are 0 and t, respectively. Then the point P we want to determine is in the interval [0, t]. Let h and h be two directions on the plane, we denote by k(x, h , h ) the cone with vertex x and limiting angles h and h , where x is a point on l and its coordinate denoted also by x is in [0, t]. The cone k(x, h , h ) is shown in Fig. 1. For any point A3N, de"ne the proximity set of A about N as R (A, h , h )"+x " x3l5[0, t], A is the closest point to x and A3N5k(x, h , h ),. , R (A, h , h ) consists of some intervals. These intervals are called proximity intervals of A about N. , The proximity set of N is de"ned as the set composed of all the proximity intervals of all points in N.

Fig. 1

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

869

Lemma 2.1. Let A , A 3N, A OA . Assume that I and I are proximity intervals of A and A , respectively. Then I and I have at most one common point, i.e., "I 5I ")1. If y3I 5I , y is the crossing point of l and the perpendicular bisector of A and A . Proof. If y3I 5I , y3R (A , h , h )5R (A , h , h ). Then "A y"""A y", i.e., y is the crossing point , , of l and the perpendicular bisector of A and A . Moreover, y is unique. 䊐 This lemma implies that two end points of each proximity interval belong to either E or E , where E "+x " x3l5[0, t], and x is the crossing point of l and a line l with direction h or h through some point of N, E "+x " x3l5[0, t], and x is the crossing point of l and the perpendicular bisector of any two points of N, Therefore, the number of proximity intervals is no more than C#2n)n for n*3, where L C"n(n!1)/2. L We will apply the technique of divide-and-conquer [1] to "nd the proximity set of N. Given a recursive procedure as follows: 1. Divide N into two parts N and N with almost equal number of points. `Almost equal numbera means that the di!erence between two numbers is not more than one. 2. Determine the proximity sets of N and N , respectively. Denote them by S and S . 3. Overlaying all proximity intervals in S and S , we get a new set denoted by S. 4. Check and classify all intervals [a, b] in S. If [a, b] is a subinterval of R (A, h , h ) and also , a subinterval of R (B, h , h ), "nd the crossing point c of the line l and l , where l is the , perpendicular bisector of A and B. Without loss of generality, A is on the left-hand side of l while B is on the right-hand side of l . If a(c(b, [a, c]3R (A, h , h ) and , (c, b]3R (B, h , h ); if c)a, [a, b]3R (B, h , h ); if b)c, [a, b]3R (A, h , h ). , , , Let ¹(n) denote the time complexity by using divide-and-conquer [1]. ¹(n) consists of two parts: One is 2¹(n/2) and another is for overlaying two proximity sets. Since the number of proximity intervals is no more than n, the overlaying can be solved in no more than n time. ¹(n))2¹(n/2)#n. Analogously, ¹(n/2))2¹(n/4)#n/4, ¹(n/4))2¹(n/8)#n/16 , 2 Thus we have ¹(n))n#n/2#n/4#2#n/2 L)2n.

870

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

Determine the proximity sets with respect to the angles [03, 603], [603, 1203] and [1203, 1803], respectively. Overlaying these proximity intervals, we get the "nal partitioning of l in which each interval R corresponding to three points A, B, C such that R is just the proximity intervals of A, B and C, respectively, with angles [03, 603], [603, 1203] and [1203, 1803]. Denote the connection set of R by C(R)"+A, B, C,. Note that sometimes C(R) only contains one or two points.

3. The modi5cation of MST Let R be one of the proximity intervals obtained from Section 2, and x3R, C(R)"+A, B, C,. Theorem 3.1. In the MST of N6+x,, x is adjacent only with the point of C(R). Proof. Let Q be an adjacent point of x in the MST of N6+x, and Q,C(R). Without loss of generality, suppose Q and A both belong to k(x, 03, 603). Case 1: x is not in the path from A to Q in the MST. Since x3R (A, 03, 603), "xA"("xQ". , Substituting xQ by xA, we get a spanning tree of N6+x, shorter than the MST. It is a contradiction. Case 2: x is in the path from A to Q in the MST. Consider *QAx, obviously LAxQ(603, thus AQ is not the largest edge of *QAx. On the other hand, x3R (A, 03, 603), we have "xA"("xQ". , Therefore "xQ"'"AQ". Substituting xQ by AQ, we get a spanning tree of N6+x, shorter than the MST. It is also a contradiction. 䊐 In the following, we introduce two lemmas. Lemma 3.1. Let N"+A , A , 2, A , be a set of n points on the same side of l, P a point on l and L MH(N) a minimum spanning tree of N. For A , A 3N (iOj), e is the longest edge in the path from G H GH A to A in MH(N). Then ¹ is the minimum spanning tree of N6+P, under the condition that A and G H GH G A are just the two points in N adjacent to P, where ¹ "MH(N)!+e ,6+A P, A P,. H GH GH G H Lemma 3.2. N, P and MH(N) are dexned as above. A , A and A are any three points in N. P is the G H I GH path from A to A in MH(N) and e is the largest edge in P . Analogously, we can dexne P , P as well G H GH GH HI GI as e , e . Then we have: (1) Just two of e , e and e are the same edge; (2) Suppose that e Oe , then HI GI GH HI GI GH HI ¹ is the minimum spanning tree of N6+P, under the condition that A , A and A are just three points GHI G H I in N adjacent to P, where ¹ "MH(N)!+e , e ,6+A P, A P, A P,. GHI GH HI G H I Proof. (1) Since MH(N) is a tree, then the union of the edge set of every two paths from P , P and GH HI P must contain that of the third one. Moreover, every edge in P , P or P just belongs to two of GI GH HI GI P , P and P . Hence, it is impossible that e , e and e are three edges distinct from each other. It GH HI GI GH HI GI is also impossible that these three edges are the same. In other words, there are just two of these edges which are same and they are distinct from the third one. Moreover, the third one is the shortest one among the three edges. (2) Suppose that ¹ is the minimum spanning tree of N6+P, under the condition that A , A GHI G H and A are just three points in N adjacent to P. We should prove that the length of ¹ is the same I GHI

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

871

as that of ¹ . Delete the point P and three edges A P, A P and A P from ¹ , we have three GHI G H I GHI connected components C , C and C which contain A , A and A , respectively. Furthermore, G H I G H I C , C and C are minimum spanning trees of <(C ), <(C ) and <(C ), respectively, where <(G) is the G H I G H I vertex set of graph G. Find a vertex B from C and B from C such that the distance between B and G G H H G B is the shortest from vertex of C to that of C and let e "B B . By the same token, we have H G H GH G H e and e . Connecting C , C and C by two shortest edges among e , e and e , we get a spanning GI HI G H I GH GI HI tree of N and it is clear that this tree is a minimum spanning tree of N, denoted by ¹ . Firstly, assume that e and e are both shorter than e . Then we have a path from A to A in GH HI GI G H ¹ such that e is the longest edge in this path. Otherwise, we have a path from A to A in ¹ such GH G H that e is not the longest edge in this path. Then we delete the longest edge in this path from GH ¹ and add e to ¹ . We obtain a tree under the same condition as ¹ but the length of this tree GHI GH GHI GHI is shorter than that of ¹ . It is a contradiction. Analogously, we can show that e is the longest GHI HI edge in the path from A to A in ¹ . Therefore, we can prove that the length of e equals that of H I GH e and the length of e equals that of e . Thus the whole length of ¹ equals that of ¹ . If it is not GH HI HI GHI GHI true, suppose that e is longer than e , then it is obvious that MH(N) does not coincide with ¹ . The GH GH path from A to A in MH(N) united with that in ¹ must contain a circle. On the other hand, there G H is an edge e in this circle such that e is not in ¹ and the length of e is smaller than that of e . In fact, GH the edge e is in the path from A to A in MH(N) and the length of e is not larger than that of e . G H GH Then, ¹ !+e ,6+e, is a spanning tree of N shorter than ¹ . It is a contradiction. Similarly, we can GH show that e is not shorter than e , so we have the conclusion that the length of e equals that of e . GH GH GH GH Moreover, we can prove that the length of e and the length of e are the same. Then we conclude HI HI that the whole length of ¹ equals that of ¹ . GHI GHI Secondly, suppose that e and e are both shorter than e . Same way, we can prove that e and GH GI HI GH e have the same length, and e and e have the same length too. If the length of e is larger than GH GI GI GH that of e , then e and e are same according to the results in (1) of this lemma. The longest edge in HI GH GI the path from A to A in ¹ is e or e , and the longest edge in the path from A to A in MH(N) is H I GI GH H I e . We can also prove that these two edges have the same length. Then e has the same length as HI HI e or e , i,e, the three edges e , e and e have the same length. Therefore, the length of e plus that GI GH GH HI GI GH of e equals the length of e plus that of e . Finally, we get the conclusion that the length of ¹ and GI GH HI GHI the length of ¹ are the same. 䊐 GHI Suppose that ¹ is the MST of the point set N, and i, j is any pair of points in N, E(i, j) is the largest edge in the path from i to j in ¹. The time complexity for getting ¹ and all E(i, j) is O(n). For the interval R and the set C(R), let S be a subset of C(R) and x be a point in R such that the sum of distances from x to each point in S is minimized. We have the following method to update the MST: E S is a singleton, i.e., S"+A,, then the MST of N6+x, is +xA,6¹. E S consists of two points, such as S"+A, B,, then the MST of N6+x, is +xA, xB,6¹!+E(A, B),. E S"+A, B, C,, then the MST of N6+x, is +xA, xB, xC,6¹!+e , e ,, where e and e are two di!erent edges of E(A, B), E(B, C) and E(A, C). For the interval R, by comparing the MST for all the subsets SLC(R), we can get the shortest MST of N6+x, and x3R.

872

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

4. The O(n2) algorithm Algorithm B: Step 1: Find all proximity intervals for each point of N with respect to angles [03, 603], [603, 1203] and [1203, 1803], respectively. Step 2: Overlaying these proximity intervals, we get a partitioning of l in which each interval R corresponds to a set C(R). Step 3: Solve the minimum spanning tree problem for the points set N. Denote by ¹ and l(¹) the resulting tree and its length, respectively. For any pair i, j of points in N, denote by E(i, j) the longest edge in the path from i to j in ¹. Step 4: For any proximity interval R, "nd a point x3R and the minimum spanning tree of N6+x, by applying the method in Section 3. Step 5: Choose the shortest one from all minimum spanning trees produced in Step 4. Sections 2 and 3 guarantee the correctness of this algorithm. Now, let us count the time complexity of our algorithm. Step 1 takes O(n) time. The complexity in Steps 2 and 3 is not over O(n) either. In Step 4, for each interval R, C(R) consists of at most three points. It can be calculated in constant time. Moreover, the number of intervals is no more than n. Step 5 also takes O(n) time. Therefore, the complexity of our algorithm is O(n).

5. Computational examples In this section, we present two examples to see how the algorithm B works. Example 1. The set of given points is shown in Fig. 2. The coordinates of points are as follows: A (0, 0.8) A (1, 7.5) A (1.3, 8) A (3.5, 6.5) A (4.2, 7.2) A (4.6, 7), A (7, 0.6) A (8, 1.2) A (9, 1.5) A (9.1, 0.9) A (11, 1.5). The computational results are presented as follows: 1. Get a partitioning of [0, 11] in which each interval R corresponds to a set C(R). R "[0, 0.4619], C(R )"+A , A ,, R "[0.4619, 6.6536], C(R )"+A , A , A ,, R "[6.6536, 7.3072], C(R )"+A , A , A ,, R "[7.3072, 7.3464], C(R )"+A , A , A ,, R "[7.3464, 8.5804], C(R )"+A , A , A ,, R "[8.5804, 8.6928], C(R )"+A , A , A ,, R "[8.6928, 9.6196], C(R )"+A , A , A ,, R "[9.6196, 9.8661], C(R )"+A , A , A ,, R "[9.8661, 11], C(R )"+A , A ,. Note that the number of intervals is 9, much less than 11.

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

873

Fig. 2

2. Find the minimum spanning tree ¹ of the points set N"+A , A , 2, A , as in Fig. 2. The length of ¹ is 22.9056. 3. For any proximity interval R, "nd a point x3[0, 11] and the minimum spanning tree of N6+x,. Then choose the shortest one from all the minimum spanning trees as CMH(N). For this example, CMH(N) is ¹6+BA , BA , BA ,!+A A , A A ,, where ¹ is the MST of N. The coordinate of B is (3.5613, 0) and the length of CMH(N) is 23.1348. Surely B is the solution point of this CMSTP. Example 2. The set of given points is shown in Fig. 1. The coordinates of the points are presented as follows: A (0, 1.1) A (0.7, 0.7) A (0.9, 0.2) A (2.3, 2.3) A (2.7, 3.4) A (3.4, 2), A (4.5, 0.9) A (5, 1.8) A (6.4, 1.1) A (8, 1.3) A (8.7, 0.2) A (9.1, 2.3). The following is the computational results of this example. 1. Get a partitioning of [0, 9.1] in which each interval R corresponds to a set C(R). R "[0, 0.2958], R "[0.2958, 0.6351], R "[0.6351, 0.7845], R "[0.7845, 0.9721], R "[0.9721, 1.0155], R "[1.0155, 1.1042], R "[1.1042, 2.2453], R "[2.2453, 2.2636], R "[2.2636, 3.6279], R "[3.6279, 3.9804], R "[3.9804, 4.5547], R "[4.5547, 5.0196], R "[5.0196, 5.7649], R "[5.7649, 7.0351],

C(R )"+A , A ,, C(R )"+A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,, C(R )"+A , A , A ,,

874

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

Fig. 3

R "[7.0351, 7.1714], C(R )"+A , A ,, R "[7.1714, 8.5845], C(R )"+A , A , A ,, R "[8.5845, 8.7506], C(R )"+A , A ,, R "[8.7506, 8.8155], C(R )"+A , A ,, R "[8.8155, 9.1], C(R )"+A ,. Note that the number of intervals is much less than 12. 2. Find the minimum spanning tree ¹ of the points set N"+A , A , 2, A , as in Fig. 3. The length of ¹ is 14.4711. 3. For any proximity interval R, "nd a point x3[0, 9.1] and the minimum spanning tree of N6+x,. Then choose the shortest one from all the minimum spanning trees. In this example, the shortest one is ¹6+BA , (or ¹6+CA ,), where ¹ is the MST of N, and B and C are (0.9, 0) and (8.7, 0), respectively. The solution point of CMSTP in l is B or C. The length of CMH(N) is 14.6711.

6. Conclusions In this paper, we consider a variant of minimum spanning tree problem in which given a straight line l and a points set N on one side of l, we are asked to "nd a point x from l such that the resulting spanning tree is the shortest. A related problem, called the 1-Steiner tree problem, is studied in [2] in which the authors give an O(n) algorithm for "nding the point on the plane which, if added to a given set of n points, will result in the shortest possible spanning tree. Observe that the two problems are quite di!erent. In the 1-Steiner tree problem, the Steiner point must be located inside the convex hull of the given point set while in our problem the added point is restricted in the given line which is beyond the given point set. Furthermore, we use the divide-and-conquer technique to reduce the number of proximity intervals and obtain an O(n) algorithm. Finally two computational examples are shown.

Acknowledgements The authors wish to thank Prof. Rainer E. Burkard for valuable suggestions and two anonymous referees for helpful comments.

G. Chen, G. Zhang / Computers & Operations Research 27 (2000) 867}875

875

References [1] Preparata FP, Shamos MI. Computational Geometry } An Introduction. New York: Springer, 1985. [2] G. Georgakopoulos, C. Papadimitriou, The 1-Steiner tree problem. Journal of Algorithms 1987;8:122}30.

Guangting Chen received the B.S. degree in East China Normal University, and the M.S. degree from Zhejiang University, P. R. China. Now he is pursuing his Ph.D in Operational Research at Zhejiang University. He is also an Associate Professor in Hangzhou Institute of Electronics Engineering. His research intrest includes combinatorial optimization, Steiner tree problem, graph theory, etc. Guochuan Zhang received his Ph.D in applied mathematics from the Chinese Academy of Science in 1995. He is currently an Associate Professor in the Department of Applied Mathematics at Zhejiang University, P. R. China. His research interests are in discrete optimization in particular, in packing, scheduling and approximation algorithms. He has published a number of papers in international journals such as Discrete Applied Mathmetics, Computing, Computers and Operations Research and Information Processing letters, etc.

Copyright © 2023 C.COEK.INFO. All rights reserved.