Finding a Noncrossing Steiner Forest in Plane Graphs ... - Springer Link

Report 2 Downloads 42 Views
Journal of Combinatorial Optimization, 5, 249–266, 2001 c 2001 Kluwer Academic Publishers. Manufactured in The Netherlands. °

Finding a Noncrossing Steiner Forest in Plane Graphs Under a 2-Face Condition YOSHIYUKI KUSAKARI [email protected] Department of Electronics and Information Systems, Akita Prefectural University, 84-4 Ebi-no-kuchi, Honjou-shi, Akita 015-0055, Japan DAISUKE MASUBUCHI [email protected] Thanks & Regards, IBM Japan Ltd., 19-21 Nihonbashi-Hakozaki-cho, Chuo-ku, Tokyo 103-8510, Japan TAKAO NISHIZEKI [email protected] Graduate School of Information Sciences, Tohoku University, Aoba-yama 05, Sendai 980-8579, Japan Received January 28, 2000; Revised July 11, 2000; Accepted July 12, 2000

Abstract. Let G = (V, E) be a plane graph with nonnegative edge weights, and let N be a family of k vertex sets N1 , N2 , . . . , Nk ⊆ V , called nets. Then a noncrossing Steiner forest for N in G is a set T of k trees T1 , T2 , . . . , Tk in G such that each tree Ti ∈ T connects all vertices, called terminals, in net Ni , any two trees in T do not cross each other, and the sum of edge weights of all trees is minimum. In this paper we give an algorithm to find a noncrossing Steiner forest in a plane graph G for the case where all terminals in nets lie on any two of the face boundaries of G. The algorithm takes time O(n log n) if G has n vertices and each net contains a bounded number of terminals. Keywords: algorithm, plane graph, noncrossing, Steiner tree

1.

Introduction

The Steiner tree problem is to find a minimum tree connecting a “net,” i.e., a set of “pins,” and often appears in the routing of VLSI layouts. One may often wish to find Steiner trees for many nets instead of a single net. Any two of the trees must not cross each other in the single layer VLSI layout due to a physical condition. Algorithms to solve such problems are desired for automatic routing of VLSI layouts (Kramer and Leeuwen, 1982; Lengauer, 1990; Lynch, 1975). One of such problems is to find, in a given plane graph G with k terminal-pairs, a set of k noncrossing paths such that any two of the paths do not cross each other and the sum of their weights is minimum. This problem is a natural model for the single layer VLSI routing of “two-terminals nets”; edges of a graph correspond to routing regions, paths to routes, and each terminal pair of a path to a pair of pins connected by a route. One may wish to find a set of noncrossing paths the total weight of which is minimum. If G satisfies the so-called 2-face condition, that is, all terminals are on at most two of the face boundaries of G, then such a set of k noncrossing paths can be found in time O(n log n) for any k ≥ 1, where n is the number of vertices in a plane graph (Takahashi et al, 1996).

250

KUSAKARI, MASUBUCHI AND NISHIZEKI

Another well-known problem is finding a Steiner tree in a plane graph (Bern, 1990; Dreyfus and Wagner, 1972; Ericson et al., 1987; Winter, 1987). Although finding a Steiner tree on a plane graph is useful for VLSI routing, the problem is N P-complete (Garey and Johnson, 1979) and it seems that there exists no efficient algorithm to solve the problem. However, if all terminals lie on a single face boundary of a plane graph, a Steiner tree can be found in time O(l 3 n + l 2 n log n) where n is the number of vertices in a plane graph and l is the number of terminals (Bern, 1990; Ericson et al., 1987). In this paper, we deal with a problem extended from the two problems above and defined as follows. For a plane graph G = (V, E) with nonnegative edge weights and a family N of k vertex sets N1 , N2 , . . . , Nk , called nets, find a set T of k trees T1 , T2 , . . . , Tk , called a noncrossing Steiner forest, such that – for each net Ni ∈ N , the tree Ti ∈ T connects all vertices in Ni , called terminals; – any two trees in T do not cross each other (a formal definition of crossing trees will be given in Section 2); P and P – the total weight Ti ∈T e∈Ti w(e) of the forest T is minimum, where w is a weight function from E to nonnegative real numbers. An example of a noncrossing Steiner forest is depicted in figure 1, where k = 4, all terminals in net Ni , 1 ≤ i ≤ k, are labeled by i. If every net contains exactly two terminals, then a noncrossing Steiner forest is merely a set of noncrossing paths such that the sum of their weights is minimum. On the other hand, if k = 1, that is, there is exactly one net, then a noncrossing Steiner forest is merely an ordinary Steiner tree. Since the Steiner tree problem is N P-complete for plane graphs (Garey and Johnson, 1979), the noncrossing Steiner forest problem is N P-complete in general for plane graphs. However, some restrictions for the location of terminals may

Figure 1.

A noncrossing Steiner forest.

FINDING A NONCROSSING STEINER FOREST

251

contribute to the construction of an efficient algorithm. In this paper we show that it is indeed the case. That is, we give an efficient algorithm for finding a noncrossing Steiner forest in a plane graph satisfying the 2-face condition: all terminals lie on at most two of the face boundaries as in figure 1. Our algorithm takes O(n log n) time if there are n vertices in a graph and every net has a bounded number of terminals. This paper is organized as follows. In Section 2, we give some preliminary definitions. In Section 3, we give an algorithm for finding a noncrossing Steiner forest in a plane graph for the case where all terminals are on a single face boundary. In Section 4, we give an algorithm for finding a noncrossing Steiner forest for the case where all terminals are on at most two of the face boundaries. Finally, we conclude in Section 5. An early version of the paper was presented at (Kusakari et al., 1999). 2.

Preliminaries

