Linear-Time Algorithms for Disjoint Two-Face Paths ...

1 downloads 0 Views 247KB Size Report
Abstract. In this paper we present a linear-time algorithm for the vertex-disjoint Two-Face Paths. Problem in planar graphs, i.e., the problem of nding k ...
berlin

Technische Universität Berlin

FACHBEREICH 3 MATHEMATIK

Linear-Time Algorithms for Disjoint Two-Face Paths Problems in Planar Graphs by Heike Ripphausen-Lipa

Dorothea Wagner

Karsten Weihe No. 357/1993

Linear-Time Algorithms for Disjoint Two-Face Paths Problems in Planar Graphs Heike Ripphausen-Lipa Dorothea Wagner Technische Universitat Berlin

Karsten Weihe

Abstract

In this paper we present a linear-time algorithm for the vertex-disjoint Two-Face Paths Problem in planar graphs, i.e., the problem of nding k vertex-disjoint paths between pairs of terminals which lie on two face boundaries. The algorithm is based on the idea of nding rightmost paths with a certain property in planar graphs. Using this method, a linear-time algorithm for nding vertex-disjoint paths of a certain homotopy is derived. Moreover, the algorithm is modi ed to solve the more general linkage problem in linear time as well.

1 Introduction The problem of nding disjoint Steiner trees or paths in planar graphs is a core problem in VLSI design. In this paper we consider a special version of the k-disjoint paths problem, i.e., the problem to determine k vertex-disjoint paths between k pairs of vertices. This problem is NP -hard, even for planar graphs [2]. If furthermore k is assumed to be xed, then the problem can be solved in linear time [3]. But in this case the order constant grows tremendously in k. The Two-Face Paths Problem considered in this paper is de ned as follows:

Problem 1.1 Let G = (V; E) be a planar graph and let F o, F i be two di erent faces. ti1 ; : : :; tik 2 V are pairwise di erent vertices incident to F i, and to1 ; : : :; tok 2 V pairwise di erent vertices incident to F o . The Two-Face Paths Problem is to connect the corresponding vertices tij and toj by pairwise vertex-disjoint paths.

Throughout the paper, we consider a xed embedding of G in the plane where F o is the outer face, and we call F i the inner face. The adjacency lists of vertices are ordered counter-clockwise with respect to the xed embedding. The vertices ti1; : : :; tik are called inner terminals, the vertices to1 ; : : :; tok outer terminals. We assume that ti1 ; : : :; tik resp. to1 ; : : :; tok appear in this order clockwise around the boundary of F i and F o , respectively. Upper indices i resp. o always indicate that the corresponding object is incident to the inner resp. outer face. The Two-Face Paths Problem is a special case of the vertex-disjoint Two-Face Steiner Trees Problem. This problem consists in nding vertex-disjoint Steiner trees in planar graphs. Again, the position of the terminals is restricted to two designated face boundaries. Suzuki, Akama, and Nishizeki have developed an algorithm for solving this problem in O(minfn logn; kng) running time in [6]. All parts of their algorithm have linear running time except a procedure for the Two-Face Paths Problem. However, they claim that they can solve the Two-Face Paths Problem in linear time if the Menger Problem can be solved in linear time. This research has been supported by the Technische Universitat Berlin under grant FIP 3/1. Part of this work has been published under the same title in the proceedings of the 4th International Symposium, ISAAC '93. Fachbereich Mathematik, Sekr. MA 6-1, Technische Universitat Berlin, Strae des 17. Juni 136, 10623 Berlin, Germany, e-mail: ripphaus@, wagner@, and [email protected]

1

Problem 1.2 Let G = (V; E) be a planar graph, and s; t 2 V; s 6= t. The Menger Problem is to nd as many pairwise vertex-disjoint (s; t)-paths in G as possible.

In [4] a linear-time algorithm is presented for the vertex-disjoint Menger Problem in planar graphs. Using this algorithm, we now develop a new algorithm for solving instances of the TwoFace Paths Problem in linear time. This algorithm is much easier than the algorithm of Suzuki et al., and is not dicult to implement. Furthermore, it can be used to solve the p-Homotopic Two-Face Paths Problem which is de ned as follows:

Problem 1.3 Let p be an arbitrary path in G between to1 and ti1 . The p-Homotopic Two-Face Paths Problem is the Two-Face Paths Problem with the additional condition that the path which connects to1 and ti1 is homotopic to p.

Moreover, the algorithm can easily be extended in order to solve a problem similar to the pHomotopic Paths Problem, the Linkage Problem. For the Linkage Problem the pairs of terminals to be connected are not xed. The algorithms for solving the Two-Face Paths Problem, the Homotopic Two-Face Paths Problem, and the Linkage Problem use two sets of paths S o and S i which can be determined by the Menger Algorithm of [4]. The path set S o consists of pairwise vertex-disjoint paths starting with outer terminals and ending with arbitrary vertices on the inner face boundary. The path set S i consists of pairwise vertex-disjoint paths starting with inner terminals and ending with arbitrary vertices on the outer face boundary. Paths starting with outer resp. inner terminals are denoted by outer resp. inner paths. The paths determined by the Menger Algorithm are in some sense rightmost. Therefore corresponding inner and outer paths have to intersect at least once if there exists a solution to an instance of the Two-Face Paths Problem. The main idea is to concatenate segments of an outer path with segments of the corresponding inner path in order to connect an outer terminal with the corresponding inner terminal. In Section 2 we rst brie y sketch the main ideas of the Menger Algorithm. We introduce the band model, which turns out to be very useful for formulating some properties of paths and for describing suitable intersection vertices for concatenating path segments. A binary relation more right on paths and sets of paths is de ned in Section 3 in order to characterize rightmost paths (as those determined by the Menger Algorithm). In Section 4, a sucient condition for the existence of a solution to an instance of the Two-Face Paths Problem is given. Algorithms for determining solutions to the Two-Face Paths Problem, the Homotopic Two-Face Paths Problem, and the Linkage Problem are developed in Section 5.

