a polynomial time algorithm for rectilinear steiner trees with terminals constrained to curves

11
A Polynomial Time Algorithm for Rectilinear Steiner Trees with Terminals Constrained to Curves M. Brazil, D. A. Thomas, J. F. Weng Department of Electrical and Electronic Engineering, The University of Melbourne, Victoria 3052, Australia Received 8 December 1997; accepted 4 March 1998 Abstract: The rectilinear Steiner problem is the problem of constructing the shortest rectilinear network in the plane connecting a given set of points, called terminals. The problem is known to be NP-complete in general. In this paper, we show that there is a polynomial time algorithm for solving the rectilinear Steiner problem for the case where terminals are constrained to lie on almost any fixed set of simple disjoint compact curves. q 1999 John Wiley & Sons, Inc. Networks 33: 145–155, 1999 1. INTRODUCTION can be determined in linear time. In 1977, Garey and Johnson [4] showed that the rectilinear Steiner problem Consider a finite set of n points, called terminals, in the is NP-complete; hence, it almost certainly cannot be plane. The rectilinear Steiner problem asks us to find a solved by a polynomial time algorithm (unless P Å NP). minimum rectilinear network connecting these points, that Since then there has been considerable interest in ex- is, a network such that the sum of the lengths of all the amining cases which can be shown to be solved in polyno- edges, measured under the rectilinear metric, is as small mial time by restricting the arrangement of the terminals as possible (over all choices of suitable networks). Such in the plane. Most of this research has concentrated on a network is clearly a tree and is usually referred to as a the case where the entire set of terminals lies on the rectilinear Steiner minimal tree. The vertices of degree boundary of its rectilinear convex hull or on generaliza- 3 or more in the tree that are not terminals are known as tions of this case. In [7], Richards and Salowe presented Steiner points. The rectilinear Steiner problem has numer- an algorithm that runs in O ( n 5 ) time or linear time if the ous applications, particularly in VLSI layout design and number of edges of the convex hull is bounded. Subse- is also of considerable theoretical interest in the area of quently, Cheng and Tang [3] improved the running time network optimization. to O ( n 3 ). Kaufmann et al. [6] and Cheng [2] indepen- The principal difficulty in solving the rectilinear dently developed O ( n 4 ) time algorithms that generalize Steiner problem for a given set of terminals lies in de- this to the case where the terminals lie on the boundary termining the graph structure of the minimum tree. Once of any simple rectilinear polygon but the network is also this is decided, the actual locations of the Steiner points constrained to lie in that polygon. Bern and Bienstock [1] generalized the algorithm for extremal points in a different direction, showing that if there exists a bound l Correspondence to: D. A. Thomas Contract grant sponsor: Australian Research Council such that the operation of deleting the terminals lying on q 1999 John Wiley & Sons, Inc. CCC 0028-3045/99/020145-11 145 / 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Upload: j-f

Post on 06-Jun-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

A Polynomial Time Algorithm for RectilinearSteiner Trees with TerminalsConstrained to Curves

M. Brazil, D. A. Thomas, J. F. Weng

Department of Electrical and Electronic Engineering, The University of Melbourne,Victoria 3052, Australia

Received 8 December 1997; accepted 4 March 1998

Abstract: The rectilinear Steiner problem is the problem of constructing the shortest rectilinear networkin the plane connecting a given set of points, called terminals. The problem is known to be NP-completein general. In this paper, we show that there is a polynomial time algorithm for solving the rectilinearSteiner problem for the case where terminals are constrained to lie on almost any fixed set of simpledisjoint compact curves. q 1999 John Wiley & Sons, Inc. Networks 33: 145–155, 1999

1. INTRODUCTION can be determined in linear time. In 1977, Garey andJohnson [4] showed that the rectilinear Steiner problem

Consider a finite set of n points, called terminals, in the is NP-complete; hence, it almost certainly cannot beplane. The rectilinear Steiner problem asks us to find a solved by a polynomial time algorithm (unless P Å NP).minimum rectilinear network connecting these points, that Since then there has been considerable interest in ex-is, a network such that the sum of the lengths of all the amining cases which can be shown to be solved in polyno-edges, measured under the rectilinear metric, is as small mial time by restricting the arrangement of the terminalsas possible (over all choices of suitable networks) . Such in the plane. Most of this research has concentrated ona network is clearly a tree and is usually referred to as a the case where the entire set of terminals lies on therectilinear Steiner minimal tree. The vertices of degree boundary of its rectilinear convex hull or on generaliza-3 or more in the tree that are not terminals are known as tions of this case. In [7] , Richards and Salowe presentedSteiner points. The rectilinear Steiner problem has numer- an algorithm that runs in O(n 5) time or linear time if theous applications, particularly in VLSI layout design and number of edges of the convex hull is bounded. Subse-is also of considerable theoretical interest in the area of quently, Cheng and Tang [3] improved the running timenetwork optimization. to O(n 3) . Kaufmann et al. [6] and Cheng [2] indepen-

The principal difficulty in solving the rectilinear dently developed O(n 4) time algorithms that generalizeSteiner problem for a given set of terminals lies in de- this to the case where the terminals lie on the boundarytermining the graph structure of the minimum tree. Once of any simple rectilinear polygon but the network is alsothis is decided, the actual locations of the Steiner points constrained to lie in that polygon. Bern and Bienstock

[1] generalized the algorithm for extremal points in adifferent direction, showing that if there exists a bound lCorrespondence to: D. A. Thomas

Contract grant sponsor: Australian Research Council such that the operation of deleting the terminals lying on

q 1999 John Wiley & Sons, Inc. CCC 0028-3045/99/020145-11

145

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 2: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

