1 L-Shaped Steiner Routing Algorithm

download 1 L-Shaped Steiner Routing Algorithm

of 9

Transcript of 1 L-Shaped Steiner Routing Algorithm

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    1/9

    185IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN, VO L 9 NO 2, FEBRUARY 1990

    New Algorithms for the Rectilinear Steiner TreeProblem

    JAN-MING HO, GOPALAKRISHNAN VIJAYAN, AN D C . K . W O N G , FELLOW, IEEE

    Abstract-We discuss a new approach to constructing the rectilinearSteiner tree (RST) of a given set of points in the plane, starting froma minimum spanning tree (MST). The main idea in our approach is tofind layouts for the edges of the MST, so as to maximize the overlapsbetween the layouts, thus minimizing,the cost (i.e., wire length) of theresulting rectilinear Steiner tree. We describe two algorithms for con-structing rectilinear Steiner trees from MSTs, that are optimal underthe conditions that the layout of each edge of the MST is (1) a L-shape,or (2) any staircase, respectively. The first algorithm has linear timecomplexity and the second algorithm has a higher polynomial timecomplexity. Steiner trees produced by the second algorithm have aproperty called stability, which enables the rerouting of any segmentof the tree, while maintaining the cost of the tree, and not causingoverlaps with the rest of the tree. Stability is a desirable property inVLSI global routing applications.

    I. INTRODUCTIONIVEN a set of n points on the plane, the rectilinearG teiner Tree (RST) problem is to fipd the rectilineartree in the plane, of minimum total wire length, whichconnects the given set of points. The total wire length ofa RST is referred to as the cost of the RST. RSTs havemany applications in V LSI physical design. The problemof constructing the minimum cost RST has been show n tobe NP-complete [4]. The RST problem has been studiedextensively [11, [4], [6]-[8], [lo ], and many heuristic al-gorithms have been proposed. Special cases of the RSTproblem have been show n to have polynomial time algo-r ithms [ l ] , [3] .Hwang [7] has shown that the ratio of the cost of a rec-

    tilinear minimum spanning tree (MST) to that of an op-timum RST is no greater than 3/2. Therefore, the recti-linear MST is a suitable starting point for deriving lowcost RSTs. M any heuristic algorithms [8], [ lo ], [ l 13 takethis approach. They start with a sequence of the inputpoints and edges as given by a rectilinear M ST algorithm,and insert points and edges from this sequence into agrowing RST. Local optimization, such as finding theshortest path from a newly add ed point to a growing RSTis performed when inserting a new edge from the rectilin-ear MST sequence. A main drawback of such heuristicsis that they have no provable performance guarantee otherthan Hwangs general bound. W e introduce a more globalManuscript received March 20, 1989. This paper was recommended byJ . -M. Ho is with the Institute of Information Science, Academia Sinica,G. Vijayan and C . K. Wong are with IBM R esearch Division, ThomasIEEE Log Number 8931877.

    Associate Editor R. H . J . M. Otten.Nankung, Taipei , Taiwan, Republic of China .J. Watson Research Center, Yorktown Heights, NY 10598.

    approach, in which the rectilinear MST is transformed intoan RST, which is optimum under the condition of fixingthe shapes of the routes taken by the edges of the MST .Consider a rectilinear MST T of a point set S . A recti-linear shortest path between the end points i a n d j of aMST edge e = ( i , ) is called a staircase layout of theedge. Suppose we select staircase layouts for each MSTedge and merge the overlaps among them (if any), theresulting structure will be a RST. To obtain a low costRST the staircase layouts have to selected so as to maxi-mize the overlaps am ong them. Steiner tree heuristics forVLSI global routing, such as in [ l l ] , [12], use this ideaof trying to maximize the overlaps among the layouts ofthe MST edges. How ever, no attempt has been previouslymade to investigate, whether it is possible, in polynomialtime, to produce Steiner trees, which are optimal, subjectto the restrictions of the approach, i.e., we start with aMST and then lay out the edges of the MS T. In this paper,we formalize this approach, and describe two algorithmsthat produce optimal RS Ts under differing conditions onthe layouts of the MST edges.The first algorithm restricts the staircase layout of therectilinear MST edges to L-shapes, and produces the op-timal RST under this condition. G iven an MST as inp ut,the algorithm produces such a RST in linear time. Thesecond algorithm produces optimal RSTs, under the veryrelaxed condition that arbitrary staircase shapes can beused to layout the MST edges. In fact, we prove that it issufficient to consider only Z-shaped layouts in order toconstruct the optimal RST over all arbitrary staircase lay-outs of the MST edges. This second algorithm has a higherorder polynomial time complexity.We give below some simple definitions that will enableus to discuss the model and algorithms m ore formally.

    Dejinition 1 (Underlying Gr id): Th e underlying gridG ( S ) of point set S (on an oriented plane) is the gridobtained by drawing horizontal and vertical lines througheach point of S see Fig. 1).The grid io Fig. l(a ) is the underlying grid of the points

    PI9 P2, - . , p 6 . The optimal RST of a point set S sknown to be a subgraph of its underlying grid G ( S ) 5 ] .The nodes of a RST that are not in S and have degree atleast 3 are called Steiner points . The nodes of S are calledoriginal points. The length of a vertical or horizontal edgeof G ( S ) s defined to be the distance between its end-points. The rectilinear distance dist ( i , ) n the orientedplane between two points i an dj on the grid G ( S ) is equal0278-0070/90/0200-0185$01OO 0 990 IEEE

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    2/9

    186 IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN, VOL. 9 . NO . 2 . FEBRUARY 1990

    p5(a) (b )Fig. 1 . Underlying grid, MST, and edge layouts.

    to the length of any shortest path between the points onthe grid G ( S ). The cost o f a RST is the sum of the lengthsof the edges of G ( S ) that are used in the RST.Dejinition 2 (Rectilinear MS T): A rectilinear MST of apoint set S on an oriented plane is a MST of the completegraph G , S of the point set, in which the w eight of eachedge ( i , ), i E S , j E S is the rectilinear distance dist ( i ,

    j ) .Dejinition 3 (Edge Layouts): A staircase layout of an

    edge ( i , ) of a rectilinear MST T of a point set S is ashortes t path between the points i an d j on the u nderlyinggrid G ( S ) .A staircase layout having at most two turnson the grid G ( S ) is defined to be a Z-shaped layout. Astaircase layout having at most one turn is defined to be aL-shaped layout.The tree Tof Fig. l(a) is a recti l inear MS T of the pointsPI?P2 , - ,p6. The layouts of the edges of the MST Tshown (as dashed paths) in Fig. l(b) are all staircase lay-outs. In p articular the layout of the edge ( p 1 p 2 ) s a Z-shaped layout, and that of ( p l , 6 ) is a L-shaped layout.Dejinition 4 (Degenerate Edge): An edge between twopoints i an d j of a rectilinear MS T of a point set is said to

    be degenerate if i a n d j lie on the same horizonta l l ine oron the same vertical l ine. A degenerate edge has a uniquestaircase layout.The number of staircase layouts of an edge is an expo-nential function of the number of points on the subgridwithin the bounding rectangle of the two endpoints of theedge. Choosing different staircase layouts of the edges ofthe MST will result in different amounts of overlapsamong these edge layouts. If we merge these overlappingportions, and introduce appropriate Steiner points, the re-sulting structure is a RST of the given point set. Depend-ing on the types of layouts we allow for the MS T edges,we define the following different types of such RSTs.

    Dejinition 5 (S-RST, Z-RST, L-RST): An RST that isobtained from a MST T of a point set S , by using staircaselayouts on G ( S ) or the edges of the MST is referred toas an S-RST of T . An S-RST of T , in which the layout ofeach MST e dge is a Z-shaped layout is called a Z-RST ofT . A S-RST of T , in which the layout of each MST edg eis a L-shaped layout is called a L-RST of T . An optimal

    S-RST (Z-RST, L-RST) is an S-RST (Z-RST, L-RST) ofthe least cost among all S-RSTs (Z-RST s, L-RSTs).Fig . 2 shows a recti l inear MST of a set of 8 points andtwo different S-RSTs of the MST. The points pl , p2,,p8 are the points in the given set. Th e points s1, s2 ,

    s3, s4 are Steiner points. Th e S-RST \k l has a lower costthan \k2.Optimal S-RSTs have an interesting and useful prop-erty called stability under rerouting. W e describe this be-low. A staircase segment of an S-RST is a path betweentwo points (original or Steiner) such that this path doesnot contain any other original or Steiner points. T he op-eration of replacing a staircase segment by another stair-case segment between the sam e endpoints is called s tair-case rerouting. Staircase rerouting may cause overlaps.Merging the overlaps results in a new S-RST of strictlylower cost. For example, consider the two S-RSTs PIan d \k2 of Fig. 2 . Rerouting any staircase in the S-RST\k l does not cause overlaps. In the S-RST \k2, the stair-case segment (actually L-shaped) between s1 an d p 3 canbe rerouted to cause overlaps with the staircase betweenp 3 an d p 4 . n fact when this overlap is merged, the result-ing lower cost S-RST has the sam e cost as \ k l . An S-RSTis said to be stable under rerouting if the staircase re-routing of any subset of its staircase segments does notcause any overlaps. In Fig. 2 , the S-RST \k l is stable,while the S-RST \k 2 is not. Stability under rerouting is adesirable property fo r Steiner trees of nets in VLSI globalrouting [l l] , because i t would enable a segment of theSteiner tree of a net to be rerouted without causing anyoverlaps with other segments of the same Steiner tree.Such reroutings may be necessary, in order to alleviatecongestions in the underlying global routing grid. Also,note that a stable S-RST corresponds to a local optimumunder the operation of staircase rerouting. An optimal S-RST must be stable, otherwise a lower cost S-RST maybe derived by rerouting some of the staircase segmentsand merging the resulting overlaps, which is a contradic-tion. F rom the Z-sha pe sufficiency result in Section V , anoptimal Z-RST is also a optimal S-RST. Therefore, op-timal Z-RSTs are also stable. However, note that rerout-ing some staircase segments in a Z-RST may result in S-RST in which one or more of the original MS T edges, nolonger have Z-shaped layouts. The stability property doesnot hold for optimal L-RSTs. Flipping an L-shaped seg-ment of an optimal L-RST can cause overlaps with otherportions of the L-RST.Our approach uses recti linear MSTs that have a specialproperty, that for any pair of nonadjacent edges in therectilinear MST, any staircase layouts of the two edgeswill not intersect o r overlap. Th is property is called theseparabil i ty , and a rectilinear MST which has this prop-erty is called a separable MST (or SMST for short). Whenwe delete an edge from a SMST, the two resulting sub-trees cannot intersect or overlap each other. Overlaps canoccur only between edges that are incident on a commonpoint. This property enables the use of dynamic program-ming techniques. Separability is an interesting property

    . . .

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    3/9

    HO e t a l . : S T E I N E R T R E E P R O B L E M

    PI PI PI r----9187

    T

    P6T 91 9 2Fig. 2. A rectilinear MST and tw o S-RSTs.

    by itself, and may have other interesting applications. InSection I1 we present a n algorithm for constructing a sep-arable MST of any set of n points.In Section I11 we prove that the degree of any point ina rectilinear MST is at most 8 , and that at most 6 edgesincident on a common point can be nondegenerate. Wealso show that the neighbors of a point in a rectilinearMST are restricted to lie in specific areas. The degreeboundedness of a rectilinear MST is used to bound theworst-case time complexities of our two algorithms.In Section IV we present a linear time algorithm forconstructing an optimal L-RST from a given SMST. InSection V we show that Z-shaped layouts of the edges aresufficient for the ca se of general staircase layouts. In Sec-tion VI we describe a polynomial time algorithm for con-structing an optimal Z-RST from a SMST, which by thesufficiency theorem is also an optimal S-RST. As muchas is possible, we have tried to describe the two algo-rithms in a manner so that they can be read and under-stood without having to read the proofs of the variouslemmas and theorems of the paper. Experimental resultsof the two algorithms are presented in Section VII.In comparing the two algorithms, the first for optimalL-RST and the second for optimal S-RST, we note thatthe first algorithm has a mu ch low er running time than thesecond. However, staircase layouts are much more gen-eral than L-shaped layouts, therefore the second algo-rithm produces lower cost RSTs. In addition, the RSTstrees produced by the second algorithm have the propertyof being stable under rerouting.

    11. SEPARABLESTThe input to the two RST algorithms described in thispaper is a separable rectilinear MST (SMST) of a givenpoint set S.Dejinition 6 (Separable M ST (SMST)): A rectilinearMST of a point set is said to be separable if arbitrary stair-case layouts of any two nonadjacent edges of the tree donot intersect or overlap.

    Consider a nondegen erate edge e of a rectilinear MST be-tween the points i and j of the given point set. Any stair-case layout of the edge e will be contained within thesmallest rectangle enclosing the two points i and j . W ecall this smallest rectangle the enclosing box of the edgee. Fig. 3(a) shows the enclosing boxes of two edges el

    (a) (b )Fig. 3 . A nonseparable MST and a separable MST.

    and e2. It is obvious that a rectilinear MST is separable ifand only if the intersection of the enclosing boxes of anypair of nonadjacent edges is empty. The property that thelayouts of two nonadjacent edges of a SMST cannot in-teract with each other makes it possible to design poly-nomial time dynamic programming algorithms for boththe L-RST and Z-RST problems. N ot all rectilinear MS Tsare separable. In Fig. 3 we show a nonseparable and aseparable MST of the same set of points. The first MSTshown in the figure is nonseparable be cause th e enclosingboxes of the edges el an d e2 overlap.We now present an U (n 2 ) algorithm for constructing aseprable MST of any given point set. Its correctness,proved in Theorem 1 , implies that any point set alwayshas a MST which is separable. It is possible to derive an0 n log n ) algorithm using the notion of Voronoi dia-grams [9]. We wish to describe the O( n 2) algorithm inthis paper, because it is easy to implement being a minormodification of the well-known MST algorithm of Prim[2]. W e use x ( i ) an d y ( i ) to denote the x- and y-coor-dinates of a point i.Algorithm SMST

    1) Construct the complete graph G , ( S ) of the point set2) For each edge e = ( i , j ) of G , ( S , construct theS .

    three-tuple3 t u p l e ( i , j ) = ( d i s t ( i , j ) , - ( y ( i )- Y ( j 7 - m a x ( x ( i L - 4 j ))

    and assign it to be the weight of the edge.3) Run Prims MST algorithm [2] on G ,( S ) using thethree-tuples as the weights, to generate a MSTT , ( S . Output T, ( S ) as the separable MST of thepoint set S .Note that in comparing two 3-tuples, we have (a l bl c1< ( a 2 , b 2 , c 2 ) , f and only if (a l , bl , c , ) precedes (a2,bZ,c 2 ) in nondecreasing lexicographic order. The firstelement of each three-tuple is the rectilinear length of thecorresponding edge, and therefore Prims algorithm willindeed produce a MST of the graph G , ( S ). The remain-ing two elements of the three-tuple a re used only to breakties among edges of the same rectilinear length. The timecomplexity is dominated by the execution of Prims al-gorithm, which takes U( n2 ) time. Hence, w e have thefollowing lemma:

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    4/9

    188 IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN. VOL. 9. NO. 2. FEBRUARY 1990

    Lemma I : The tree T , ( S ) constructed by AlgorithmSMST is a rectilinear MST of the point set S. The timecomplexity of Algorithm SM ST is 0 n2).It remains to show the tree T,( S ) has the separabilityProperty.

    Theorem I (Separability Theorem): The rectilinearMST T , ( S ) generated by Algorithm SMST is separable.Proofi The proof is by contradiction. Suppose thereexists nonadjacent edges e l = ( l ,jl an d e2 = ( i2, j 2 )in T, (S ), whose enclosing boxes B l an d B2, respectively,have a nonempty intersection. Witho ut loss of generality,assume that i l an d i2 both belong to the same connectedcomponent of T, ( S ) - { e , , e 2 } .

    First, we claim that the points i2 an dj2 do not l ie e i theron the boundary o r in the interior of B , . Suppose not, thenle t i2 be on the boundary or interior of B I . n this case,replacing the edge el by the edge ( 2 , , , results in a rec-tilinear spanning tree whose cost is strictly less than thatof T, (S ). This is a contradiction to Lem ma 1 that T, (S )is a MST. A similar argument holds when J, s on theboundary o r interior of B , . Similarly the two points i l an dj , do not lie on the bou ndary or interior of B2 .We may assume x ( l ) 2 x ( 2 ) else exchange the pointlabels il, 2 and point labels j , , 2 . Since the elements ofthe three-tuple weights are invariant under reflectionacross the x-axis, w e may also assum e that y ( i l ) 2 y ( 2 ) .Since the endpoints el e 2 ) annot lie on B2 (B , ), x ( ,# x ( iz). If we assume x( j , ) > x ( i 2 ) , here remain sixpossible intersection patterns between the enc losing boxesB , an d B2 as depicted in Fig. 4. If x( j l ) < x ( i 2 ) , henwe have six sim ilar patterns obtained by rotating the pat-terns of Fig. 4by 180" and exchanging labels i,, i2 an dlabels j , , 2 .A similar argument as in the following willhold for these patterns.Symbols a , , b l , a2, b 2 , (Y, P are used to denote thelengths marked in the figure. Since T, (S ) is a MST an dil an d i2 are in the same component of T, (S ) - { el, e2 } ,the inequ alities dist ( l , 2 ) L dist ( i2, j , ) and dist ( 2 , ,1 dis t ( i , , j , ) must hold. In cases (a) and (f) they areequivalent to a l + b2 1 a2 + a + P + b2 an d a, + b,I l + (Y + P + bl implying that a1 = a ,, an d ar == 0. In cases (b) and (c) we can deduce that a , = a2an dP = 0. In cases (d) and (e) we can only deduce that a l =a 2 . The six cases thus reduce to corresponding six casesof Fig. 5 .In cases (a)-(e) of Fig. 5we have dis t( i l , 2 ) = dist( i2 ,j 2 > an d - J Y ( ~ I ) - y ( j 2 ) l < -1yfi2) - y ( j 2 ) l whichimplies that 3 tuple ( l, 2 < 3 tuple ( 2 , 2 . Replacingthe edge ( i 2 , 2 ) by a new edge ( i 1 , j 2 ) n the tree T , ( S )results in a spanning tree of strictly lesser 3-tuple weightthan T, (S which is a contradiction. In case ( f) we havedis t( i , , j 2 ) = dis t( i2, j 2 ) an d - ( y ( i l ) - y ( j 2 ) 1 =-Iy(i2) - y ( j2 ) l . However , - max( x( i l ) , x ( j 2 ) )

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    5/9

    HO et al.: STEINER TREE PROBLEM 189

    Fig. 6 . Location lemma

    Lemma 2 (Location Lemma): Le t T be a rectilinearMST of the point set S, and let i E S. There is at most oneneighbor in T , of i , in the interior of each of the 4 regionsformed by the two f45" lines passing through the point1 .

    Proof: Let j and k be two neighbors of a point i in T .Since T is a rectilinear M ST, the ineq ualities dist (k , j )L dis t ( i , j ) and dis t(k, j ) L dis t( i , k) must be true.Suppose j is located in the upper quadrant formed by thetwo *45"-lines passing through the point i , as shown inFig. 6 . The horizontal jagged line in the figure separatingi an d j is the rectilinear bisector of i an d j . Any point onthis line is equidistant from i andj. If k is a point abovethis bisector, then dist ( i , k ) > dist (k, j ). Therefore, noneighbor of i other tha n j can be located above this bisec-tor. Th e squa re shown in the figure is centered at the pointj with rectilinear radius d ist( i, j ). Any point on theboundary of this square is at a rectilinear distance ofdis t( , j ) from j . If k is a point in the interior of thissquare then, dist ( i, j ) > dist (k, j ). Therefore, no neigh-bor of i other th a n j can be located in the interior of thissquare. Thus, the shaded region shown in Fig. 6 is a for-bidden region for any other neighbor of i . Since thisshaded region includes the upper quadrant formed by thetwo +4 5" lines through i, there can be at most one neigh-bor of i in this quadrant. The proof of the lemma followsby symmetry. 0

    Lemma 3 (Degree Boundedness): Le t T be a rectilinearMST of the point set S, and let i E S. Then the point i ha sat most 8 neighbors in T , and at most 6 of these neighborsform nondegenerate edges with the point i .Proof: By Lem ma 2 there are at most 4 neighbors of

    i which are not located on the two f45" lines. I t is easyto see that no two neighbors of i can be located on thesame side of i on the two +45" lines. Therefore, i ca nhave no more than 8 neighbors. We leave it to the readerto establish that at most 6 of these neighbors can be pres-ent outside the two +90" lines. clTV. ALGORITHMOR OPTIMAL -RST

    We now present a linear time algorithm, called Algo-rithm Optimal-L-RST, for obtaining an optimal L-RSTfrom a given separable MST T of a point set S. The al-gorithm has to select for each nondegenerate edge one of

    total amount of overlap, thus minimizing the total cost ofthe resulting L-RST.Hang the input separable MST T by any leaf edge rresulting in the rooted tree T,. For each edge e in T , le tT , denote the subtree of T , that hangs by the edge e . Le te = ( a ,b )with the point b being a child of a in the rootedtree T , . The other edges of T, incident on point b are calledth e child edges of the edge e. For example, in Fig. 2 ,suppose the tree is hung by the leaf edge ( p s ,p 5 ) hen theedges ( p s , p 4 ) an d ( p 5 , p 6 ) are child edges of the edgeLet L ( e ) an d U ( e ) denote the upper and lower L-shaped layouts, respectively, of any edge e . Let\ k L ( e ) ( , ( e ) ) denote the L-RST of the subtree T,, whichhas minimum cost among all L-RST's of T,, in which thelayout of the edge e is constrained to be the L-shape\kL e ) can be computed recursively as follows: let e , :

    i = 1 , 2 , , d be the d child edges of e in the rootedtree T,.. For each child edge e , and for each of the twopossible L-shaped layouts L ( e , ) nd U( , ) of the edge e , ,recursively compute the constrained optimal L-RST's\kL e ,) and k U e ,) of the subtrees T,, . Taking on e of theseL-RST's fo r each subtree T,, , and merging these subtreeL-RST's with the layout L ( e ) of the edge e results in aL-RST of T,. Since the tree T has the separability prop-erty, the only new overlaps that can occur during thismerging are among the edges e , e l , . * , e d , which areall incident on a common point. Therefore, the totalamount of overlap in the resulting L-RS T of T, is the sumof the overlaps among the layouts of the edges e , e l ,

    * , e d , added to the sum of overlaps in the selected L-RST's of the subtrees T,, . Enumerate all combinations ofselecting one of the two L-RST's * , ( e , ) or " , ( e , ) fo reach subtree T,, . For each such combination compu te theresulting L-RST of T,. The constrained optimal L-RST\ k L ( e ) f the subtree T, is simply the one with the leastcost. \ku(e ) can be comp uted in a similar fashion.To compare the optimal L-RST of the entire rooted treeT, , recursively compute (as explained above) the con-s trained optimal L-RST's q L ( r ) and \ku (r ) , and selectthe one with the smaller cost.The proof of correctness of the abov e algorithm followsthe separability of the input tree T . The linear time com-plexity of the algorithm can be established as follows:From Lemm a 3 , we know that the degree of any point inthe SMST T is at most 8, and at most 6 of the incidentedges are nondegenerate. Therefore, the total number ofcombinations enumerated in the computations of \kL e )and * , ( e ) for any edge e is at most 26, which is a con-stant. The new overlaps occurring in each combinationcan be processed in constant time. Since there are n - 1edges in T, the above algorithm has linear time complex-ity. Hence we have the following theorem.

    ( P 8 , P 5 ) .

    L ( e ) ( U ( e ) ) .

    Theorem 2: Algorithm Optimal-L-RST constructs theoptimal L-RST of the SMST T of a point set S of cardi-its two possible L-shaped layouts, s i as to maximize the nality n in O ( n ) ime.

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    6/9

    190 IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN, VOL. J , NO. 2, FEBRUARY 1990

    V . SUFFICIENCYF Z-SHAPED AYOUTSWe now prove that there exists a Z-RST whose cost isequal to the cost of the optimal S-RST. Thus Z-shapedlayouts are suflcient to consider when constructing a op-timal S-RST. As shown in Fig. 7, an optimal L-RST mayhave strictly lower cost than an optimal S-RST thus mak-ing Z-shaped layouts necessary.Le t Z ( e ) denote the number of edges o n the underlyinggrid G( ) traversed by any staircase layout of an edge eof a MST T of a point set S. f the enclosing box of e hasw( ) grid edges on its horizontal side and h( e ) edges onits vertical side, then Z ( e ) = w ( e ) + h ( e ) . Note that

    I ( e ) is independent of the actual staircase layout chosenfo r e . The nu mber of different staircase layouts of a non-degenerate edge e , in the worst case, could be expon entialin l ( e ) . Considering only Z-shaped layouts of e , observethat starting at one of the endpoints, a Z-shaped layoutcan go either horizontally and make its first turn at anyone of the w e ) points, or go vertically and turn at anyone of the h ( e ) points. After making a turn the layoutmust go directly to the opposite side and make the secondturn (if any) towards the other endpoint. Thus there areZ( e ) = w( ) + h ( e ) hoices to ma ke the first turn w hichimplies that there are 1 ( e ) distinct Z-shaped layouts. Thisobservation together w ith the sufficiency result enab les thedesign of a polynomial time algorithm for constructingthe optimal S-RST. This algorithm is described in SectionVI.We first introduce several notations. Given an edgee = (i , j ) of a SMST T, the angle formed by the inter-section of the line and a horizontal line is denoted as8 ( i , j ). Let R ( i , ) denote the enclosing box of the twopoints i an d j . Le t R I( , j ) an d R , (i , j ) denote the interiorand the boundary respectively of R ( i, j ). In a SMST T,only adjacent edges can overlap and cause Steiner pointsto be generated in a S-RST, and thus a Steiner point s ina S-RST must lie on the layouts of at least two edges ofthe SMST, w hich are incident on a common point, say k.We say then that the Steiner point s is adherent to theoriginal point k . The layout of the edge e = (i, ) in a S-RST is denoted as P (i , j ).Given two points i an d j of the input set S, one canpartition the plane into nine regions, which are labeled asillustrated in Fig . 8, formed by the ho rizontal and verticallines passing through the two points i an dj . W e wil l bereferring to these regions in the following discussion.

    Lemma 4: Le t e = ( i , ) be an edge of a SM ST T of ap o i n t s e t S w i t h 4 5 " I ( i , j ) < 9 0 " a n d x ( i ) > x ( j ) ,y ( ) < y ( ). For any o ptimal S-RST of T the set A ofSteiner points in P ( i, j ) n R I ( , j ) satisfies the follow -ing propositions:1) Each point of A is either adherent to i o r t o j .2 ) I f s E A is on the layout P ( b , i ) of the edge (b, i )of T ( o r P ( b , j ) o f e d g e ( b , j ) ) t he nt he po in t b o fS lies in region IV (or region 11). Moreover the por-tion of the layout P (b, i ) ( P b , ) ) that lies in R I( ,j ) must be horizontal.

    3)

    ,_ _ - - - - - - -_ _ _ _ _ - - - - - -L ST(a) (b)

    Fig. 7 . Insufficiency of L-shaped layouts.OPTIMAL L-RSTPTIMAL S-RST

    Fig. 8. Labeling of the nine regions.

    The Steiner set A has at most two points. If so, one(say) s i must adhere to i and the other (say) si mustadhere to j . Moreover the portion of P ( , j ) be-tween si nd si is vertical.Proof.-

    1) Since T is separable, only the layout of an edge in-cident to either i o r j can intersect with the layout ofe . Thus any Steiner point on P ( i , ) must be adher-ent to either i or j .2 ) Suppose a Steiner point s E A also lies on P b, i ),where b is a neighbor of i , then s must be in R ( b ,i ), which forces b to in either region IV or regionVI. However, the Location Lemma (Lemma 2 ) ofSection I11 requires b to be in region VI. In addition ,it is easy to see that the optimality of the S-RSTforces the portion of P ( b, i ) in R I ( , j ) to be on ahorizontal line segment. Similar argument holdswhen b is a neighbor of j .3) Since 45 " I ( , ) < 90, by the Location Lemma(Lemma 2 ) there can be at most one neighbor of i inregion VI. Similarly there is at most one neigh bor jin region 11. Since each Steiner point in the set Amust be adherent to either i o r j , we have IA 1 I .It also follows that if 1 A I = 2 , A = {si, i } then siis adherent to i an d sj is adherent toj. In addition,the optimality of the S-RST forces the segment be-U

    Theorem 3 (2-Suficiency Theorem): Given a SMST Tof a point set S of cardinality n, here exists a Z-RST ofT whose cost is equal to the cost of an optimal S-RST ofT. Proof: We claim that for any integer k, 0 5 k I- 1, there is a optimal S-RST \ k k of T in which all edgesof a k-edge subtree of T is laid out using only Z-shapes.The proof of this claim is by induction. Clearly the basis,when k = 0 is obviously true. Assume that there is a op-timal S-RST in which a subtree Tk- of T, k > 0 , is im-plemented using only Z-shaped layouts for its k - 1edges. Let e = ( i , ) be an edg e in T such that j is in thesubtree Tk- an d i is outside this subtree. We will nowshow that the optimal S-RST \kk-, an be modified into

    .

    tween si nd sj to be v ertical.

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    7/9

    HO er al . : STEINER TREE PROBLEM

    another optimal S-RST \ k k in which the subtree Tk = Tk-U e is implemented using only Z-shaped layouts for its kedges. Note that in the case of k = 1, the subtree Tk- issimply the isolated pointj, and has zero edges.If the layout of the edge e in the S-RST \ k k - I is eitherdegenerate, or already a Z-shape, then we are done. Sole t us assume otherwise. Without loss of generality, wea s s u m e y ( i ) < y ( j ) , x ( i ) > x ( j ) , nd4.5" 5 O ( i , j )< 90". The remaining cases are covered by the fact thatthe cost of an S-RST is invariant under rotation by a mul-tiple of 90" or by reflection across any vertical or hori-zontal line.Le t S j be the Steiner point on RE( i, j ) which is the far-thest away f ro m j among all such Steiner points adherentto j . I f there are no Steiner points adherent t o j on RE( i,j ) we let Sj = j . Let 3; be similarly defined. Let A denotethe set of Steiner points in R I ( , j ). Since by Lemma 4,( A I I , we have the following three cases on the car-dinality of A . In each of the cases, we show how to alterthe layout of the edge e = ( i, j ) into a Z-shaped layout.For convenience, we let L ( x , ) denote the lower L-shapebetween the two points x an d y , an d U ( x , y ) to be theupper L-shape.1) J A = 0: Use any one of the L -shapes L(Si , S,) orU (Si , S i) for laying out the portion of the edge ebetween 3; an d S j . Different cases on the locationsof Si an d Sj are shown in Fig. 9.The layout of theedge e = ( i , ) is now a Z-shape.2) I A I = 1 : Without loss of generality assume that si

    E A is adherent to i. Since \ k k - is optimal Sj an d simust lie on the same vertical line. There are twosubcases depending on the location of Si .(a ) Si is on the b ottom side of RE i, j ): Use the lowerL-shape L( S i, j ) for laying out that portion of the edgee , between Si an d Sj as shown in Fig. 10(a). The layout ofthe edge e = ( i , j ) is now a Z-shape.(b ) Si s on the right side of R E ( i , ), or Si = i: U sethe upper L-shape U ( s i ,3;) for laying out the portion ofthe edge e , between si nd Sj , as shown in Fig. 10(b). Asseen in the figure, the layout of e = ( i , ) is not yet a Z-shape. Denote the edge, of the SMST T that shares theSteiner point siwith the edge e , as e' = ( i , n i ) .Accordingto Lemma 4 the portion of the layout of the edge e ' be-tween si an d ni in R I ( , j ) is a horizontal line segment.Therefore the vertical segment between si an d Sj can beslid to the left until it is flush ag ainst the left side of R B i ,j ) without increasing the cost of the S-RST . This is shownin Fig. lO(c). The layout of the edge e = ( i , ) is now aZ-shape.

    3) ( A = 2: Le t si E A be adherent to i an d sj E A beadherent to . Le t e,! = ( i , n i )be the edge of T whichshares the Steiner point si with the edge e . Similarly,le t e; = ( i , n j ) be the edge of T which shares theSteiner point sj with the edge e . According to Lemma4, si an d si lie on a vertical line segment with si onto p of si. Also the portion of the layout of the edge

    191

    Fig. 9. The case of ( A = 0.

    (a ) (b) (C)Fig. 10. The case of IA I = 1.

    el between si an d ni in R I ( , j ) is a horizontal linesegment. Similarly the portion of the layout of th eedge e; between si an d nj in R , ( i , j ) is also a hori-zontal line segment. There are now 4 subcases de-pending on th e locations of the points Si an d 3, :(a ) Si and Sj are on horizontal sides of R E i , ): UseL( si, 3 ; ) an d U ( s j , S j ) for laying out the correspondingportions of the edge e = ( i , ). This is shown in Fig.1 (a) . The layout of the edge e = ( i , j ) is now a Z-shape.(b ) (1) Si = i , or Si is on the right side of RE i, j ),and ( 2 ) Sj = j , or Sj is on the left side of RE ( i , ): UseU ( s , ,Si) an d L ( s j , ,) as shown in Fig. 1 (b). Th e layoutof the edge e = ( i , j ) is not yet a Z-shape. According toLemma 4 the two points si nd si are on the same verticalline. Therefore this vertical segment between si nd si ca nbe slid until it is flush against the left side of RE( i , )without increasing the cost of the S-RST. This is shownin Fig. 1 (c) . The layout of the edge e = ( i , ) is now aZ-shape.(c) (1) Si is on the lower side of RE i, j ), an d ( 2 ) Si= , or Sj is on the left side of R B i , ): Use L ( sj , j ) an dL ( s ; , S j ) as shown in Fig. ll(d). The layout of the edgee = ( i , ) is not yet a Z-shape. As in the previous sub-case, the vertical segment between s; an d sj can be sliduntil it is flush against the left side of R,( i , ) withoutincreasing the cost of the S-RST. This is shown in Fig. 1 (e). T he layout of the edge e = ( i , ) is now a Z-shape.(d) (i) Si = i, or Si is on the right side of RE ( i, j ),and (ii) Si is on the upper side of RE ( i , j ): Similar tosubcase (c).

    The alterations of the layout of the edge e = ( i , j )described in all these cases mould the layout of e into aZ-shape (an L-shape is considered to be a degenerate Z-shape) without any increase in the cost. Thus the resultingS-RST q k is optimal and has a subtree Tk = Tk- U ewhich is implemented using only Z-shapes. This con-cludes the inductive proof of the claim. Applying theclaim for k = n - 1, we have that the S-RST \k, - isoptimal and uses Z-shaped layouts fo r all the n - 1 edgesof the SMST T , which completes the proof of th etheorem. 0

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    8/9

    192 IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN, VOL. 9 . NO . 2. FEBRUARY 1990

    ,912,915

    .m

    .!JUG. S O i ,902IO0 I8

    Fig. 12 . Mean ratios of costs.VI. ALGORITHMOR OPTIMAL -RST

    We now describe Algorithm Optimal-Z-RST for con-structing an optimal Z-RST, which by Theorem 3 is alsoan optimal S-RST. The input to the algorithm is a sepa-rable MST T of a point set S .Hang the input separable MST T by any leaf edge rresulting in the rooted tree T, . For each edge e in T , le tT, denote the sub tree of T, that hangs by the edge e . Givena Z-shaped layout z f an edge e , we let 9, e) denote theZ-RST of the subtree T,, which has the minimum cost

    Fig. 13. A MS T an d its optimal L-RST: Example of 2 /3 cost ratio.

    VII . EXPERIMENTALESULTSamong all Z-RSTs of Te , n which the layout of the edgee is constrained to be the Z-shape z. q2 ( ) can be com-puted recursively as follows: Let e, : i = 1 , 2, e * * ,d beth e d child edges of e in the rooted tree T, .For each childedge e , an d fo r each possible Z-shaped layout z,,of th eedge e , , recursively compute the constrained optimal Z-RSTs q,,,e , of the subtrees T,,. Note that there are 1( e , )such constrained Z-RSTs for each subtree T,,. Taking onesuch Z-RST for each subtree T,,, and merging these sub-tree Z-RSTs with the layout z of the edge e , results in aZ-RST of T,. Since the tree T has the separability prop-erty, the only new overlaps that can occur during thismerging are among the edges e , e l , - - , ed ,which areall incident on a common point. Therefore, the totalamount of overlap in the resulting Z-RST of T, is the sumof the overlaps among the layouts of the edges e , e l ,. . . e d , added to the sum of overlaps in the selected Z-RSTs of the subtrees T , . Enumerate all combinations ofselecting one of the Z-RSTs q,,e , ) or each subtree T,,,and for each such combination compute the resulting Z-RST of T,. The constrained optimal Z-RST !k2 e ) of th esubtree T, is simply the one with the least cost.To compute the optimal Z-RST of the entire rooted treeT,, ecursively compute (as explained above) the con-strained optimal Z-RSTs 9, r ) or each Z-shaped layoutz f the root edge r , and select that Z-RST of the smallestcost. The fact that above algorithm constructs the optimalS-RST follows from the separability of the input M ST andfrom the Z-sufficiency theorem. Regard ing time complex-ity, let I be the maximum of l ( e ) over all edges e . Itfollows from Lemm a 3 that the number of combinationsenumerated for each subtree is at most I Each com-bination can be processed in constant time. Sum ming upover all the rz - 1 subtrees, the worst case time comp lex-ity of the algorithm is O( X Z6,,,). Hence we have the

    The algorithms for optimal L-RST and optimal S-RSTwere implemented using the C language. In both pro-grams, we used the O ( n 2 )Algorithm SMST of Sec tion I1to generate the separable MST needed as input to the twoRST algorithms. The two programs were tested exten-sively on a large number of random input point sets withcardinalities ranging from 5 to 100. Fig. 12 shows themean ratios of the cost of L-RST or S-RST over the MST.It is interesting to observe, th at on the average, an optim alS-RST has a cost which is only 0.5-percent lower thanthat of an optimal L-RST. How ever on some test exam-ples the optimal S-RST the reduction in the cost was ob-served to be as m uch as 10 percent.Hwang [7] has shown that the lowest possible ratio ofthe cost of a RST to that of the MST of the same set ofpoints is 2/3. However no such results are available forthe average ratio for a given num ber of points. Referringto the table in Fig. 12, we observe that fo r all cardinalitiesof the input point se ts, the average ratio of the cost of theRSTs produced by our approach to the cost of MST isclose to 9/10.Both the algorithms produce the optimum Steiner treesfor each member of the class of point sets whose optimalRST has a cost which is 2 /3 that of the cost of the MST[7]. One such example is illustrated in Fig. 13.The algorithm for optimal L-RST is quite fast takingless than 0.01 seconds for 10 input points, on an IBM3090 processor. Therefore the algorithm is very wellsuited for VLSI global routing applications. The algo-rithm for optimal S-RST is only slightly slower in prac-tice. This is because the number of combinations to enu-merate for any subtree is usually much less than the wo rstcase of l:ax. Empirically its average running time was ob-served to be between 0 z . 5 ) an d 0 n2 .

    following theorem. ACK NOW LEDG MEN TTheorem 4: Algorithm Optimal-Z-RST constructs theoptimal S-RST of the SMST T of a point set S of cardi-nality n in O ( n x I:,,) ime.

    The authors wish to thank one of the referees for sug-gesting simplifications in the separability and Z-suffi-ciency theorems. They are grateful to both referees for

  • 8/8/2019 1 L-Shaped Steiner Routing Algorithm

    9/9

    HO et al.: STEINER TREE PROBLEM 19 3

    many valuable comments and suggestions, and also wishto thank Majid Sarrafzadeh and Kai-Win Lee for severaluseful discussions.REFERENCES

    [I] A. V. Aho, M. R. Garey, and F. K. Hwang, Rectilinear Steinertrees: Efficient special-case algorithm, Networks , vol . 7 , pp . 37-58,1977.[2] A. V . Aho, J . E . Hopcrof t , and J . D. Ul lman, Data Structures andAlgorirhms. Reading, MA: Addison-Wesley, 1983.131 J . P . C o h o o n , D . S . Richards, and J. S . Salowe, A linear-timeSteiner tree routing algo rithm for terminals on the boundary of a rect-angle , in Dig . T echnica l P apers , ICCAD -88 , pp. 402-405, Nov.1988.[4] M. R. Garey and D. S . Johnson, The rectilinear Steiner tree prob-lem in NP-complete, SIAM J . Appl . Math . , vol . 32 , no . 4 , pp . 826-834, 1977.[SI M. Hanan, On Steiners problem with rectilinear distan ce, SIAMJ . Appl . Math . , vol. 14, no. 2, pp. 255-265, 1966.[6] J-M. H o, G. Vi jayan, and C . K. Wong, A new approach to therectilinear Steiner tree problem, in Proc. 26th ACM/IEEE DesignAutomation Conf., pp. 161-166, June 1989.[7] F . K. Hw ang, O n Steiner minimal trees with rectilinear distance,S I A M J . Appl . Math . , vol. 30, no. 1, pp. 104-114, 1976.[8] F . K. Hwang, An O ( n lo g n ) algorithm for suboptimal rectilinearSteiner trees. IEEE Trans. Circuits Syst., vol. CAS-26, pp. 75-77,Jan. 1979.[9 ] D. . Lee and C . K. W ong, Voronoi d iagrams in L , ( L , ) metricswith 2-dimensional s torage applications, SIAM J . Computing, vol.9 , n o . I , pp. 200-211, Feb . 1980.[IO] J . H. Lee , N. K . Bose, and F. K . Hwa ng, U se of Steiners problemin suboptimal routing in rectilinear metric , IEEE Trans. CircuitsSys t . , vol. CAS-23, pp. 470-476, July 197 6.[I ll K-W. Lee and C. Sechen, A new global router for row-based lay-out , in Dig . T ech. P apers , ICCAD-88 , pp. 180-183, Nov. 1988.[I21 J. G. Xiong, Alg orithms for global routing, in P roc . 23rd ACMIIEEE Design Automation Conf. , pp. 824-830, June 1986.*

    4 a

    Jan-Ming H o received the B.S. degree fromCheng-Kung University, Taiw an, in 1978, theM.S. degree from Chiao-Tong University, Tai-wan , in 19 80, both in electr ical engineering, andthe Ph.D . degree in computer science from North-western University, Evanston, IL, in 1989.Currently, he is an Associate Research F ellowat the Institute for Information Science, AcademiaSinica, Taiwan. His research interests includecomputational geometry, graph algorithms, andcomputer-aided design .

    Gopalakrishnan Vijayan received the B.Sc. de-gree in mathema tics from the University of Mad-ras, India, in 1975, the B.E. degree in electronicsand communication engineering in 1978 and theM. E. d egree in automation in 1980 from the In-dian Institute of Science, and the M. A. and Ph .D.degrees in electr ical engineering and computerScience from Princeton University, in 1982 and1983, respectively.From 1983 to 198 7, he was an assistant pro-fessor in the School of Information and C omputerScience at the Georgia Institute of Technology . He joine d IBM Researchin June 1987 as a research staff member in the VLSI Design Algorithmsgroup. His cu rrent research interests include VL SI design methodologiesand algorithms, combinatorial optimization, and graph theory.

    *

    C . K . Wong (M71-SM78-F85) received thePh.D . degree in mathematics from Columbia Uni-versity in 1970.He joined the IBM T . J. Watson Research Cen-ter in 1969 as a Research Staff Member and is cur-rently manager of the VLSI Design Algorithmsgroup in the Computer Sciences Department. Hewas Visiting Professor of Computer Science atUniversity of Illinois, Urbana in 1972-1973 andat Columbia University in 1978-1979. His mostrecent research is on VLSI design algorithms. He-holds four U.S. patents and has published over 100 papers in these areas.H e is author of Algorithmic Studies in Mass Storage Systems, (Compute rScience Press, 1983). He has received an Outstanding Invention Award,one Outstanding Technical Achievement Aw ard and fou r other InventionAwards from IBM.Dr . Wong is a member of the Association for Comput ing M achine ry .He was Edi tor of IEEE TRANSACTIONSN C O M P U T E R Srom 1982 to 1985and is an executive member of the IEEE Compu ter Society Technical Com-mittee on VLSI. He is also on the editorial board of tw o international jour-nals on Fuzzy Set theory and the foundin g Editor- in-Chief of Algorithrnica.