2 Preliminaries

2.1 The Menger Algorithm

The Menger Algorithm introduced in [4] consists of a loop over all edges which are incident to s. In every iteration the algorithm tries to extend the edge incident to s to a path from s to t. These paths are obtained by a right- rst search. This is a depth- rst search where in each step the edges which leave the current vertex are searched \from the right to the left". Let fv; wg be the last edge added to a path and w the last vertex of this path. Then the next edge in right- rst search order is the next edge after fv; wg in the adjacency list of w. For more details of the algorithm we refer to [4]. Obviously, the Menger Algorithm can be used to determine pairwise vertex-disjoint paths connecting the terminals ti1 ; : : :; tik incident to the inner face with arbitrary vertices incident to the outer face. For this purpose, a source vertex s in the interior of the inner face is added as well as edges from s to all terminals tij (1  j  k). Analogously, a target vertex t with edges to all vertices on the outer face boundary is added. Evidently, the Menger Algorithm yields k paths starting with ti1; : : :; tik when all edges incident to s and t are deleted. In the same way a second 2

set of paths which start with terminals on the outer boundary and end on the inner face boundary can be determined. For this purpose the algorithm starts with the outer terminals resp. the new vertex t incident to the outer terminals. Since we want to guarantee that inner paths intersect the corresponding outer paths, we just apply the \mirror-symmetric" algorithm where \right" is replaced by \left". In particular, a left- rst search is used instead of a right- rst search.

2.2 The Band Model

Properties of paths and suitable sets of intersection vertices for concatenating can be described easier if the graph and paths are translated into the so-called band model. Informally, the construction of the band model can be described as follows: A graph with two designated faces can be embedded on a cylinder such that the designated face boundaries lie on the boundaries of the cylinder. The band model is constructed by rolling o the cylinder in nitely often in the plane in both directions. More formally, choose an arbitrary simple path p = v1; : : :; vs starting with a vertex v1 incident to F i and ending with a vertex vs incident to F o . In the sequel, p is called the cutting path. Then a graph Gp is constructed by replacing every vertex vi (1  i  s) on p by two vertices vil and vir . In Gp edges to the right side of p in G are incident with vil and edges to the left side of p are incident with vir , if p is traversed from the inner to the outer boundary. Edges between vi and vi+1 (1  i < s) are incident with vil and vil+1 . In this construction the cyclic order of the remaining edges incident with vil resp. vir is maintained. Now we take an in nite number of copies of Gp . The j-th copy of Gp is denoted by Cj (Gp ). These copies are glued together by identifying vertices vir in Cj (Gp ) with vil in Cj +1(Gp ) (1  i  s). The resulting in nite graph is denoted by G . This construction is illustrated in Figure 1. p q

a)

b) Cr+1 (Gp )

Cr (Gp )

c)

Bu Bl

Cr (q)

Figure 1: a) The graph G, b) a copy of Gp , c) the band graph G corresponding to G We call G the band graph corresponding to G. Notice that G does not depend on the choice of the cutting path p . However, the graph Gp depends on the cutting path. Nevertheless we will often speak of copies Ci (G) without specifying a cutting path in order to distinguish between di erent copies of paths, terminals, and vertices. The boundary in G which corresponds to the outer resp. inner face boundary in G is denoted by upper boundary B u resp. lower boundary B l . A relation more right can be de ned in an obvious way on the vertices of the upper resp. lower boundary. We will even say that a vertex is more right 3

than another vertex if they are identical. This relation is denoted by \". Because of this notion we consider paths always as directed from the lower to the upper boundary. Otherwise, the right sides of paths would not coincide to the notion more right in the band model. Now we consider the translation of paths resp. sets of paths of G into G (with cutting path p ). The copy of vertex v in Cr (Gp ) is denoted by Cr (v). For paths we x one vertex as startvertex. This is either an endvertex of the path on the upper or on the lower boundary. In most cases the startvertex will be a terminal. We map the copy of a path to the copy of G where its startvertex lies. Let p be a path in G with startvertex t incident to one designated face and ending with a vertex incident to the other designated face. In every copy Cr (Gp ), there is a copy Cr (p) of p which starts with Cr (t). Let us assume that in G the path p crosses the cutting path in vertex v from the left to the right side. Then the path Cr (p) switches over from the current copy of Gp to the neighbouring copy of Gp to the right (cf. Figure 1). Notice that the path Cr (p) can end in a copy di erent from the copy it has started. Let us consider intersections between two paths p and q in G. In G these intersections are represented by intersections of copies of p and q. Similar as every path in G is represented by an in nite number of copies in G, every intersection between p and q is represented by an in nite number of intersections between pairs of copies of p and q. In order to nd a representative pair of copies of paths for every intersection of a path p with other paths, consider a xed copy of p, say Cr (p). Every intersection between p and q is represented by an intersection between Cr (p) and a copy of q. See Figure 2: the rst and fourth intersection of p with q, when traversing p from the inner to the outer boundary, are represented by the pair (Cr (p); Cs(q)) (s = r +1). The second and third intersection is represented by the pair (Cr (p); Cs+1(q)), since p surrounds the inner face once after the rst intersection. Every pair of copies (Cr (p); Cs(q)) can represent several intersections. The same intersections are also represented by pairs (Cr+l (p); Cs+l (q)), (l integer). In the sequel we will only say that a pair (Cr (p); Cs(q)) represents an intersection set, if we can conclude that the corresponding paths have to intersect because of the constellation of their endvertices (independent of their detailed course). That is, startvertex of Cr (p) is more right than startvertex of Cs (q), but endvertex of Cs(q) is more right than endvertex of Cr (p). p 4 1 2 3 4