146 BRAZIL, THOMAS, AND WENG

trees (or networks) as being embedded in the Euclideanplane and as having edges composed of a combination ofhorizontal and vertical straight-line segments. A point ofdegree two where a horizontal line segment and verticalline segment meet which is not a terminal is called acorner point, but is not considered to be a vertex of thetree. Let T be a rectilinear Steiner tree on a terminal setX . Recall that T is said to be full if all vertices that arenot leaves are Steiner points. Similarly, a subtree of T isFig. 1. A pair of disjoint curves on the plane.said to be a full component of T if all leaves of the subtreeare terminals and all vertices that are not leaves are Steinerthe boundary of the set’s rectilinear convex hull can onlypoints. A full component is said to be trivial if it is simplybe repeated l times before the set is empty then there isan edge joining two terminals and nontrivial if it containsan O(n 6 l01) time algorithm. Here, l is usually referred toone or more Steiner points. Every maximal line segmentas the number of layers of the terminal set.in a full component of T is referred to as a complete line.There are, however, large classes of terminal sets, inTwo complete lines that meet at a corner point and whosewhich not all terminals are extremal points, for whichother endpoints are terminals are said to constitute a com-existing algorithms cannot be applied but where the recti-plete corner.linear Steiner problem is polynomially solvable. Suppose,

The grid graph of X is defined to be the graph whosefor example, that we restricted the terminals to lying onvertices are all the intersections of the horizontal andthe two curves shown in Figure 1. This case is not coveredvertical lines through each terminal and whose edges areby any of the above algorithms, but is, not surprisingly,the horizontal and vertical line segments connecting adja-polynomially solvable. In this paper, we consider thecent grid points. Let Y be the subset of X lying on theproblem of constructing a minimum rectilinear networkboundary of a rectilinear convex hull of X . We definefor a set of terminals which are restricted to lie on anythe restricted grid graph of X , denoted R(X ) , to be thefixed set of disjoint curves in the Euclidean plane. Wemaximal subgraph of the grid graph of X such that Y lieswill show that if the curves are compact (and, hence,on the boundary of the rectilinear convex hull of thefinite) the network can be constructed in polynomial time.vertices of R(X ) . This is illustrated in Figure 2.The precise statement of this result is in Theorem 2.2.

Throughout this paper, we will assume that T is inThe degree of the polynomial in the proof of this theoremcanonical form. In other words, we will assume each fullis generally quite high and is dependent on the nature ofcomponent of T consists of a single complete line orthe constraining curves, so we make no attempt to deter-complete corner with alternating incident segments. Thismine it precisely. This parallels similar recent results forassumption can be made without loss of generality sincethe Euclidean Steiner problem [8] and the traveling sales-there always exists a minimal rectilinear Steiner tree ofman problem [9]. Note that the cases that we considerthis form. (See, e.g., [5, Part III, Sect. 1.3] .) Note thatin this paper can only be solved by existing extremalthis implies that T lies on R(X ) .point algorithms if the set of curves form part of the

A useful observation about minimum rectilinear net-boundary of a rectilinearly convex region.works is that parallel edges must always be relativelyIn Section 2, we establish some basic notation and defini-

tions and prove a few general preliminary lemmas. Theproof of Theorem 2.2 is in two parts: We first consider aslightly simplified version of the theorem where the con-straining curves are assumed not to contain any pointsknown as abnormal points, which include points with hori-zontal or vertical tangent. This case is proved in Section 3.In Section 4, we extend this proof to the general case. Theinclusion of abnormal points means that the structure ofminimum rectilinear networks can be much more compli-cated, but we will show that this added complexity is con-fined to specific regions and that the parts of the networkwithin those regions can be constructed using existing algo-rithms for polynomially solvable cases.

2. PRELIMINARIESFig. 2. The restricted grid graph for a set of terminals (de-

We begin with some background and definitions. For the picted by circles) . The black circles indicate the terminalsin Y .purposes of this paper, we think of all rectilinear Steiner

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 3: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

ALGORITHM FOR RECTILINEAR STEINER TREES 147

widely spaced. This is made precise in the following C without crossing it, then p is said to be ambiguouslyabnormal.lemma:

Note that if C is smooth at an abnormal point p thenp has either a vertical or horizontal tangent. Also noteLemma 2.1. Let T be a minimum rectilinear networkthat if p is abnormal then it cannot lie in the interior ofand let L and L* be two horizontal or vertical parallela rectilinear segment (although it may be an endpoint oflines a distance r apart. Suppose that e0 and e1 are disjointa rectilinear segment) . Intuitively, one way of thinkingparallel line segments contained in two edges of T suchof an abnormal point is that if either coordinate of thethat e0 and e1 both intersect L orthogonally. If e0 and e1direction vector of a particle traveling along C changesboth intersect L *, then the distance between e0 and e1 issign on passing through p then p is abnormal. If bothat least r.coordinates change sign, then p is ambiguously abnormal.

Proof. Let e0 and e1 intersect L at a0 and a1 , respec- For the remainder of this paper, let G Å < Gi be atively, and intersect L * at b0 and b1 , respectively, as illus- finite union of disjoint compact curves embedded in thetrated in Figure 3. Suppose, contrary to the lemma, that plane, each of which contains a finite number of abnormalthe distance between e0 and e1 is less than r . If the path points and rectilinear segments. If all terminals of a mini-in T from a0 to a1 passes through b0 , then we can replace mum rectilinear network lie on G , we describe the prob-the line segment a0b0 by a0a1 to create a shorter tree lem of constructing such a network as the G-constrainedspanning the same terminals. Otherwise, we can replace rectilinear Steiner problem. The central theorem whicha0b0 by b0b1 to create a shorter tree. This contradicts the we prove in this paper is the following:minimality of T . j