In this section we define terms and formally describe a noncrossing Steiner forest problem. We denote by G = (V, E) a graph consisting of a vertex set V and an edge set E. We denote by V (G) and E(G) the vertex set and the edge set of G, respectively. Let n be the number of vertices in G. Assume that G is an undirected plane connected graph and that every edge e ∈ E has a nonnegative weight w(e). Furthermore, we assume that G is embedded in the plane R2 . The image of G in R2 is denoted by I mg(G) ⊆ R2 . A face of G is a connected component of R2 − I mg(G). The boundary B( f ) of a face f is the maximal subgraph of G whose image is included in the closure of the face f . The unbounded face of G is called the outer face. For two graphs G = (V, E) and H = (W, F), we define G ∪ H = (V ∪ W, E ∪ F). A set of vertices in G which we wish to connect by a tree is called a net. All vertices in a net are called terminals. Let N = {N1 , N2 , . . . , Nk } be a set of k nets. One may assume that Ni ∩ N j = φ for any two different nets Ni , N j ∈ N . Let li = |Ni | and we write Ni = {u i1 , u i2 , . . . , u ili } for each i, 1 ≤ i ≤ k. We assume that all li , 1 ≤ i ≤ k, are fixed constants. We assume that all terminals are on the boundaries of two faces, say f 1 and f 2 . One may assume without loss of generality that f 1 is the outer face and f 2 is an inner face. For the sake of simplicity, we assume that G is 2-connected and that B( f 1 ) and B( f 2 ) have no common vertices or edges. all terminals in Ni is called a tree Ti for For each net Ni ∈ N , a tree in G connecting P net Ni (in G). A weight w(Ti ) of Ti is e∈E(Ti ) w(e). A Steiner tree for Ni (in G) is a tree Ti for Ni in G with the minimum weight w(Ti ). The so-called noncrossing paths may share common vertices or edges but do not cross each other in the plane. For example, paths P1 and P2 depicted in figure 2(a) cross each other on the plane, while paths P1 and P2 in figure 2(b) do not cross each other. We then define “crossing trees.” Let Gˆ be a plane graph obtained from G as follows: add a new vertex v O in the outer face f 1 , and join v O and every terminal on B( f 1 ); similarly, add a new vertex v I in the inner face f 2 , and join v I and every terminal on B( f 2 ). Add to tree Ti the following edges, those joining v O and terminals of Ni on B( f 1 ) and those ˆ We say joining v I and terminals of Ni on B( f 2 ), and let Tˆi be the resulting subgraph of G. that trees Ti and T j do not cross each other if any pair of a path in Tˆi and a path in Tˆ j do

252

KUSAKARI, MASUBUCHI AND NISHIZEKI

Figure 2.

(a) Crossing paths, and (b) noncrossing paths.

Figure 3.

Graph Gˆ and a crossing forest.

not cross each other. In figure 3, trees T1 and T4 do not cross each other. On the other hand, trees T2 and T3 cross each other since the path connecting v O and u 22 through u 21 in Tˆ2 and the path connecting u 31 and u 33 through u 21 in Tˆ3 cross each other. The definition above is appropriate for the VLSI single-layer routing problem. A forest T for N in G is defined to be a set {T1 , T2 , . . . , Tk } such that, for each i, 1 ≤ i ≤ k, Ti is a tree for net Ni in G. We say that a forest T is noncrossing if every pair of trees in T does not cross each other. The forest in figure Pk1 is noncrossing, but the w(Ti ). A noncrossing forest in figure 3 is crossing. The weight w(T ) of a forest T is i=1 Steiner forest for N in G is a noncrossing forest T for N in G with the minimum total weight w(T ). Our goal is to find a noncrossing Steiner forest for N in a plane graph for the following two restricted cases: a case where all terminals lie on a single face boundary, and the other case where all terminals lie on two of the face boundaries. 3.

One face problem

In this section, we present an efficient algorithm to solve the problem for the case where all terminals lie on a single face boundary B( f 1 ) of a plane graph G. We call such a restricted problem the one face problem. Our algorithm first finds k cycles C1 , C2 , . . . , Ck in G, and

FINDING A NONCROSSING STEINER FOREST

Figure 4.

253

A forbidden configuration of terminals.

then finds k Steiner trees, one for each net Ni ∈ N , in the inside of Ci . This is a main idea in this section. One can observe that the following lemma holds. Lemma 1. There exists a noncrossing forest for N in G if and only if there are no four distinct terminals u ii 0 ,u j j 0 ,u ii 00 and u j j 00 appearing clockwise on B( f 1 ) in this order, where u ii 0 ,u ii 00 ∈ Ni ∈ N and u j j 0 ,u j j 00 ∈ N j ∈ N . (See figure 4.) Using Lemma 1, one can easily determine in linear time whether there is a noncrossing forest for N . Thus, from now on, we may assume that there is a noncrossing forest for N . Let SO = v1 , v2 , . . . , vq be the clockwise sequence of all vertices on B( f 1 ) starting from u 11 , where v1 = u 11 . One may assume that, for each net Ni ∈ N , the terminals u i1 , u i2 , . . . , u ili in Ni appear in SO in this order, and that the first terminals u 11 , u 21 , . . . , u k1 in all nets appear in SO in this order, as illustrated in figure 5 for the case k = 4. A cycle Ci , 1 ≤ i ≤ k, for Ni is defined as follows. For each i, 1 ≤ i ≤ k, let Ni0 be a set of li two-terminals nets defined as follows: Ni0 = {{u i1 , u i2 }, {u i2 , u i3 }, . . . , {u ili u i1 }}. Sk Pk Ni0 . Then N 0 consists of i=1 li two-terminals nets. In figure 6(b), each Let N 0 = i=1

Figure 5.

A noncrossing Steiner forest.

254

Figure 6.