q

1 Cr (p) Cr+1 (q)

p

3 2 Cr+2 (q)

Figure 2: Intersection represented by di erent pairs of copies of paths

3 Rightmost and Leftmost Paths First we will de ne and prove some properties of paths resp. sets of paths in G (the band graph), before we will turn our attention to paths resp. sets of paths in G. De nition 3.1 Let p and p0 be two paths in G with endvertices s resp. s0 on the lower boundary and t resp. t0 on the upper boundary. Path p0 is more right than p (p0  p) if and only if s0  s 4

and t0  t. Let P = fp1; : : :; pk g and P 0 = fp01; : : :; p0k g be two vertex-disjoint sets of paths in G where each path has one endvertex on the lower, and one on the upper boundary. P 0 is more right than the set of paths P (P 0  P ) if and only if p0j  pj for all j with 1  j  k.

See Figure 3 for an illustration of this notion.

r

p

q

Figure 3: q is more right than p. r is incomparable to p and to q. Notice, if p and p0 start and end with the same vertices, then p  p0 and p0  p. In this case p and p0 are homotopic, but not necessarily equal. That is, the relation \" on paths is a partial order on homotopy classes. In order to concatenate segments of pairs of paths which are incomparable we need the following de nition:

De nition 3.2 Let p and p0 be two simple paths in G between the lower and the upper boundary. The right [left] hull p00 of p and p0 is a concatenation of segments of p and p0 , such that p00 builds

a simple path between the lower and the upper boundary. Furthermore all segments of p and p0 lie to the left [right] side of p00 or on p00 .

Figure 4 illustrates this notion. With Lemma 3.3 we prove that such right resp. left hulls always exist. The algorithm for determining the right [left] hull of two paths p and p0 uses a right- rst search [left- rst search] strategy:

p p0

p00 (right hull)

Figure 4: Right hull of two paths