Theorem 2.2. Let G be a finite union of disjoint compactThroughout this paper, we will assume that all curves curves embedded in the plane, containing a finite number

that we refer to on the Euclidean plane are simple continu- of abnormal points and rectilinear segments. Then, thereous curves and are smooth almost everywhere, that is, is a polynomial time algorithm for the G-constrained rec-curves may contain a discrete set of points which are tilinear Steiner problem.nondifferentiable. Let C be a compact curve on the Eu-clidean plane. Clearly, the compactness implies that C Note that in the above theorem we treat the set Gmust have finite length. A segment of C is said to be a as a given quantity. We ignore the complexity of therectilinear segment if it is a maximal closed straight-line presentation of G and the terminals, and we assume thatsegment which is either vertical or horizontal. A point p elementary geometric constructions (such as locating ab-on C is said to be abnormal if p is not an endpoint of C normal points and rectilinear segments, finding a positiveand if for some small neighborhood N(p) around p it is lower bound for the minimum distance between two dis-possible to construct a horizontal or vertical line that joint curves, and constructing a rectilinear neighborhoodtouches (without crossing) C in N(p) only at p . An ab- around a curve) can be performed in bounded time.normal point p is said to be horizontally (or vertically) Hence, ‘‘polynomial time’’ refers to time polynomial onlyabnormal if the line touching C at p is necessarily hori- in n , the number of terminals.zontal (or, respectively, vertical) . If, on the other hand, The general strategy for proving this theorem is toboth the vertical and horizontal lines through p touch show that we can construct a small neighborhood, Ni (1) ,

around each curve Gi such that the following two condi-tions are satisfied:

( i) A bounded number of edges of a G-constrainedrectilinear minimum network cross the boundary of eachNi (1) ; and

(ii) each Ni (1) contains a bounded number of Steinerpoints except possibly in small regions surrounding anyabnormal points.

Note that each of the parts of a G-constrained rectilin-ear minimum network lying outside the Ni (1)’s intercon-nects points where the network meets the boundaries ofthe Ni (1)’s, and, hence, there are a bounded number ofSteiner points outside the Ni (1)’s by Condition (i) .Fig. 3. The tree containing e0 and e1 is not minimal if Éa0a1É

õ r . The above two conditions will follow from a careful

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 4: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

148 BRAZIL, THOMAS, AND WENG

definition of Ni (1) . In Section 4, we will show that they Lemma 2.4. The length of any G-constrained minimalrectilinear Steiner tree T is bounded above.allow us to develop a polynomial time algorithm for con-

structing a G-constrained rectilinear minimum networkProof. First note that, for any two points a and b ,for any set of terminals on the curves. The main problem

dR(a , b) °√2dE(a , b) . Given a curve Gi of G , let Xiin developing the algorithm lies in efficiently building the

be the set of terminals of T lying on Gi . Let ÉGiÉE denoteparts of the network close to abnormal points. To isolatethe (Euclidean) length of Gi . Clearly, ÉGiÉE is an upperthis difficulty, we first solve the problem, in Section 3,bound for the length of a minimum Euclidean spanningfor the case where G contains no abnormal points andtree on Xi . It follows that there is a rectilinear spanningthen generalize the result in the following section.tree, Si , on Xi such thatIn the remainder of this section, we define suitable

neighborhoods Ni (1) and compute an upper bound onÉSiÉ °

√2ÉGiÉE .the length of all G-constrained rectilinear minimum net-

works. These computations need to be done once onlyBy taking the sum of such upper bounds for each Gi alongfor a given G and so take constant time, independent ofwith a sum of rectilinear distances between componentsthe set of terminals. Thus, we assume that the neighbor-of G , one obtains an upper bound for the length of Thoods and upper bound have been determined before(independent of X ) . jstarting the algorithm, as part of the preprocessing stage.

Let dE(a , b) denote the Euclidean distance, and dR(a ,b) , the rectilinear distance between a and b (where a and Let M denote the upper bound for ÉTÉ constructed inb may each be curves or points) . Given a curve Gi of G , the above proof.we define the 1-neighborhood of Gi , denoted Ni (1) , as

Ni (1) Å {x : dR(x , Gi ) ° 1}. 3. AN ALGORITHM FOR THE CASEWHERE G CONTAINS NOABNORMAL POINTSFurthermore, we denote the boundary of Ni (1) by Bi (1) ,

that is,For this section only, assume that G contains no abnormalpoints, and let 1 be a positive real number such that NG(1)Bi (1) Å {x : dR(x , Gi ) Å 1}.is tight. Furthermore, choose 1 so that it is not the largestreal number for which NG(1) is tight, allowing us toWe define the 1-neighborhood of G , NG(1) , to be <i fractionally increase 1, if necessary, without compromis-Ni (1) , and its boundary, BG(1) , to be <i Bi (1) .ing tightness. Let X be a set of n points lying on G .An 1-neighborhood of G , NG(1) , is said to be tight ifLet T be a rectilinear Steiner minimal tree whose set ofthe following conditions hold:terminals is X . We first prove a simple technical lemma,then show there is an upper bound (independent of n) on

(i) The shortest rectilinear segment of G has length the number of Steiner points in T . From this, it easilyat least 41; and follows that the G-constrained rectilinear Steiner problem

(ii) The regions Ni (21) are all disjoint; and can be solved in polynomial time.( iii ) Topologically, for any positive d õ 21, each

Ni (d) is an annulus if Gi is a closed curve or a disk if Lemma 3.1. Let qq* be a vertical or horizontal lineGi is not a closed curve. segment whose interior does not intersect NG(1) and such