KUSAKARI, MASUBUCHI AND NISHIZEKI

(a) Noncrossing cycles for N , and (b) a set N 0 of two terminal nets.

two-terminals net in N 0 are drawn by a pair of a white point and a black point. There exists a set Pi of li paths P1 , P2 , . . . , Pli such that each Pi 0 , 1 ≤ i 0 ≤ li , is a shortest path connecting a two-terminals net {u ii 0 , u i(i 0 +1) } in G, and any two paths in Pi do not cross each other, where u i(li +1) = u i1 . The cycle obtained by concatenating all the li paths in Pi is called a cycle Ci for Ni . We denote by G(Ci ) the subgraphs of G inside I mg(Ci ). We say that cycles Ci and C j do not cross each other if any pair of paths in Pi and P j do not cross each other. A set of noncrossing cycles for N is defined to be a set C = {C1 , C2 , . . . , Ck } such that each Ci is a cycle for Ni and any two cycles in C do not cross each other. Figure 6(a) illustrates a set of noncrossing cycles. Then the following lemma holds. Lemma 2. There exists a set C of noncrossing cycles for N if there exists a noncrossing forest T for N . Proof: Assume that there exists a noncrossing forest T for N . Then there exists a noncrossing forest for N 0 . Let T 0 be a noncrossing Steiner forest for N 0 . Since N 0 is a set of two-terminals nets and all terminals of N 0 lie on the outer face boundary B( f 1 ), all paths in T 0 are shortest paths (Takahashi et al., 1996). Therefore, the set of k cycles obtained by concatenating these shortest paths is exactly a set C of noncrossing cycles for N . 2 2 Finding a set C = {C1 , C2 , . . . , Ck } of noncrossing cycles would require time PkÄ(n ), because vertices in G may be shared by many distinct cycles and hence the sum i=1 |V (Ci )| is not always bounded by O(n). Remember that k isS not always a fixed constant although k = O(n). Therefore, we find a subgraph G C = Ci ∈C Ci of G instead of a set C of noncrossing S cycles. Clearly, G C has at most n vertices. Similarly, we find a subgraph G T = Ti ∈T Ti of G instead of a noncrossing Steiner forest T for N . From G T one can find Ti in time O(|V (Ti )|) for each i, 1 ≤ i ≤ k. We are now ready to present an algorithm Forest1 to solve the one face problem.

Algorithm Forest1 step 1. Find G C , where C is a set of noncrossing cycles for N ;

FINDING A NONCROSSING STEINER FOREST

255