Right [Left] Hull Algorithm fLet p, p0 be two paths between B l and B u which start with s, s0 on B l g fw.l.o.g. s  s0 [s0  s]g s00 := s; p00 := s00; WHILE B u is not reached by p00 DO f let v be the last vertex of p00 g p00 := p00 [ fv; wg; f where fv; wg is the next edge in right[left]- rst order of p or p0 to the last edge of p00 in the adjacency list of v g

5

v

w

Figure 5: p00 enters itself from the left side Note that only in the case that v is a common vertex of p and p0 , there is more than one possibility for choosing the next edge for p00. If the algorithm should start on the upper boundary (this case occurs in Section 5), then a left[right]- rst order must be used instead of a right[left]- rst order. In the sequel we will denote a segment of a path p between vertices v and w by p(v; w). Lemma 3.3 The Right [Left] Hull Algorithm determines the right [left] hull of two simple paths p and p0 . Proof: We prove the claim only for the right hull. (The proof for the left hull is symmetric). Obviously, p00 is connected. As an immediate consequence of the proceeding of the algorithm, there cannot exist an edge of p resp. p0 incident to p00 on the right side of p00. Thus, we only have to verify that the concatenated segments build a simple path between the lower and the upper boundary. First we show that p00 is cycle-free. On contrary let us assume that there exists a cycle. Traverse 00 p until the rst time a vertex is traversed twice. Denote this vertex v. The corresponding cycle C on p00 is simple. Since p00 is constructed by a right- rst search strategy, it is only possible that p00 enters itself in v from the left side (cf. Figure 5). W.l.o.g. let the rst edge (v; w) of C which is traversed by p00 be an edge of p. Then C must contain at least one edge of p0 , since otherwise p itself would not be cycle-free. Both paths, p and p0 , have to enter and leave C through vertex v, since there is no edge of p and p0 leaving p00 to the right side. However, then both, p and p0, cannot be cycle-free. It remains to show that p00 actually ends with a vertex on the upper boundary. For this purpose we de ne an order on the vertices of the paths in dependence of the order in which they are traversed when starting the traversal on the lower boundary. Then it suces to prove that the order of vertices on p resp. p0 is preserved on p00. Let v1 precede v2 on p00, and w.l.o.g. let both be vertices of p. On contrary let us assume that v2 precedes v1 on p. Consider the segments p(s; v2 ) and p(v2 ; v1). Then p(s; v2 ) enters p00 in v2 from the left side, since there is no edge of p leaving p00 to the right side. Let (v2; u) be the edge of p(v2; v1 ) incident to v2 . Let (u00; v2 ) be the edge of p00(v1 ; v2) incident to v2 . Then either (v2 ; u) precedes (u00; v2) in the adjacency list of v2 starting with the last edge of p(s; v2 ), or (v2 ; u) lies on p00(v1 ; v2). Otherwise p could not reach v1 subsequent to v2 without a cycle, or an edge of p would lie to the right side of p00. Then a simple closed curve C can be constructed, such that (v2 ; u) lies inside or on this curve. C consists of segments of p(s; v2 ), p00(s00 ; v2), and possibly of segments of the lower boundary. The path p has to leave this closed curve in order to reach the upper boundary. This is only possible by intersecting segments of p of the closed curve, since there are no edges leaving p00 to the right side. However, this contradicts the fact that p is cycle-free. 2 00 0 00 00 0 Obviously, for the right hull p of two paths p and p yields: p  p and p  p . Lemma 3.4 Let P = fp1; : : :; pkg and P 0 = fp01; : : :; p0kg be two sets of vertex-disjoint simple paths in G connecting vertices t1 ; : : :; tk resp. t01; : : :; t0k incident with one boundary of G with some vertices incident with second boundary. Moreover, let tj  ti resp. t0j  t0i for j > i. 6

Let P 00 be the set of right [left] hulls of P and P 0, that is, P 00 = fp001 ; : : :; p00k g where p00j is the right [left] hull of pj and p0j . Then P 00 consists of pairwise vertex-disjoint paths and P 00  P and P 00  P 0 [P  P 00 and P 0  P 00].

Proof: The statement that P 00  P and P 00  P 0 [P  P 00 and P 0  P 00] is obvious because of the

construction of P 00. We prove the vertex-disjointness only for the set of right hulls since the proof for the left hull is symmetric to this proof. Assume that p00j touches p00i (j 6= i) in vertex v. W.l.o.g. we assume that v 2 pj \ p0i, and j > i. Let v1; v2 be common vertices of pj and p0j such that v lies on pj (v1; v2 ). In addition, assume there are no other common vertices between pj and p0j on pj (v1 ; v2). Analogously, let us de ne common vertices v3 ; v4 of pi and p0i . p0j (v1 ; v2) lies to the left side of (or on) p00j . Since p0j starts to the right side of p0i and pj (sj ; v) intersects p0i , the path p0j has to intersect p0i. However, this is a contradiction to the assumption that the paths of P 0 are vertex-disjoint. 2 Notice, that all de nitions and statements about nite path sets in G can be generalized to in nite path sets. However, this is not necessary since we will consider in the sequel only path sets of G which are translated to G . In this case the in nite set of paths in G is an in nite repetition of a nite set of paths in G. Then it suces to consider a nite part of the band. In this nite part we will construct a new set of k vertex-disjoint paths (concatenations of segments of two sets of paths). These paths start in the same copy of G in the band and they will be retranslated to the graph G. In the following de nition we will de ne a relation more right on paths in the graph G with the band model. Then again it suces to consider a set of copies of paths which start in the same copy of G.

De nition 3.5 Let P = fp1; : : :; pk g and P 0 = fp01; : : :; p0k g be two sets of vertex-disjoint paths, both starting with vertices t1 ; : : :; tk incident with F d ; d 2 fi; og. Let p be an arbitrary cutting path, and Cr (P) and Cr (P 0 ) be copies of P and P 0 which start in the same copy Cr (Gp ) of G . Then P 0 is more right than P if and only if Cr (P 0) is more right than Cr (P). Notice, that the relation more right on sets of paths in G is independent of the cutting path.

Theorem 3.6 There exists (at least) one path set Pr in G consisting of vertex-disjoint paths starting with t1; : : :; tk on F d, d 2 fi; og, which is more right than all other vertex-disjoint path sets P in G starting with the same vertices. Proof: We show that for every two path sets P and P 0 in G, with startvertices t1 ; : : :; tk on F d , d 2 fi; og, there exists a vertex-disjoint path set P 00 in G with P 00  P and P 00  P 0. For this purpose, the paths of G are translated into G . Then Lemma 3.4 is applied to all pairs of paths (Cr (pj ); Cr (p0j )) (1  j  k) which start in copy Cr (G) (for an arbitrary r). Since the resulting

paths Cr (p00j ) are pairwise vertex-disjoint in G , the corresponding paths in G are vertex-disjoint. Obviously, the set of vertex-disjoint path sets in G is nite since G is nite. Hence, there exists a vertex-disjoint path set Pr which is more right than all other path sets. 2 In the sequel, S i and S o are the sets of paths determined by the Menger Algorithm starting with i t1 ; : : :; tik resp. the mirror symmetric Menger Algorithm starting with to1 ; : : :; tok . Now the useful properties of the path sets S o and S i can be formulated more precisely:

Lemma 3.7 The path set S i is more right than all other path sets in G starting with ti1; : : :; tik, and the path set S o is more right than all other path sets in G starting with to1 ; : : :; tok .

This has been proved in the appendix of [4].

7

4 Characterization of Solvable Instances In this section we characterize solvable instances of the Two-Face Paths Problem.

De nition 4.1 Let P o = fpo1; : : :; pok g and P i = fpi1; : : :; pik g be two sets of paths starting with to1 ; : : :; tok and ti1; : : :; tik , respectively. Let p be a simple path between to1 and ti1. The path sets P o and P i ful ll the rightness property w.r.t. p, if the following holds: Let G be the band graph corresponding to G with cutting path p. Then for every pair (Cr (poj ); Cr (pij )) (1  j  k) in G , the path Cr (poj ) ends to the right of (or on) Cr (tij ), and Cr (pij ) ends to the right of (or on) Cr (toj ).

Theorem 4.2 An instance of the Two-Face Paths Problem is solvable if and only if there exist two sets of vertex-disjoint paths P o = fpo1; : : :; pokg starting with to1; : : :; tok , P i = fpi1; : : :; pikg starting

with ti1 ; : : :; tik , and a simple path p between ti1 and to1 such that P o and P i ful ll the rightness property w.r.t. p.

Proof: First, assume that a solution S = fp1; : : :; pkg to the Two-Face Paths Problem exists.

Obviously, P o := S and P i := S ful ll the rightness property w.r.t. p. For proving the converse direction, consider path sets P o and P i which ful ll the rightness property w.r.t. some path p. Because of the Jordan Curve Theorem every path pij intersects the corresponding path poj at least once. In order to connect corresponding terminals, we concatenate alternating segments of poj and pij between a sequence of intersection vertices. For nding such a suitable sequence, we translate the path sets P o and P i into G (with respect to cutting path p). The pairs (Cr (poj ); Cr (pij )) (1  j  k) starting in an arbitrary copy Cr (Gp ) ful ll the assumption of Lemma 3.4. Because of the rightness property of the path sets P o and P i, the pair (Cr (poj ); Cr (pij )) does not only represent a set of intersections, but also the left hull of this pair connects Cr (toj ) with Cr (tij ). This means that there exist vertex-disjoint paths between Cr (toj ) and Cr (tij ) in G (1  j  k). Hence, there are vertex-disjoint paths between toj and tij in G which consist of segments of P o and P i. 2 If there exist two path sets which ful ll the rightness property w.r.t. p, the path sets S o and i S ful ll the rightness property as well, since they are rightmost. This means, these sets of paths are our candidates for solving the Two-Face Paths Problem. Notice, that Theorem 4.2 indeed gives a sucient condition for the existence of a solution to the Two-Face Paths Problem. However, in general we do not know a suitable cutting path p in advance.

5 The Algorithms Before describing the algorithm for solving instances of the Two-Face Paths Problem, we restrict our attention to the problem of nding paths of a certain homotopy. Solving this problem is in some sense easier. Let I1 ; : : :; Ip be some forbidden faces in a planar graph, and p1 ; p2 two paths with the same endvertices. p1 is homotopic to p2, if p1 can be moved continuously to p2 without moving the endvertices and without crossing the forbidden faces. For a formal de nition of the notion homotopy, we refer to [5]. Now, we consider an embedding of G in the plane, where the outer face F o and the inner face F i are the forbidden faces. Paths in G can be interpreted as curves in the plane. Obviously, in the p-Homotopic Two-Face Paths Problem the homotopy of one path in the solution determines the homotopy of all other paths. A characterization for the existence of a solution to the p-Homotopic Two-Face Paths Problem can easily be given:

Lemma 5.1 An instance of the p-Homotopic Two-Face Paths Problem is solvable if and only if there exist two sets of vertex-disjoint paths P o = fpo1 ; : : :; pokg and P i = fpi1 ; : : :; pik g starting with to1 ; : : :; tok resp. ti1; : : :; tik which ful ll the rightness property w.r.t. p. 8

Proof: Again the necessity of the rightness property w.r.t. p is trivial.

Now let us assume that path sets P o and P i exist which ful ll the rightness property w.r.t. the path p. Then Theorem 4.2 implies that a solution to the Two-Face Paths Problem exists. For the p-Homotopic Two-Face Paths Problem just consider paths in G , where p is used as cutting path. Then the left hulls pj of the pairs (Cr (poj ); Cr (pij )) connect toj and tij (1  j  k). Obviously, the corresponding path p1 in G is homotopic to p. 2 i o If the path sets S and S determined by the Menger Algorithm of [4] do not ful ll the rightness property w.r.t. p, then there exists no solution to the instance of the p-Homotopic Two-Face Paths Problem. Notice, if p would be a path of the solution, then the algorithm can be reduced to the One-Face Paths Problem, which can easily be solved in linear time [6]. Lemma 5.2 A solvable instance of the p-Homotopic Two-Face Paths Problem can be solved in linear time.

Proof: Let us assume that P o and P i ful ll the rightness property w.r.t. p. Such path sets can

be determined in linear time by the Menger Algorithm of [4]. The proof of Lemma 5.1 shows that suitable intersection vertices for concatenating paths are represented by pairs (Cr (poj ); Cr (pij )) in G (with cutting path p). In G, these intersection vertices correspond to intersection vertices v with the following property: For these vertices v, the number of times poj (toj ; v) and pij (tij ; v) surround the inner face in relation to p is equal. In order to determine these intersection vertices, we assign a label to each vertex on paths poj resp. pij . This label gives the number of surroundings resp. the copy in which this vertex is located in relation to p. To determine these labels, the di erence of intersections between pij (tij ; v) (resp. poj (toj ; v)) and p from the left to the right, and from the right to the left is counted. These preprocessing steps can be done in linear time. Then the left hulls which correspond to the pairs (Cr (poj ); Cr (pij )) are determined. The correct intersection vertices for concatenating (as described in the Right [Left] Hull Algorithm) are just the intersection vertices with the same label. For this purpose every path of P o and P i is traversed at most once. That is, the algorithm has linear running time. 2 If an instance of the p-Homotopic Two-Face Paths Problem is unsolvable, this can be recognized as follows: Take the path sets S o and S i . Concatenate segments of these paths as described in the proof of Lemma 5.2. If there is a left hull which does not end with the correct terminal, then the instance is unsolvable. Now, we consider the case that no path p is given in order to construct a solution to the TwoFace Paths Problem. We have already shown with Lemma 3.7 that there are rightmost and leftmost sets of paths among all sets of paths starting with xed vertices on one face boundary, and ending with arbitrary vertices on the second face boundary. Analogously, there are rightmost and leftmost solutions to instances of the Two-Face Paths Problem. These are rightmost resp. leftmost sets of paths where every path starts with an inner and ends with its corresponding outer terminal. Lemma 5.3 A rightmost [leftmost] solution to a solvable instance of the Two-Face Paths Problem can be determined in linear time.

Proof: First, rightmost solutions are constructed. Again, we concatenate segments of paths from S o = fpo1; : : :; pok g and S i = fpi1 ; : : :; pik g, the path sets which have been determined by the Menger Algorithm of [4]. Let us rst consider these paths in the band graph G corresponding to G. We will determine pairs (Cr (poj ); Cs(pij )) in G such that the left hulls of these pairs induce vertex-disjoint paths between corresponding terminals in G. W.l.o.g. we assume that the cutting path of G is the path p1 of a solution to an instance of the Two-Face Paths Problem. This assumption simpli es the proof, but actually we do not need this cutting path. The path pij is obviously more right than the path pj of a rightmost solution to an instance of the Two-Face Paths Problem. Consider a path Cs (pij ) which starts in an arbitrary copy Cs(Gp1 ). 9

Take a pair (Cr (poj ); Cs(pij )) which represents a set of intersections between poj and pij such that r is as large as possible. Then the left hull corresponding to the pair (Cr (poj ); Cs(pij )) is taken in order to connect tij with toj . Obviously, a path in a rightmost solution cannot be more right than this left hull. Such a pair is easier to determine if the paths are traversed in the opposite direction: Consider a path Cr (poj ). Take a pair (Cr (poj ); Cs(pij )) which represents a set of intersections between poj and pij such that s is as small as possible. That is, Cs(pij ) is the copy of pij which ends next to the right of Cr (toj ). However, if we would apply this procedure to all pairs of outer and inner paths, the resulting left hulls are not necessarily vertex-disjoint. The endvertex of Cs(pij ) on the upper boundary is denoted by Cs (eoj ). Notice, here we deviate from our general notation, since we do not know in which copy the path Cs (pij ) ends. Claim 1: Let (Cr (poj); Cs(pij )) and (Cr0 (pol ); Cs0 (pil)) represent intersection sets for connecting the corresponding inner and outer terminals such that Cs(eoj )  Cr (toj ) and Cs0 (eol )  Cr0 (tol ). W.l.o.g. assume that Cr0 (tol )  Cr (toj ). The left hulls of these pairs are vertex-disjoint paths in G if and only if Cs0 (eol )  Cs(eoj ). Proof of claim 1: One direction coincides to Lemma 3.4. For the converse direction, let us assume Cs (eoj )  Cs0 (eol )  Cr0 (tol )  Cr (toj ). Let v be the rst intersection vertex of Cr (poj ) with Cs(pij ) when traversing Cr (poj ) from the upper to the lower boundary. Then a closed curve consisting of Cr (poj (toj ; v)) and Cs(pij (eoj ; v)) and of the segment of the upper boundary between Cr (toj ) and Cs (eoj ) can be built. The path Cs0 (pil ) has to leave this curve in order to reach the lower boundary. Thus, Cs0 (pil ) has to intersect Cr (poj (toj ; v)) at least once. The segment Cr (poj (toj ; v)) is a segment of the left hull of the pair (Cr (poj ); Cs(pij )). All intersection vertices between Cs0 (pil ) and Cr (poj (toj ; v)) lie on the left hull of the pair (Cr0 (pol ); Cs0 (pil )), since otherwise Cr (poj (toj ; v)) and Cr0 (pol ) would not be vertex-disjoint. But then the left hulls of the two pairs of paths are not vertex-disjoint. 2 o o o o That is, if Cs (ej )  Cs0 (el )  Cr0 (tl )  Cr (tj ) then the left hulls of the two pairs are not vertexdisjoint. Therefore we call this constellation of terminals and endvertices forbidden constellation. Obviously, there cannot exist a third pair of copies of paths (Cr00 (pom ); Cs00 (pom )) with Cr00 (tom ) and Cs00 (eom ) lie in this order between Cr0 (tol ) and Cs0 (eol ). This would lead to a contradiction to the vertex-disjointness of the path sets. Claim 2: Let (Cr (poj); Cs(pij )) and (Cr0 (pol ); Cs0 (pil )) be two pairs of paths such that Cs(pij ) resp. Cs0 (pil ) are copies of pij resp. pil which end immediately to the right of Cr (toj ) resp. Cr0 (tol ). Assume that Cs(eoj )  Cs0 (eol )  Cr0 (tol )  Cr (toj ). Then the pair (Cr0 (pol ); Cs0+1 (pil)) represents a set of intersection.

Proof of claim 2: The path Cs0 (pil) cannot be a copy of pil which starts in Cr (Gp1 ), since the order of outer terminals and endvertices of corresponding pairs of paths has to be the same and therefore Cr (eol )  Cr (eoj )  Cr (toj ). That is, Cs0 (pil ) is a path starting in a copy to the left of

Cr (Gp1 ). Because of the rightness property, we can conclude that (Cr0 (pol ); Cr0 (pil)) represents a set of intersections. Thus, the pair (Cr0 (pol ); Cs0+1 (pil )) likewise represents an intersection set with 2 Cs0 +1 (eol )  Cs (eoj )  Cr0 (tol )  Cr (toj ). This means, in the case of forbidden constellations there exist suitable pairs of paths representing intersection sets such that the left hulls of these pairs of paths are vertex-disjoint. In order to determine all k pairs whose left hulls are vertex-disjoint, we consider the copies of all outer paths which start in the same copy, say Cr (Gp1 ). W.l.o.g. assume that there exists a forbidden constellation, as described above with j = 1. Procedure Intersection Sets; Cs1 (pi1 ) := Cs(pi1 ); FOR m := 2 TO k DO Csm (pim ) := the copy of pim which lies immediately to the right of Cs(pi1 ); f (Cr (poj ); Csj (pij )) represent sets of intersections g 10

That is, the copy Cs(pi1 ) and the next k ? 1 copies of inner paths immediately to the right of Cs (pi1) and all copies of outer paths in Cr (Gp1 ) are taken. Claim 3: The pairs (Cr (poj ); Csj (pij )) (1  j  k) determined by Procedure Intersection Sets

represent sets of intersections such that the corresponding left hulls are pairwise vertex-disjoint.

Proof of claim 3: The vertex-disjointness follows immediately, since the assumptions of Lemma 3.4

are ful lled. Thus, it remains to prove that the left hulls represent intersections. The algorithm always chooses the next copy of an inner path ending to the right of the corresponding outer path. The only exception is the case of forbidden constellations. In this case, the second inner path to the right is taken. Because of claim 2, the corresponding pair has to represent a set of intersections. 2 We now complete the proof of Lemma 5.3. Because of the construction, the set of left hulls of these pairs is a rightmost solution to the Two-Face Paths Problem. It remains to determine these suitable sets of intersection vertices represented by (Cr (poj ); Csj (pij )) in G, instead of G . A forbidden constellation can be recognized during a clockwise traversal of the outer boundary. The vertices tol and eol lie in this order between toj and eoj . In a second scan of the outer boundary the set of intersections which are suitable for concatenating paths for all pairs of paths pom and pim can be determined. This is either the rst, or the second possible intersection set represented by pairs of copies of paths, when traversing the outer paths from the outer to the inner boundary. A suitable initialization for counting intersections of corresponding paths from the left to the right, and vice versa, again allows to determine the left hulls. The intersection counter for paths where the second intersection set must be taken is initialized with ?1 instead of 0. (For this purpose the determination of the left hulls starts on the outer boundary.) The correct vertices for concatenating are those vertices where the intersection counter has value 1. In order to obtain a leftmost solution, the rst or second possible intersection set for determining the left hull is taken, when inner paths are traversed from the inner to the outer boundary. This problem can be handled symmetric to the rst problem. 2 If there is no solution, then Theorem 4.2 induces, that there exists no path p such that S o and i S ful ll the rightness property w.r.t. p. The algorithm recognizes this situation if at least one path does not end with the correct terminal. In the sequel, we call a leftmost solution to an instance of the Two-Face Paths Problem a solution of homotopy class 0. A solution which surrounds the inner face boundary s-times more than the leftmost solution, is called solution of homotopy class s. The procedure of determining the rightmost solution shows: In order to determine the second rightmost solution (if exists), instead of the pairs (Cr (poj ); Csj (pij )) of the rightmost solution the pairs (Cr (poj ); Csj +1 (pij )) must be taken. Thus we can conclude:

Corollary 5.4 All homotopy classes between the rightmost and the leftmost solution to an instance of the Two-Face Paths Problem exist. Corollary 5.5 The number of di erent homotopy classes can be determined in linear time. Proof: For this purpose, we just have to count the di erence of the number of intersections between

the rightmost and leftmost solution from the left to the right and from the right to the left. 2 Corollary 5.4 has been shown in \Graph minors, VI" by Robertson and Seymour [5] as well. Precisely, they have considered a more general problem: the Linkage Problem.

Problem 5.6 Let G = (V; E) be a planar graph, and F o; F i be two di erent faces. ti1 ; : : :; tik 2 V are pairwise di erent vertices incident to F i, and to1 ; : : :; tok 2 V pairwise di erent vertices incident to F o . The Linkage Problem consists in nding k vertex-disjoint paths between outer and inner

terminals of a certain type.

11

A set of vertex-disjoint paths which connects arbitrary terminals is called a linkage. For a formal de nition of the notion type, we refer to [1]. The type of a linkage determines which terminals have to be connected and furthermore the homotopy of these connections. Robertson and Seymour give a characterization for the existence of such linkages. The resulting algorithm for determining linkages of a given type or the extreme linkages has polynomial running time, but is not linear (they do not determine the time complexity explicitly). An improvement of the proofs and an extension of the results to directed graphs has been developed by Frank in [1]. In order to nd a linkage of a type l, in the algorithm of Robertson and Seymour rst a linkage of an arbitrary type is constructed. Then successively a linkage of the next higher resp. next lower type is constructed in order to obtain a linkage of type l. In the same way the extreme linkages can be found. Using our methods we can prove:

Lemma 5.7 A linkage of type l can be determined in linear time if one path p is given which determines the type. The extreme linkages can be found in linear time. Proof: Finding a linkage of a given type is equivalent to nding an appropriate assignment between inner and outer terminals, and solving the p-Homotopic Two-Face Paths Problem. The method for determining the extreme solutions to the Two-Face Paths Problem must be modi ed a little bit, in order to obtain the extreme linkages. Consider outer terminals and endvertices of inner paths on the outer boundary. Every endvertex has to be assigned to an outer terminal, such that no forbidden constellation occurs. This can be solved by scanning the outer boundary counter-clockwise at most twice. A suitable startvertex v0 for scanning the outer boundary must be found which ful lls the following condition: When the outer boundary is scanned starting with v0 , then the number of visited endvertices of inner paths is always greater or equal than the number of visited outer terminals. Then in a rst-in rst-out manner, we map endvertices to outer terminals, that is, inner paths to outer paths. This assignment ensures that the assumptions of Lemma 3.4 are ful lled. 2 Acknowledgement The authors thank Lex Schrijver for many useful comments.

References [1] A. Frank. On disjoint homotopic paths in the plane. DIMACS Ser. in Discrete Mathematics and Theoretical Computer Science, 1:163 { 170, 1990. [2] J.F. Lynch. The equivalence of theorem proving and the interconnection problem. ACM SIGDA Newsletter, 5:31{65, 1975. [3] B. Reed, N. Robertson, A. Schrijver, and P.D. Seymour. Finding disjoint trees in graphs on surfaces. Preprint, 1993. [4] H. Ripphausen-Lipa, D. Wagner, and K. Weihe. The vertex-disjoint menger problem in planar graphs. Technical Report 324, Technische Universitat Berlin, 1992. (Extended abstract in: Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '93, 112 { 119, 1993.). [5] N. Robertson and P.D. Seymour. Graph minors VI, disjoint paths across a disc. J. Combin. Theory Ser. B, 41:115{138, 1986. [6] H. Suzuki, T. Akama, and T. Nishizeki. Finding Steiner forests in planar graphs. In Proceedings of the 1st Annual ACM-SIAM Symposium on Discrete Algorithms, SODA'90, pages 444{453, 1990. 12

Reports from the group

\Algorithmic Discrete Mathematics" of the Department of Mathematics, TU Berlin

373/1994 Andreas S. Schulz: A Note on the Permutahedron of Series{Parallel Posets 368/1993 Stefan Felsner, Rudolf Muller, Lorenz Wernisch: Optimal Algorithms for Trapezoid Graphs

367/1993 Dorothea Wagner: Simple Algorithms for Steiner Trees and Paths Packing Problems in

Planar Graphs, erscheint in \Special Issue on Disjoint Paths" (eds. B. Gerards, A. Schrijver) in CWI Quarterly 365/1993 Rolf H. Mohring: Triangulating Graphs without Asteroidal Triples 359/1993 Karsten Weihe: Multicommodity Flows in Even, Planar Networks 358/1993 Karsten Weihe: Non-Crossing Path Packings in Planar Graphs with Applications 357/1993 Heike Ripphausen-Lipa, Dorothea Wagner, Karsten Weihe: Linear-Time Algorithms for Disjoint Two-Face Paths Problems in Planar Graphs 354/1993 Dorothea Wagner, Karsten Weihe: CRoP: A Library of Algorithms for the Channel Routing Problem 351/1993 Jens Gustedt: Finiteness Theorems for Graphs and Posets Obtained by Compositions 350/1993 Jens Gustedt, Angelika Steger: Testing Hereditary Properties Eciently 349/1993 Stefan Felsner: 3-Interval Irreducible Partially Ordered Sets 348/1993 Stefan Felsner, Lorenz Wernisch: Maximum k-Chains in Planar Point Sets: Combinatorial Structure and Algorithms 345/1993 Paul Molitor, Uwe Sparmann, Dorothea Wagner: Two-Layer Wiring with Pin Preassignments 344/1992 Dorothea Wagner, Karsten Weihe: A Linear Time Algorithm for Multicommodity Flow in Planar Graphs 343/1992 Dorothea Wagner, Frank Wagner: Modeling Hypergraphs by Graphs with the same Mincut Properties 341/1992 Klaus Jansen, Petra Scheer, Gerhard Woeginger: The Disjoint Cliques Problem 337/1992 Rudolf Muller: On the Transitive Acyclic Subdigraph Polytope 336/1992 Michel Habib, Rolf H. Mohring: Treewidth of cocomparability graphs and a new ordertheoretic parameter 333/1992 Dirk Moller, Rudolf Muller: A Concept for the Representation of Data and Algorithms 324/1992 Heike Ripphausen-Lipa, Dorothea Wagner, Karsten Weihe: The Vertex-Disjoint Menger Problem in Planar Graphs 323/1992 Rolf H. Mohring, Dorothea Wagner, Frank Wagner: VLSI Network Design 322/1992 Jens Gustedt, Michel Morvan: N-free Orders and Minimal Interval Extensions

320/1992 Michel Habib, David Kelly, Rolf H. Mohring: Comparability Invariance of Geometric Notions of Order Dimension

319/1992 Klaus Jansen, Petra Scheer: Generalized coloring for tree-like graphs 318/1992 Dorothea Wagner: Optimal Routing Through Dense Channels 317/1992 Majid Sarrafzadeh, Dorothea Wagner, Frank Wagner, Karsten Weihe: Wiring Knock-

Knee Layouts: A Global Approach 309/1991 Stefan Felsner: Tolerance Graphs and Orders 308/1991 Stefan Felsner, William T. Trotter: Colorings of Diagrams of Interval Orders and Sequences of Sets 307/1991 Dorothea Wagner, Frank Wagner: Between Min Cut and Graph Bisection 295/1991 Stefan Felsner, Dorothea Wagner: On the Complexity of Partial Order Properties 291/1991 Stefan Felsner, Jens Gustedt, Michel Morvan, Jean-Xavier Rampon: Constructing Colorings for Diagrams 290/1991 Jens Gustedt: Well Quasi Ordering Finite Posets and Formal Languages 285/1991 Stefan Felsner, Michel Habib, Rolf H. Mohring: On the Interplay between Interval Dimension and Dimension 279/1991 Dorothea Wagner: A New Approach to Knock-Knee Channel Routing 276/1991 Christoph Meinel, Stephan Waack: Separating complexitiy classes related to bounded alternating !-branching programs 275/1991 Stefan Felsner: Bounds for the Jump Number of Partially Ordered Sets Reports may be requested from:

D. Wagner Fachbereich Mathematik, MA 6{1 TU Berlin Strae des 17. Juni 136 D-10623 Berlin e-mail: [email protected]

Suggest Documents