that q and q * lie on BG(1) . Then Éqq *É ¢ 21.Intuitively, Condition (iii ) says that each Ni (1) is to- Proof. If q and q* do not both lie on Bi (1) for some

pologically equivalent to a minimal thickening of the i , then the lemma easily follows by Condition (ii ) of thecurve Gi . It is easily observed that tight neighborhoods definition of tightness. If q and q* do both lie on someexist for all sufficiently small values 1, giving the follow- Bi (1) , then, since Gi has no abnormal points, there musting lemma: exist points p and p * on Gi , each having rectilinear dis-

tance of 1 from q and q*, respectively, such that theLemma 2.3. There exists a positive real number 10 such segment of Gi between p and p * contains a completethat NG(1) is tight for all 1 ° 10 . rectilinear segment parallel to qq*. (This is illustrated in

Fig. 4.) Since rectilinear segments of Gi have length atleast 41, it follows from the definition of tightness thatWe now give an upper bound for the length of any

rectilinear minimum network with terminals constrained the corresponding segment of Bi (1) between q and q *must contain a parallel rectilinear segment of length atto G .

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 5: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

ALGORITHM FOR RECTILINEAR STEINER TREES 149

Fig. 4. Example illustrating that the segment of Bi (1 ) between q and q * contains a rectilin-ear segment of length at least 21.

least 21. A simple argument now shows that again in this exists a point sj satisfying 1 õ j õ k 0 3 and Ésjsj/3É õ 1.By Lemma 2.1, we observe thatcase Éqq *É ¢ 21. j

Lemma 3.2. The number of edges of T meeting BG(1) min{ÉejÉ, Éej/2É} ° Ésjsj/2É õ 1is bounded above.

and, similarly,Proof. Let T * be a full component of T and let l* bea complete line of T * meeting BG(1) at at least at onepoint. By the canonical form for T , l * must have a termi- min{Éej/1É, Éej/3É} ° Ésj/1sj/3É õ 1.nal, say q0 , at one of its endpoints. We may assume, byslightly increasing the value of 1 in the preprocessing Since ej , ej/1 , ej/2 , ej/3 are all incident with terminalsstage if necessary, that l * intersects BG(1) at a finite num- (by the canonical form of T ) , it follows from the aboveber of points. Let q1 , . . . , qk be the points where l * two conditions that two of these terminals on oppositeintersects BG(1) , listed in order of increasing distance sides of l* lie on Gi and have a rectilinear distance offrom q0 . Note, from the properties of tightness, that less than 31 between them (as illustrated in Fig. 5) . Fur-Éq0q1É ¢ 1 and that if the interval qjqj/1 does not lie in thermore, since Gi does not intersect l * or contain anyNG(1) then Éqjqj/1É ¢ 21, by Lemma 3.1. It follows that abnormal points, there must be a complete rectilinear seg-Él *É ¢ k1. Hence, each intersection of T with BG(1) ment on Gi between these two terminals. This contradictscontributes at least 1 to ÉTÉ. This implies that the number Conditions (i) and (iii ) of the definition of tightness.of points at which T intersects BG(1) is at most M /1, Hence, k is bounded.which is independent of n . j For the second part of the proof, let {Tj} be the set of

nontrivial full components of T such that all Steiner pointsLemma 3.3. For each Gi of G, the number of Steiner in each Tj lie in Ni (1) and no Tj intersects Bi (1). An easypoints in Ni (1) is bounded above. argument, based on the canonical form of T , shows that

each Tj contains two terminals such that the section of GiProof. We prove this lemma in two parts: Let Gi bebetween them includes a rectilinear segment of Gi . Sincea curve of G . We first show that every complete line ofsuch a rectilinear segment has length at least 41, it is clearany full component T * of T contains a bounded numberthat each Tj contains an edge, or part of an edge, of lengthof Steiner points in Ni (1) . This implies, by the canonicalat least 21 running parallel to this rectilinear segment. So,form for full components, that T * also has a boundedby Lemma 2.1, no rectilinear segment of Gi can be spannednumber of Steiner points in Ni (1) . We then show thatin this way by two distinct such Tj’s. Hence, the numberthere are a bounded number of nontrivial full componentsof elements in {Tj} is at most the number of rectilinearof T entirely contained in Ni(1) and, hence, which do notsegments in Gi , which is bounded. jintersect Bi (1) . Clearly, these two results, together with

Lemma 3.2, suffice to prove the lemma.Let T * be a full component of T such that some com- Let F be the forest of nontrivial full components of T .

Since F meets BG(1) at a bounded number of points, itplete line of T * includes a subsegment, l*, which is con-tained entirely in Ni (1) , does not intersect Gi , and con- follows that F has a bounded number of Steiner points

outside NG(1) . It now follows from Lemma 3.3 that thetains at least six Steiner points. Let s1 , s2 , . . . , sk be theSteiner points on l * ordered from left to right or top to whole of F has a bounded number of Steiner points and,

hence, a bounded number of terminals. It is not difficultbottom, and let e1 , e2 , . . . , ek be the corresponding alter-nating incident edges. We will show that k is bounded. to see, from the proof of Lemma 3.3, that each Steiner

point of F contributes, on average, at least 1 /4 to theNote that there must be a bounded number of points sj

(with j õ k 0 2) such that Ésjsj/3É ¢ 1. Suppose there length of F . Hence, it can be shown by induction that

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 6: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

150 BRAZIL, THOMAS, AND WENG

Fig. 5. If ej and ej/1 both have length less than 1, then the terminals tj and tj/1 must lieon Gi and the part of Gi between them must contain a rectilinear segment.

4M /1 is a suitable upper bound for the number of termi- 4. THE GENERAL ALGORITHMnals of F .