step 2. For each cycle Ci ∈ C, find Ska Steiner tree Ti for Ni in the plane subgraph G(Ci ); step 3. Construct a graph G T = i=1 Ti . We first consider how to implement step 1. Since all terminals in N 0 are on a single face boundary B( f 1 ), using the algorithm in (Takahashi et al., 1996), one can find the minimum noncrossing paths for N 0 in time O(n log n). Furthermore, it is shown in (Takahashi et al., 1996) that each of the paths is a shortest path connecting the pair of terminals in a net. Therefore, for each i, 1 ≤ i ≤ k, one can obtain a cycle Ci by concatenating the li paths for the nets in Ni0 . Thus, the minimum noncrossing paths for N 0 immediately yield the Sk Ci . subgraph G C = i=1 We next consider how to implement steps 2 and 3. Let m i be the number of the edges in G(Ci ). Using the algorithm in (Bern, 1990; Ericson et al., 1987), for each net Ni ∈ N , one can find a Steiner tree Ti for Ni in time O(m i log m i ) since |Ni | = O(1) and all terminals in Ni lie on the outer face boundary of G(Ci ). Therefore, one can find a noncrossing Steiner Pk m i log m i ). If many cycles share common vertices or edges, forest T for N in time O( i=1 Pk i=1 m i is not always bounded by O(n). However, one can find G T in time O(n log n) by using a method similar to one in (Takahashi et al., 1996); it finds T by a divide-and-conquer based on the so-called genealogy tree of nets; each recursive call can be done in time O(n), and the depth of the recursive call is at most log n. The correctness of our algorithm is based on the following lemma. We denote by T [v1 , v2 ] the path on a tree T from v1 ∈ V (T ) to v2 ∈ V (T ). Lemma 3. For any set C = {C1 , C2 , . . . , Ck } of noncrossing cycles, a Steiner tree Ti for Ni in G(Ci ) is a Steiner tree Ti for Ni in G for each i, 1 ≤ i ≤ k. Proof: Let Ti ∗ be the set of all Steiner trees for Ni in G. It suffices to show that G(Ci ) contains at least one tree in Ti ∗ . Suppose for a contradiction that G(Ci ) contains none of the trees in Ti ∗ . Let Ti ∈ Ti ∗ be a tree for Ni in G i such that the graph Ti − (G(Ci ) ∩ Ti ) has the minimum number n c of connected components, where Ti − (G(Ci ) ∩ Ti ) is a subgraph of G induced by the set E(Ti ) − E(G(Ci )) ∩ E(Ti ) of edges. Then, n c > 0 since G(Ci ) does not contain any tree in Ti ∗ . Figure 7 illustrates an example for n c = 5. We will derive a contradiction by showing that there exists a tree Ti0 ∈ Ti ∗ such that (a) w(Ti0 ) ≤ w(Ti ); and (b) the graph Ti0 − (G(Ci ) ∩ Ti0 ) has n c − 1 connected components. Since Ti is a tree, every connected component of the graph Ti − (G(Ci ) ∩ Ti ) is a tree. Let t j be an arbitrary component of the graph Ti − (G(Ci ) ∩ Ti ). Then, all leaves of t j lie on a shortest path Pi 0 ∈ Pi . Let a be the first vertex of t j on Pi 0 going from u ii 0 to u i(i 0 +1) , and let b be the last vertex. We denote by G(a, b) the maximum subgraph of G contained in a region bounded by I mg(Pi 0 [a, b]) and I mg(t j [a, b]). We may assume that G(a, b) contains no component of Ti − (G(Ci ) ∩ Ti ) other than t j (See figure 7): if G(a, b) contains a component t 0j 6= t j of Ti − (G(Ci ) ∩ Ti ), then we may regard t 0j as t j . We replace t j in

256

KUSAKARI, MASUBUCHI AND NISHIZEKI

Figure 7.

A cycle Ci for Ni and a Steiner tree Ti for Ni in G.

Ti by Pi 0 [a, b], and let Ti0 be the resulting tree. Since all leaves of t j lie on Pi 0 [a, b], Ti0 connects all terminals of Ni . Clearly, Ti − (G(Ci ) ∩ Ti ) has n c − 1 connected components. Since Pi0 is a shortest path, w(Pi 0 [a, b]) ≤ w(t j [a, b]). Furthermore, since every edge has 2 nonnegative length, w(t j [a, b]) ≤ w(t j ). Thus, w(Ti0 ) ≤ w(Ti ). Thus, we have the following Theorem 1. Theorem 1. If all terminals lie on a single face boundary in a plane graph, then one can find a noncrossing Steiner forest T in time O(n log n). 4.

Two faces problem

In this section, we give an algorithm to find a noncrossing Steiner forest for N for the case where all terminals lie on two of the face boundaries, B( f 1 ) and B( f 2 ). We call such a restricted problem the two faces problem. As shown later in Lemma 4, for any sets N of nets, one can easily decide in linear time whether there exists a noncrossing forest for N or not. Therefore we may assume that there exists a noncrossing forest for N . We divide the set N into the following three subsets NOUT , NIN and N I O : 1. for each net Ni ∈ NOUT , all terminals of Ni lie on the outer face boundary B( f 1 ); 2. for each net Ni ∈ NIN , all terminals of Ni lie on the inner face boundary B( f 2 ); and 3. for each net Ni ∈ NIO , Ni contains a terminal on B( f 1 ) and a terminal on B( f 2 ). Obviously, these three sets are disjoint and N = NOUT ∪ NIN ∪ N I O . Let m = |NIO |, let NIO = {N1 , N2 , . . . , Nm }, and let NOUT ∪ NIN = {Nm+1 , Nm+2 , . . . , Nk }. For each net Ni ∈ NIO , let NiO = Ni ∩ V (B( f 1 )) and NiI = Ni ∩ V (B( f 2 )). One may assume that NiO = {u i1 , u i2 , . . . , u ili0 } and NiI = {u i(li0 +1) , u i(li0 +2) , . . . , u ili }.

FINDING A NONCROSSING STEINER FOREST

Figure 8.

257

A noncrossing forest.

O I Let NIO = {NiO : Ni ∈ NIO } and let NIO = {NiI : Ni ∈ NIO }. Then one can observe that the following lemma holds.

Lemma 4. There exists a noncrossing forest for N in G if and only if O in G; (a) there exists a noncrossing forest for NOUT ∪ NIO I (b) there exists a noncrossing forest for NIN ∪ NIO in G; and (c) for some ordering of the nets in N I O , terminals u 11 , u 12 , . . . , u 1l10 , u 21 , u 22 , . . . , u 2l20 , . . . , u m1 , u m2 , . . . , u mlm0 appear clockwise on B( f 1 ) in this order, and u 1(l10 +1) , u 1(l10 +2) , . . . , u 1l1 , u 2(l20 +1) , u 2(l20 +2) , . . . , u 2l2 , . . . , u m(lm0 +1) , u m(lm0 +2) , . . . , u mlm appear clockwise on B( f 2 ) in this order. Figure 8 illustrates an arrangement of terminals in N I O satisfying the condition (c) in Lemma 4 where m = 4, l10 = 3, l1 = 6, l20 = 2, l2 = 4, l30 = 2, l3 = 3, l40 = 2 and l4 = 4. Clearly one can determine in linear time whether the conditions (a)–(c) in Lemma 4 holds. One may assume NIO 6= φ: otherwise, one can easily find a noncrossing Steiner forest T for N ; find a noncrossing Steiner forest TOUT for NOUT by executing Forest1 for NOUT ; find a noncrossing Steiner forest TIN for NIN by executing Forest1 for NIN ; then it is easy to find a noncrossing Steiner forest T for N from TOUT and TIN . If |NIO | = 1, that is, NIO = {N1 }, then one can easily find a noncrossing Steiner forest T for N as follows. Using an algorithm in (Bern, 1990; Ericson et al., 1987), we first find a Steiner tree T1 for N1 . We may assume, after renumbering the vertices in N1 if necessary, that the tree T1 and the path T1 [u 11 , u i(l10 +1) ] do not cross each other as illustrated in figure 9. We consider the following l1 − 1 subgraphs G j , 1 ≤ j ≤ l1 − 1, of G. For each j, 1 ≤ j ≤ l10 − 1, let G j be a subgraph of G bounded by a clockwise path from u 1 j to u 1( j+1) on B( f 1 ) and a path T1 [u 1( j+1) , u 1 j ]. For each j, l10 + 1 ≤ j ≤ l1 − 1, let G j be a subgraph of G bounded by a clockwise path from u 1 j to u 1( j+1) on B( f 2 ) and a path T1 [u 1( j+1) , u 1 j ]. Let G l10 be a subgraph of G bounded by a path T1 [u 11 , u 1(l10 +1) ], a counter-clockwise path

258

Figure 9.

KUSAKARI, MASUBUCHI AND NISHIZEKI

A Steiner tree T1 and graphs G 1 , G 2 , . . . , G l1 −1 .

from u 1(l10 +1) to u 1l1 on B( f 2 ), a path T1 [u 1l1 , u 1l10 ], and a clockwise path from u 1l10 to u 11 on B( f 1 ). For every subgraph G j containing nets in NOUT ∪ NIN , we can find a noncrossing Steiner forest for the nets by using Forest1. From these noncrossing forests and a Steiner tree T1 , we can easily find a noncrossing Steiner forest T for N . The time complexity is obviously O(n log n). From now on, we may assume |N I O | ≥ 2. The main idea of our algorithm is to reduce the two faces problem for G to the one face problem for three graphs G ∗ , G + , and G − . For this purpose, we define a slit graph SG(P) of a graph G for a path P as follows. For a path P between s ∈ V (B( f 1 )) and t ∈ V (B( f 2 )), a slit graph SG(P) of G for P is generated from G by slitting apart path P into two paths Pl and Pr , duplicating the vertices and edges of P as follows (See figure 10). Each vertex v in P is replaced by two new vertices vl ∈ V (Pl ) and vr ∈ V (Pr ). Each edge (v, v 0 ) in P is replaced by two parallel edges (vl , vl0 ) ∈ E(Pl ) and (vr , vr0 ) ∈ E(Pr ). Any edge (v, w) that is not in P but is incident to a vertex v in P

Figure 10.

A graph G and a slit graph SG(P).

FINDING A NONCROSSING STEINER FOREST

Figure 11.

259

Three slit graphs SG(P ∗ ), SG(P + ), SG(P − ).

is replaced by (vl , w) if (v, w) is to the left of a path P going from s to t, and by (vr , w) if (v, w) is to the right of the path. If s or t is a terminal for G, then sl or tl is a terminal for SG(P). The operation above is called slitting G along P. A graph and its slit graph are illustrated in figure 10. Note that, for a plane graph SG(P), all terminals lie on the outer face boundary. Let s = u 11 , let t = u 1(l10 +1) , and let P ∗ be any shortest path connecting s and t in G. We denote by P + the shortest one among all paths of G that go from s to t after turning around the inner face f 2 clockwise once more than P ∗ . Then the path P + corresponds to a shortest path connecting sl and tr in SG(P ∗ ). (In figure 11(a) the path P + is drawn by a thick line.) Similarly, we denote by P − the shortest one among all paths of G that go from s to t after turning around the inner face f 2 counter-clockwise once more than P ∗ . Then, the path P − in G corresponds to a shortest path connecting sr and tl in SG(P ∗ ). (In figure 11(a) the path P − is drawn by a dotted line.) We are now ready to present an algorithm Forest2 to solve the two faces problem. Algorithm Forest2 step 1. Find a shortest path P ∗ between s and t in G; step 2. Construct a slit graph SG(P ∗ ) of G, find P + as a shortest path between sl and tr in SG(P ∗ ), and find P − as a shortest path between sr and tl in SG(P ∗ ); {figure 11(a)} step 3. Construct slit graphs SG(P + ) and SG(P − ) of G; {figures 11(b) and (c)} step 4. Using Forest1, find noncrossing Steiner forests T ∗ in SG(P ∗ ), T + in SG(P + ), and T − in SG(P − ); step 5. Output one of these three forests T ∗ , T + , T − having the minimum total weight. One can find P ∗ either in time O(n log n) by an ordinary Dijkstra algorithm or in time O(n) by a sophisticated shortest path algorithm in (Henzinger et al., 1997; Thorup, 1999).

260

KUSAKARI, MASUBUCHI AND NISHIZEKI

Thus, one can execute steps 1–3 in time O(n log n). Since all terminals in SG(P ∗ ) lie on the outer face boundary of SG(P ∗ ), one can find G T ∗ in SG(P ∗ ) in time O(n log n) using Forest1. Similarly, one can find G T + and G T − in time O(n log n). Thus, one can execute step 4 in time O(n log n). Obviously, one can execute step 5 in constant time. Thus, Forest 2 can be executed in time O(n log n). The correctness of our algorithm is based on the following lemma, a proof of which will be given in Appendix. Lemma 5. There exists a noncrossing Steiner forest T such that either (i), (ii), or (iii) holds. (i) P ∗ and all trees in T do not cross eachother. (ii) P + and all trees in T do notcross each other. (iii) P − and all trees in T do not cross each other. Thus we have the following Theorem 2. Theorem 2. If all terminals lies on at most two of the face boundaries of a plane graph, then one can find a noncrossing Steiner forest in time O(n log n). Proof: Algorithm Forest2 can be executed in time O(n log n) as mention above. By Lemma 5, there exists a noncrossing Steiner forest T such that either above (i), (ii), or (iii) holds. A noncrossing Steiner forest T ∗ in SG(P ∗ ) is a noncrossing Steiner forest in G which satisfies (i). Similarly, noncrossing Steiner forests T + and T − in SG(P + ) and SG(P − ) are noncrossing Steiner forests in G which satisfy (ii) and (iii), respectively. Thus, the minimum one among these three forests T ∗ , T + , and T − is a noncrossing Steiner forests in G. 2 5.

Conclusion

In this paper, we present an efficient algorithm for finding a noncrossing Steiner forest in a plane graph for the case all terminals are located on at most two of the face boundaries. Our algorithm takes O(n log n) time and O(n) space if each net contains a bounded number of terminals. It takes time O(L 3 n + L 2 n log n) if each net does not always contain a bounded number of terminals but contains at most L terminals. Slightly modifying our algorithm, one can find an “optimal” noncrossing forest. Let T = {T1 , T2 , . . . , Tk } be a noncrossing forest for N . Denote the weight w(Ti ) of Ti simply by wi . Let f (w1 , w2 , . . . , wk ) be an arbitrary (objective) function which is nondecreasing with respect to each variable wi . We call a noncrossing forest T = {T1 , T2 , . . . , Tk } minimizing f (w1 , w2 , . . . , wk ) an optimal noncrossing forest (with respect to the objective function f ). Example 1. The noncrossing Pk Steiner forest is an optimal noncrossing forest minimizing wi . Clearly, f is nondecreasing with respect to each wi . the objective function f = i=1

FINDING A NONCROSSING STEINER FOREST

261

Example 2. If the wires for all nets have the same width, then a noncrossing Steiner forest correspond to a routing minimizing the area required by wires. On the other hand, if the wires have various P widths, say width αi for net Ni , then the optimal noncrossing forest minimizing f = i αi wi corresponds to a routing minimizing the area. This function f is also nondecreasing with respect to wi if all αi are not negative. One of future works is to obtain an algorithm to solve the noncrossing Steiner forest problem in a general case where terminals lie on three or more face boundaries. Appendix: Proof of Lemma 5 We first prove the following Lemmas 6–10, and then prove Lemma 5 using these lemmas. Lemma 6. For any path P in G from s = u 11 to t = u 1(l10 +1) , there exists a noncrossing forest T for N satisfying the following (a) and (b): (a) P and all trees in T do not cross each other; and (b) every tree Ti ∈ T has the minimum weight among all trees for Ni that do not cross P. Proof: Since there exists a noncrossing forest for N in G, terminals u 11 (= s), u 12 , . . . , u 1l10 , u 21 , u 22 , . . . , u 2l20 , . . . , u m1 , u m2 , . . . , u mlm0 , u mlm , u m(lm −1) , . . . , u m(lm0 +1) , . . . , u 1l1 , u 1(l1 −1) , . . . , u 1(l10 +1) (= t) appear on the outer face boundary of SG(P) in this order (See figures 8 and 10). By Lemma 1, one can observe there exists a noncrossing forest T for N in SG(P). It should be noted that there may not exist a noncrossing forest T for N in SG(P) unless s = u 11 and t = u 1(l10 +1) . Since T is a forest in SG(P), P and all trees in T do not cross each other. Furthermore, by Theorem 1, every tree Ti ∈ T is a Steiner tree for Ni in SG(P), and hence Ti has the minimum weight among all trees for Ni that do not cross P. 2 We may assume that G is embedded in an annular domain as follows. The images I mg(B( f 1 )) and I mg(B( f 2 )) are embedded on two circles Z 1 with radius 1 and Z 2 with radius 1/2, both having the center P at the origin O of the x-y plane. The image I mg(G) is embedded in an annular domain surrounded by Z 1 and Z 2 . Furthermore, we may assume without loss of generality that the terminals of nets Ni ∈ NIO on B( f 1 ) are embedded on Z 1 as follows: s = u 11 is on point (0, −1) ∈ R2 ; the first terminals u 11 , u 21 , . . . , u m1 of nets in NIO clockwise appears on Z 1 in this order, and divide Z 1 into m arcs of the same length; and the angle 6 u i1 Ou ili0 of arc u d i1 u ili0 is sufficiently smaller than 2π/m. The terminals of nets Ni ∈ NIO on B( f 2 ) are embedded on Z 2 similarly as those on Z 1 , where t = u 1(l10 +1) is on point (0, −1/2) ∈ R2 . (See figure 12.) Then, ε = max {max{6 u i1 Ou ili0 , 6 u i(li0 +1) Ou ili }} 1≤i≤m is very small. Let P be a path in G from a vertex u on B( f 1 ) to a vertex v on B( f 2 ). Let θ be a total angle (measured clockwise) turned through by the line O X when point X moves on P from u to v. Possibly |θ| > 2π . We define a turning number τ (P) of a path P by τ (P) = b(θ +ε)/2πc. Intuitively, the path P turns around B( f 2 ) approximately τ (P) times. A tree Ti for Ni ∈ N I O is defined to be homogenous if all paths in Ti , each connecting a terminal in NiO and a terminal in NiI , have the same turning number. The number is called

262

Figure 12.

KUSAKARI, MASUBUCHI AND NISHIZEKI

Embedding of G in an annular domain.

a turning number of a homogenous tree Ti , and is denoted by τ (Ti ). Then one can easily observe that the following lemma holds since |N I O | ≥ 2. Lemma 7. For any noncrossing forest T for N in G, all trees in T for nets in N I O are homogenous and have the same turning number. We then have the following lemma for net N I O . Lemma 8. Let Ni be any net in N I O , and let σ be any integer. Let path P be the shortest one among all paths from s = u 11 to t = u 1(l10 +1) with the turning number σ , and let Ti be any homogenous tree for Ni with τ (Ti ) = σ . Then, there exists a homogenous tree Ti0 for Ni such that (a) τ (Ti0 ) = σ ; (b) w(Ti0 ) ≤ w(Ti ); and (c) Ti0 and P do not cross each other. Proof: We may assume that Ti and P cross each other: otherwise, Ti0 = Ti satisfies (a)–(c). Let E 0 (Ti ) be the set of edges in SG(P) corresponding to the set E(Ti ) of edges in G, where, for every edge e ∈ E(Ti ) ∩ E(P), E 0 (Ti ) does not contain er ∈ E(Pr ) but contains el ∈ E(Pl ). Let Ti (P) be a subgraph of SG(P) induced by E 0 (Ti ). Then Ti (P) is not always a tree, but is a forest. Let T¯i (P) be the subforest of Ti (P) which consists of all trees in Ti (P), each containing no terminal of net Ni . Path P is drawn by a straight gray line st in figures 13(a) and (b), tree Ti by solid lines in figure 13(a), and forest T¯i (P) by dotted lines in figure 13(b). Let t j be a tree in T¯i (P). Let a be the first vertex of t j on P from s to t, and let b be the last one. We replace t j in Ti by P[a, b], and let Ti [t j ] be the resulting tree. Then,

FINDING A NONCROSSING STEINER FOREST

Figure 13.

263

(a) Tree Ti crossing P, and (b) tree Ti0 not crossing P.

w(Ti [t j ]) ≤ w(Ti ) since w(P[a, b]) ≤ w(t j [a, b]) ≤ w(t j ). Furthermore, Ti [t j ] connects all terminals of Ni since all leaves of t j ∈ T¯i (P) lie on P[a, b]. Similarly, we replace all other trees in T¯i (P) by subpaths of P as above, and let Ti0 be the resulting tree. In figure 13(b), Ti0 is drawn by solid lines. Then, Ti0 is a homogenous tree for Ni , τ (Ti0 ) = τ (Ti ) = σ , 2 w(Ti0 ) ≤ w(Ti ), and Ti0 and P do not cross each other. The following lemma holds for net Ni ∈ NOUT ∪ NIO Lemma 9. Let σ be any integer, and let P be the shortest one among all paths from s = u 11 to t = u 1(l10 +1) with the turning number σ . Let T be any noncrossing forest for N . Then, for each tree Ti ∈ T for net Ni ∈ NOUT ∪ NIN , there exists a tree Ti0 for Ni such that (a) w(Ti0 ) ≤ w(Ti ); and (b) Ti0 and P do not cross each other. Proof: One may assume that Ni ∈ NOUT ; the proof for the case Ni ∈ NIN is similar. Furthermore, one may assume, after renaming the terminals in Ni if necessary, that u i1 , u i2 , . . . , u ili appear on B( f 1 ) clockwise in this order. Let C be a cycle obtained by concatenating a clockwise path from u i1 to u ili on B( f 1 ) and a path Ti [u ili , u i1 ]. If the inner face f 2 lies inside C as illustrated in figure 14(a), then G has no noncrossing forest T for N such that Ti ∈ T because N I O 6= φ. Therefore, the inner face f 2 lies outside C as illustrated in figure 14(b). Similarly as in the proof of Lemma 8, one can prove that there exists a tree 2 Ti0 satisfying (a) and (b). The following lemma holds. Lemma 10. Let P ∗ be a shortest path between s and t, and let σ ∗ = τ (P ∗ ). Let Ni be any net in N I O , and let Ti be any homogenous tree for Ni . Then there exists a homogenous

264

KUSAKARI, MASUBUCHI AND NISHIZEKI

Figure 14.

(a) Tree Ti and (b) tree Ti0 .

tree Ti0 for Ni such that (a) w(Ti0 ) ≤ w(Ti ); and (b)  ∗ σ τ (Ti0 ) = σ ∗ + 1  ∗ σ −1

if τ (Ti ) = σ ∗ if τ (Ti ) ≥ σ ∗ + 1 if τ (Ti ) ≤ σ ∗ − 1.

Proof: If τ (Ti ) is equal to either σ ∗ , σ ∗ + 1 or σ ∗ − 1, then Ti0 = Ti satisfies (a) and (b). Therefore, we may assume that either τ (Ti ) ≥ σ ∗ + 2 or τ (Ti ) ≤ σ ∗ − 2. We may further assume that τ (Ti ) ≥ σ ∗ + 2; the proof for the case τ (Ti ) ≤ σ ∗ − 2 is similar. Let E 0 (Ti ) be the set of edges in SG(P ∗ ) corresponding to the set E(Ti ) of edges in G, where, for every edge e ∈ E(Ti ) ∩ E(P ∗ ), E 0 (Ti ) does not contain er ∈ E(Pr∗ ) but contains el ∈ E(Pl∗ ). Let Ti (P ∗ ) be a subgraph of SG(P ∗ ) induced by E 0 (Ti ). Then, Ti (P ∗ ) is not always a tree, but is a forest. Let T¯i (P ∗ ) be the subforest of Ti (P ∗ ) which consists of all trees in Ti (P ∗ ), each containing no terminal of net Ni . Path P ∗ is drawn by a straight gray line st in figures 15(a) and (b), tree Ti by solid lines in figure 15(a), and forest T¯i (P ∗ ) by dotted lines in figure 15(b). Let t j be a tree in T¯i (P ∗ ). Let a be the first vertex of t j on P ∗ from s to t, and let b be the last one. We replace t j in Ti by P ∗ [a, b], and let Ti [t j ] be the resulting tree. Then, w(Ti [t j ]) ≤ w(Ti ) since w(P ∗ [a, b]) ≤ w(t j [a, b]) ≤ w(t j ). Furthermore, Ti [t j ] connects all terminals of Ni since all leaves of t j ∈ T¯i (P ∗ ) lie on P ∗ [a, b]. Similarly, we replace all other trees of T¯i (P ∗ ) by subpaths of P ∗ as above, and let Ti0 be the resulting tree. In figure 15(b), Ti0 is drawn by solid lines. Then, w(Ti0 ) ≤ w(Ti ), and Ti0 is a homogenous tree 2 for Ni with τ (Ti0 ) = σ ∗ + 1. We are now ready to prove Lemma 5.

FINDING A NONCROSSING STEINER FOREST

Figure 15.

265

(a) Tree Ti with τ (Ti ) = σ ∗ + 2, and (b) tree Ti0 with τ (Ti0 ) = σ ∗ + 1.

Proof of Lemma 5 Let T = {T1 , T2 , . . . , Tk } be a noncrossing Steiner forest for N in G. Since |N I O | ≥ 2, by Lemma 7 all trees T1 , T2 , . . . , Tm for N I O are homogenous and have the same turning number, say σ . Let P ∗ be a shortest path from s to t, and let σ ∗ = τ (P ∗ ). We shall show that there exists a noncrossing forest T ∗ such that w(T ∗ ) ≤ w(T ) and T ∗ satisfies either (i), (ii), or (iii) in Lemma 5; T ∗ is of course a noncrossing Steiner forest since w(T ∗ ) ≤ w(T ). There are the following three cases to consider. Case 1: σ = σ ∗ . By Lemma 8, for each net Ni ∈ N I O , there exists a homogenous tree Ti0 for Ni such that τ (Ti0 ) = σ = σ ∗ , w(Ti0 ) ≤ w(Ti ) and Ti0 and P ∗ do not cross each other. By Lemma 9, for each net Ni ∈ NOUT ∪ NIN , there exists a tree Ti0 for Ni such that w(Ti0 ) ≤ w(Ti ) and Ti0 and P ∗ do not cross each other. Let T 0 be the set of all these trees Ti0 for nets Ni ∈ N = NOUT ∪ NIN ∪ N I O . Then, w(T 0 ) ≤ w(T ), but T 0 is not always a noncrossing forest, that is, some of the trees in T 0 may cross each other. On the other hand, by Lemma 6, there exists a noncrossing forest T 00 such that (a) P ∗ and all trees in T 00 do not cross each other; and (b) every tree Ti00 ∈ T 00 has the minimum weight among all trees that do not cross P ∗ . By (b) above, w(Ti00 ) ≤ w(Ti0 ) for every net Ni ∈ N and hence w(T 00 ) ≤ w(T 0 ) ≤ w(T ). Furthermore, by (a) above, T 00 satisfies (i) in Lemma 5. Thus, let T ∗ = T 00 , then T ∗ is a noncrossing Steiner forest satisfying (i) in Lemma 5. Case 2: σ ≥ σ ∗ + 1. By Lemma 10, for every net Ni ∈ N I O there exists a homogenous tree Ti0 for Ni such that w(Ti0 ) ≤ w(Ti ) and τ (Ti0 ) = σ ∗ + 1. Clearly P + is the shortest one among all paths from s to t with the turning number τ (Ti0 ) = σ ∗ +1. By Lemma 8, for every net Ni ∈ N I O there exists a homogenous tree Ti00 for Ni such that τ (Ti00 ) = τ (Ti0 ) = σ ∗ + 1, w(Ti00 ) ≤ w(Ti0 ), and Ti00 and P + do not cross each other. Furthermore, by Lemma 9,

266

KUSAKARI, MASUBUCHI AND NISHIZEKI

for every net Ni ∈ NOUT ∪ NIN , there exists a tree Ti00 for Ni such that w(Ti00 ) ≤ w(Ti ) and Ti00 and P + do not cross each other. Let T 00 be the set of all these trees Ti00 for nets Ni ∈ N = N I O ∪ NOUT ∪ NIN . Then, w(T 00 ) ≤ w(T ), but T 00 is not always a noncrossing forest, that is, some of the trees in T 00 may cross each other. On the other hand, by Lemma 6, there exists a noncrossing forest T 000 such that (a) P + and all trees in T 000 do not cross each other; and (b) every tree Ti000 ∈ T 000 has the minimum weight among all trees that do not cross P + . By (b) above, w(Ti000 ) ≤ w(Ti00 ) for every net Ni ∈ N , and hence w(T 000 ) ≤ w(T 00 ) ≤ w(T ). Furthermore, by (a) above, T 000 satisfies (ii) in Lemma 5. Thus, T ∗ = T 000 is a noncrossing Steiner forest satisfying (ii) in Lemma 5. Case 3: σ ≤ σ ∗ − 1. Similarly as in Case 2, one can prove that there exists a noncrossing 2 Steiner forest T ∗ satisfying (iii) in Lemma 5. References M. Bern, “Faster exact algorithm for Steiner trees in planar networks,” Networks, vol. 20, pp. 109–120, 1990. S.E. Dreyfus and R.A. Wagner, “The Steiner problem in graphs,” Networks, vol. 1, pp. 195–208, 1972. R.E. Erickson, C.L. Monma, and A.F. Veinott, “Send-and-split method for minimum-concave-cost network flows,” Math. Oper. Res., vol. 12, pp. 634–664, 1987. M.R. Garey and D.S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, Freeman: San Francisco, CA, 1979. M.R. Henzinger, P. Klein, S. Rao, M. Rauch, and S. Subramanian, “Faster shortestpath algorithms for planar graphs,” J. Comput. Syst. Sci., vol. 53, pp. 2–23, 1997. M.R. Kramer and J.V. Leeuwen, “Wire-routing is NP-complete,” Department of Computer Science, University of Utrecht, Utrecht, The Netherlands, RUU-CS-82-4, 1982. Y. Kusakari, D. Masubuchi, and T. Nishizeki, “Algorithms for finding noncrossing Steiner forests in plane graphs,” in Proc. ISAAC’ 99. Lect. Notes in Comput. Sci., Springer-Verlag, vol. 1741, pp. 337–346, 1999. T. Lengauer, Combinatorial Algorithms for Integrated Circuit Layout, John Wiley & Sons: Chichester, England, 1990. J.F. Lynch, “The equivalence of theorem proving and the interconnection problem,” ACM SIGDA Newsletter, vol. 5, no. 3, pp. 31–36, 1975. J. Takahashi, H. Suzuki, and T. Nishizeki, “Shortest noncrossing paths in plane graphs,” Algorithmica, vol. 16, pp. 339–357, 1996. M. Thorup, “Undirected single source shortest paths with positive integer weights in linear time,” J. ACM, vol. 46, no. 3, pp. 362–394, 1999. P. Winter, “Steiner problem in networks: A survey,” Networks, vol. 17, pp. 129–167, 1987.