We now have the following algorithm for construct- We now consider the general case, where G may containing T : abnormal points. The difficulty in the general case lies in

the fact that the number of Steiner points in T is un-STEP 1. Compute 1 and M . This can be done in boundedbounded, that is, can increase arbitrarily as n increases.time.We will show, however, that all but a bounded number

STEP 2. Choose the terminals of F . Since the number of of these Steiner points lie in specific regions close tosuch terminals is bounded by 4M /1 , the number of abnormal points. The nature of these regions is such thatchoices of this terminal set is a polynomial function we can construct the parts of T lying in them in polyno-of n . Hence, all choices can be generated in polynomial mial time.time. We begin this section by first partitioning the neighbor-

hoods Ni (1) into regions called capsules and thenSTEP 3. For each choice of terminals in the previous step,strengthen the definition of tightness.construct a Steiner forest F . Since the number of termi-

Consider the maximal segment of Gi containing anals of F is bounded, all Steiner forests on a givengiven abnormal point p but not containing any other ab-terminal set can be constructed in bounded time.normal points or points from rectilinear segments not con-taining p . It is clear from the definition of an abnormalSTEP 4. For each choice of F in the previous step, addpoint that any discrete set of points in this segment formthe trivial full components. We can transform F intothe vertices of a rectilinearly convex polygon. The recti-a Steiner tree on X by adding a minimizing set of triviallinear edges of this polygon can be chosen so that thefull components. This set of edges can be constructedpolygon’s interior lies on one side of the segment of thein polynomial time using standard methods for con-curve. We refer to this side as the convex side of Gi atstructing spanning trees.p . Let np be the closest point to p on Bi (1) lying on the

STEP 5. Choose the shortest tree constructed in the previous convex side of Gi at p . If p is horizontally or verticallystep. This will be a minimum rectilinear network T . abnormal, let Lp be the (respectively) horizontal or verti-

cal line passing through np . If p is ambiguously abnormal,The above algorithm immediately proves the following then note that the part of Gi in some sufficiently small

theorem: neighborhood of p lies entirely in one quadrant of theplane with respect to p . In this case, let Lp be the tworays bounding this quadrant translated so that they meetTheorem 3.4. Let G be a finite union of disjoint compact

curves embedded in the plane, containing a finite number at np . We define the abnormal capsule for p to be theconnected component of Ni (1) 0 Lp containing p (asof rectilinear segments and no abnormal points. Then,

there is a polynomial time algorithm for the G-con- illustrated in Fig. 6) . If Q is the abnormal capsule for p ,then note that the segment of Gi containing p and lyingstrained rectilinear Steiner problem.

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 7: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

ALGORITHM FOR RECTILINEAR STEINER TREES 151

Fig. 6. In each case, the region in the figure bounded by Lp and Bi (1 ) represents anabnormal capsule Q .

in Q divides Q into two regions. We refer to the closure points must be a distance of at least 1 from any terminalof l *. It follows that if l * meets BG(1) at k points thenof the region on the convex side of Gi at p as the inner

abnormal capsule of p and the closure of the other region Él *É ¢ k1 /2. Hence, the number of points at which Tintersects BG(1) is at most 2M /1, which is indepen-as the outer abnormal capsule of p . If the abnormal cap-

sule Q has been specified, then these regions will be dent of n . j

denoted as QI and QO , respectively.For a given 1 ú 0, NG(1) is said to be strongly tight Lemma 4.2. Let Q be either a normal capsule or outer

if it is tight and also satisfies the following two conditions: abnormal capsule of G. Then, the number of Steinerpoints in Q is bounded above.

( i ) For each abnormal point p , the abnormal capsuleProof. The proof is essentially the same as that offor p does not contain an endpoint of Gi or any points of

Lemma 3.3. jany rectilinear segment of which p is not an endpoint;and

If Q is an abnormal capsule for p , let l(QI) denote the(ii ) Any two abnormal capsules for abnormal pointsclosed line segment, or pair of line segments, forming theof G are disjoint.boundary between QI and the two normal capsules adja-cent to Q . Note that l(QI) is a subsegment of Lp withAgain, as with tightness, there exists a positive realendpoints on G and that Él(QI)É ¢ 21. We may assume,number 10 such that NG(1) is strongly tight for all 1 ° 10 .by slightly increasing the value of 1 in the preprocessingSuppose that NG(1) is strongly tight and let A be thestage if necessary, that, for each abnormal capsule Q ,disjoint union of abnormal capsules of NG(1) . Then, wel(QI) does not lie on the grid graph of X but only inter-refer to each connected component of NG(1) 0 A as asects it at a finite number of points. We wish to shownormal capsule of G . This defines a partitioning of eachthat T intersects l(QI) at a bounded number of points.Ni (1) into normal and abnormal capsules.We first prove the following technical lemma:

Lemma 4.1. The number of edges of T meeting BG(1)Lemma 4.3. Given an abnormal capsule Q in Ni (1) withis bounded above.abnormal point p, let qq* be a horizontal or vertical line

Proof. The proof of this lemma is slightly different to segment whose interior does not intersect QI and suchthat of Lemma 3.2, since Lemma 3.1 does not apply, for that q lies on l(QI) , q * lies on G and qq* ⊥ qnp. Then,example, close to np for any abnormal point p . As in the

Éqq *É ¢ 1 .proof of Lemma 3.2, let l * be a complete line of T . It iseasily checked, from the definition of strong tightness Proof. If q* does not lie on Gi , then the lemma clearly

follows from Condition (ii ) of the definition of tightness.using similar arguments to those in the proof of Lemma3.1, that if l * meets the boundary of some Ni (1) at three So suppose that q * lies on Gi . Let r be the endpoint of

l(QI) such that the segment Sr of Gi between q * and rpoints, labeled (from top to bottom or left to right) q1 ,q2 , and q3 , then Éq1q3É ú 1. Furthermore, each of these does not intersect the interior of Q . Note, from the defini-

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 8: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

152 BRAZIL, THOMAS, AND WENG

bound on the number of edges ej such that £(ej) is aterminal.

Now suppose, on the other hand, that £(ej) is a Steinerpoint. As in the previous case, there can only be a boundednumber of such edges where the distance of £(ej) froml(QI) is greater than 1. So assume that the distance of£(ej) from l(QI) is less than or equal to 1. We will show,by contradiction, that £(ej) does not lie in an inner abnor-mal capsule. So suppose, on the contrary, that £(ej) doeslie in an inner abnormal capsule. If £(ej) lies in QI , thenit immediately follows that p is ambiguously abnormal,ej contains a corner point, and R(ej) contains part of ep ,giving a contradiction. By tightness, the only other possi-bility is that £(ej) lies in an inner abnormal capsule Q*I ,where Q * is an abnormal capsule for Ni (1) adjacent toQ such that there are no rectilinear segments of Gi lyingbetween them. Then, the only possible relative positions

Fig. 7. If q * lies on Gi , then Éqq *É ú 1.of Q and Q* (up to reflection or rotation by a multipleof 907) are as shown in Figure 9. In the first case (or forany abnormal capsule Q* not satisfying the abovetions of Lp and strong tightness, that npr meets Sr at anconditions) , the rectilinear distance between QI and Q *Iangle of at least 907 (as illustrated in Fig. 7) . If p isis greater than 1. In the second case, £(ej) could only liehorizontally or vertically abnormal or if q lies on npr ,in Q *I if ej had a corner point. But, then, R(ej) wouldthen it follows that Sr must contain an abnormal point orcontain part of e0 or e *0 , contradicting minimality. Hence,a rectilinear segment parallel to qq *. In either case, it is£(ej) does not lie in an inner abnormal capsule. By Lem-clear that Éqq *É ú 1. If, on the other hand, p is ambigu-mas 4.1 and 4.2, the number of Steiner points not lyingously abnormal and q does not lie on npr , then Éqq *Éin inner abnormal capsules is bounded, and, hence, theú ÉnprÉ ¢ 1. jnumber of such edges ej is also bounded. j

Lemma 4.4. For any abnormal capsule Q in Ni (1) , theWe now define a new rectilinear Steiner minimal treenumber of edges of T intersecting l(QI) is bounded above.

T* which is identical to T except that it contains extraterminals. The extra terminals of T* are added as follows:Proof. Let e0 and e *0 , respectively, be the edges of T

intersecting l(QI) closest to each of the two endpoints of( i) If an edge of T crosses one of the curves Gi inl(QI) . Let ep be an edge of T intersecting l(QI) closest

any abnormal capsule Q , then place a new terminal atto np (where p is the abnormal point in Q) . Let ej be anythe point of intersection of the edge with the curve;edge of T , other than e0 or e *0 , whose interior intersects

l(QI) , say at a point qj . Let £(ej) be an endpoint ( i.e., ( ii ) If, for any abnormal capsule Q , an edge of Tterminal or Steiner point) of ej such that the edge segment crosses l(QI) , then place a new terminal at the point of£(ej)qj does not lie entirely in Q . intersection of the edge with the l(QI) .

Suppose that £(ej) is a terminal of T . If ej does notNote that this definition implies that if an edge of T* lieshave a corner point between l(QI) and £(ej) , then, byin QI then the entire full component containing that edgeLemma 4.3, the distance from £(ej) to l(QI) is greaterlies in QI . We refer to the terminals of T* which are notthan 1. If ej does have a corner point between l(QI) andterminals of T as quasiterminals. By Lemma 4.4, for each£(ej) , then let R(ej) be the smallest axis aligned rectangleabnormal capsule Q , the number of quasiterminals oncontaining ej . It follows from the proof of Lemma 4.3l(QI) is bounded. We define F* to be the subforest ofthat the distance from that corner point to l(QI) is alsoT* comprisinggreater than 1, since, otherwise, R(ej) would contain

points from e0 , ep , or e*0 , as shown in the example (where(F1) Those full components of T* whose endpointsp is ambiguously abnormal) in Figure 8. This contradicts

lie on two distinct curves of G ; andthe minimality of T since flipping the corner would createa loop. But given two edges ej such that in each case (F2) Those nontrivial full components of T* which£(ej) is a terminal, this implies that the distance between do not lie entirely in an inner abnormal capsule.the points where the two edges intersect l(QI) is at least1, by Lemma 2.1. Hence, there are at most Él(QI)É/1 The following important corollary now follows imme-

diately from Lemmas 4.1, 4.2, and 4.4.edges ej such that £(ej) is a terminal. This gives an upper

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 9: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

ALGORITHM FOR RECTILINEAR STEINER TREES 153

Fig. 8. For any ej with corner point at most 1 from l (QI ) , R (ej) ( represented by a shadedregion) contains points from e0 , ep or e *0 .

Corollary 4.5. The number of terminals in F* is bounded above. By Corollary 4.5, F* contains a bounded num-ber of terminals. This bound can be determined fromabove.properties of G in the preprocessing stage. The numberof possible candidate points for quasiterminals is aUsing these results, we describe an algorithm for con-

structing T which can be shown to run in polynomial linear function of n since any horizontal or verticalline intersects G in a bounded number of points (unlesstime, proving Theorem 2.2.it contains a rectilinear segment of G) . It follows that

Proof (Theorem 2.2.) . The algorithm for constructingthe terminal set for F* can be chosen in a polynomial

T essentially consists of three steps and a preprocessingnumber of ways. Since F* contains a bounded number

stage. It constructs a series of Steiner trees T* on X andof terminals, and, hence, a bounded number of Steiner

(possibly) some additional quasiterminals, the shortestpoints, all possible forests F* can be constructed in

of which corresponds to a minimal Steiner tree T . Thebounded time for a given set of terminals and quasiter-

preprocessing comprises the construction of the neighbor-minals. Hence, all possible choices of F* can be con-

hoods and capsules. This involves locating all abnormalstructed in polynomial time.

points and rectilinear segments of G and using their prop-erties and the minimum distance between curves of G to STEP 2. Constructing the parts of T* in inner abnormalfind a suitable 1 for which the NG(1) is strongly tight. capsules. For each choice of forest F*, we next con-As mentioned in the previous section, this can be achieved struct all the parts of T* that lie entirely within thein constant time and, hence, does not contribute to the inner abnormal capsules. Note that the part of T* in ancomplexity of the algorithm. inner abnormal capsule forms a forest, each connected

The three basic steps of the algorithm are as follows:component of which is a minimum rectilinear network.For each abnormal capsule Q , we will show belowSTEP 1. Constructing F*. First, choose the terminals ofthat there are a bounded number of possibilities thatF*, then construct every possible forest F* on those

terminals whose full components satisfy (F1) and (F2) need to be considered for the forest in QI and that each

Fig. 9. The two possible relative positions of Q and Q *.

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 10: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

154 BRAZIL, THOMAS, AND WENG

of the possibilities can be found and constructed in hence, each of which can be constructed in bounded time.By running through all possible P(Q)’s, it follows thatO(n 8) time. Since there are a bounded number of ab-

normal capsules, it follows that for each F* all possible if we can construct, in polynomial time, the smallest recti-linear forest on the terminals and quasiterminals on thecombinations of forests in the inner abnormal capsules

can be generated in polynomial time. Hence, for a boundary of QI such that this forest combined with theunion of paths in the given P(Q) forms a tree, then wegiven F*, we generate a bounded number of choices

for F* combined with the parts of T* in inner abnormal can achieve Step 2 of the algorithm.We now describe how to construct such a rectilinearcapsules. Any of these possibilities that contain a loop

can immediately be discarded. The remaining possibil- forest. First, find a positive real number a such that, givenany two distinct parallel horizontal or vertical lines pass-ities are forests which contain all of the nontrivial (and

possibly some of the trivial) components of the Steiner ing through points in X , the distance between them isgreater than a. Clearly, a only needs to be calculatedtree being constructed.once (e.g., when X is input) and can be found in polyno-

STEP 3. Constructing the remaining trivial full compo- mial time. By definition, all edges in T will have lengthnents. To complete the algorithm, we transform each greater than a. Let XQ be the set of terminals and quasiter-forest constructed in the previous step into a Steiner minals on the boundary of QI . For a given P(Q) , definetree T*, whose terminal set is X and the quasiterminals the network S(P(Q)) to be the union of the restricted gridchosen to construct the current F*, by adding a min- graph R(XQ) and the paths in P(Q) , where the vertices ofimizing set of terminal-to-terminal edges. This set of S(P(Q)) are the vertices of R(XQ) and the vertices ofedges can be computed in polynomial time using stan- F* that have degree 3 or more in the union of the pathsdard methods. After removal of the quasiterminals, the in P(Q) . Assign all edges of S(P(Q)) in R(XQ) thetree T* of shortest length corresponds to a rectilinear length of the Euclidean distance between their endpoints,Steiner minimal tree T . and all other edges of S(P(Q)) , a small positive length

such that all paths in P(Q) have length at most a. Now,It remains to prove that Step 2 of the above algorithm using the algorithm of Bern and Bienstock [1, Sect. 3] ,

can be achieved in polynomial time. To do this, we make construct a minimal Steiner tree U on S(P(Q)) with ter-use of a result of Bern and Bienstock [1] for the Steiner minals XQ . Clearly, their algorithm can be applied here,problem on graphs. since the terminals lie within a bounded number of layers

Given an abnormal capsule Q let GQV be all parts of G of the infinite face of S(P(Q)) . Note that the weightingnot lying in Q . For any two terminals of F* on the bound- of the edges guarantees that U contains all edges ofary of QI , say t0 and t1 , we say a path in F* S(P(Q)) not in R(XQ) . It follows that the subforest of

U lying on R(XQ) is the required minimal rectilinear for-< GQU from t0 to t1 is efficient if each edge of F* in thepath has rectilinear length less than or equal to dR( t0 , t1) . est. Since the number of vertices of S(P(Q)) is O(n 2) ,

it follows from Theorem 1 of [1] that this forest can beLet P(Q) be a collection of efficient paths in F* < GQV

between pairs of distinct terminals of F* on the boundary calculated in O(n 8) time.This completes the algorithm and, hence, the proof.of QI such that the union of these paths forms a subforest

of F* < GQV ( i.e., contains no loops) . j

The importance of these collections of efficient pathslies in the fact that if T is a minimal Steiner tree then thepart of T* in QI is a forest whose connected components 5. CONCLUDING REMARKSare joined by a subforest in the remainder of T*, whichcan be thought of as a union of paths in T* between pairs As mentioned in the Introduction, the algorithm in the

proof of Theorem 2.2 is not, in general, practical, but,of distinct terminals of T* on the boundary of QI . Somecollection of efficient paths P(Q) corresponds to this rather, contributes in pushing back the theoretical bound-

ary between polynomial-time solubility and NP-com-union of paths in T*, where each part of an efficientpath in GQV corresponds to a series of terminal-to-terminal pleteness for the rectilinear Steiner problem. It may, how-

ever, be possible to apply some of these techniques toedges or a path in another inner abnormal capsule. Notethat if a corresponding path between t0 and t1 in F* < develop an implementable algorithm for terminals lying

on a small number of curves satisfying special conditions.GQV was not efficient then we could replace the longestrectilinear edge of the path in F* by the rectilinear edge In particular, it should be noted that many of the parts of

the algorithm that appear to have the potential to substan-between t0 and t1 to reduce the length of the tree, contra-dicting the minimality of T . Now, since F* contains a tially contribute to the overall complexity of the algorithm

will, in practice, offer very few alternatives that need tobounded number of vertices, it follows that, for a givenF*, there are a bounded number of collections P(Q) , be considered in most cases. To give just a few examples,

the number of possible quasiterminals that can occur oneach of which contains a bounded number of paths and,

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks

Page 11: A polynomial time algorithm for rectilinear Steiner trees with terminals constrained to curves

ALGORITHM FOR RECTILINEAR STEINER TREES 155

the boundary of QI will generally be very small (unless Since F contains at most k terminals, there are O(nk)choices for the terminal set of F . For each choice ofthe length of the part of G in Q is much greater than 1) ,

and the number of efficient paths in F* < GQV between terminals, all Steiner forests F can be constructed inbounded time, and the trivial full components can thenterminals or quasiterminals on the boundary of QI will

also usually be very small for any given F*. be added in O(n 2) time. It follows that for Case (1) therunning time of the algorithm is O(nk/2) .Also note that Theorem 2.2 is almost certainly not the

strongest result possible. We believe that it is possible to In Case (2) , we use the algorithm in Section 4. Again,it is not difficult to see that the number of choices of theremove the word ‘‘disjoint’’ from the statement of the

theorem and will investigate this further in a future paper. terminal set of F* is O(nk) . Hence, the number of forestsF* is also O(nk) , and they can all be constructed inHowever, it seems unlikely that the G-constrained recti-

linear Steiner problem remains polynomially solvable if O(nk) time. For each such forest there are a boundednumber of possibilities for the part of T* in the innerthe curves are allowed to contain infinitely many abnor-

mal points or rectilinear segments. abnormal capsule, each of which can be constructed inO(n 8) . The tree T* can then be constructed in O(n 2)We conclude by giving running time bounds for some

simple curve configurations. The two cases that we exam- time (which does not increase the order of the runningtime bound). Thus, in Case (2) , the algorithm has aine are examples of the rectilinear Steiner problem that

have not previously been shown to be polynomially solv- running time bound of O(nk/8) .able. The second case also serves to illustrate the extracomputational difficulties caused by the existence of ab-

REFERENCESnormal points.Let RÅ abcd be a rectilinear rectangle, that is, a rectan-

[1] M. W. Bern and D. Bienstock, Polynomially solvablegle with horizontal and vertical sides, such that ÉabÉ Å 1

special cases of the Steiner problem in planar networks.and ÉbcÉ Å a ¢ 1. Let o be the intersection of the diago- Ann Oper Res 33 (1991), 405–418.nals of R . Let a *b *c *d * be a rectilinear rectangle similar

[2] S. W. Cheng, The Steiner tree problem for terminals onto R such that a *, b *, c*, and d * lie on the interior of oa , the boundary of a rectilinear polygon. Network Design:ob , oc , and od , respectively. Let Éa *b *É Å r õ 1. Then, Connectivity and Facilities Location. DIMACS Series inÉb *c *É Å ar . (See Fig. 10). We consider two cases: In Discrete Mathematics and Theoretical Computer ScienceCase (1) , we let G Å aa * < bb * < cc * < dd * ; in Case 40 American Mathematical Society, Providence (1998),(2) , we let G Å ao < bo < cc* < dd *, so in this case 39–57.G contains an abnormal point at o . By rescaling the outer [3] S. W. Cheng and C. K. Tang, A fast algorithm for comput-rectangle in Case (2), we obtain in each case the upper ing optimal rectilinear Steiner trees for extremal point

sets. Proc Sixth Ann Int Sym Algorithms Computationbound M Å 2 / a(2 0 r) and 1 Å r /4. Let k Å 4M /(ISAAC), LNCS 1004 (1995), 322–331.1 Å (8 / 4a(2 0 r)) /r .

[4] M. R. Garey and D. S. Johnson, The rectilinear SteinerIn Case (1) , we can use the algorithm in Section 3.tree problem is NP-complete. SIAM J Appl Math 32(1977), 826–834.

[5] F. K. Hwang, D. S. Richards, and P. Winter, The SteinerTree Problem, Annals of Discrete Mathematics 53. Else-vier, Amsterdam, 1992.

[6] M. Kaufmann, S. Gao, and K. Thulasiraman, An algo-rithm for Steiner trees in grid graphs and its applicationto homotopic routing. J Cir Syst Comput 6 (1996), 1–13.

[7] D. S. Richards and J. S. Salowe, A linear-time algorithmto construct a rectilinear Steiner minimal tree for k-extre-mal point sets. Algorithmica 7 (1992), 247–276.

[8] J. H. Rubinstein, D. A. Thomas, and N. C. Wormald,Steiner trees for terminals constrained to curves. SIAM JDiscr Math 10 (1997), 1–17.

[9] J. H. Rubinstein, D. A. Thomas, and N. C. Wormald, Apolynomial algorithm for a constrained traveling salesmanproblem. Networks (to appear) .Fig. 10. Two curve configurations for G .

/ 8u26$$0849 01-26-99 20:53:49 netwa W: Networks