FINDING DOUBLE EULER TRAILS OF PLANAR GRAPHS ... - CiteSeerX

1 downloads 0 Views 351KB Size Report
The question asks whether a polynomial-time algorithm can decide if a given .... a DET. A double-trail cover (DTC) Q of G is a set of edge-disjoint double trails in.
SIAM J. COMPUT. Vol. 31, No. 4, pp. 1255–1285

c 2002 Society for Industrial and Applied Mathematics

FINDING DOUBLE EULER TRAILS OF PLANAR GRAPHS IN LINEAR TIME∗ ZHI-ZHONG CHEN† , XIN HE‡ , AND CHUN-HSI HUANG§ Abstract. This paper answers an open question in the design of complimentary metal-oxide semiconductor VLSI circuits. The question asks whether a polynomial-time algorithm can decide if a given planar graph has a plane embedding E such that E has an Euler trail P = e1 e2 . . . em and its dual graph has an Euler trail P ∗ = e∗1 e∗2 . . . e∗m , where e∗i is the dual edge of ei for i = 1, 2, . . . , m. This paper answers this question in the affirmative by presenting a linear-time algorithm. Key words. planar graph, dual graph, Euler trail AMS subject classifications. 05C45, 05C85, 05C90, 68Q35, 68R10 PII. S0097539799354321

1. Introduction. Throughout this paper, a graph may have multiple edges but never has loops. A graph G is planar if it can be drawn on the plane so that the edges intersect only at their end vertices. Such a drawing is called an embedding of G. A plane graph is a planar graph with a fixed embedding. A two-terminal graph 1 (TTG) G = (V, E) is a plane graph with a pair (s, t) of specified vertices on the outer face such that adding the edge {s, t} to G yields a biconnected plane graph [4, 6]. We call s the source of G and t the sink of G. We also call s and t the poles of G and the other vertices the nonpoles of G. As in previous studies, we visualize G in such a way that s is at the South Pole while t is at the North Pole. The poles of G divide the boundary of the outer face into two paths, which are called the west side and the east side of G, respectively. In the dual graph G∗ = (V ∗ , E ∗ ) of G, there are two dual vertices s∗ and t∗ corresponding to the outer face of G. The dual edges incident to s∗ (respectively, t∗ ) in G∗ correspond to the edges on the west (respectively, east) side of G. Figure 1.1(2) shows a TTG G and its dual G∗ . G∗ is a TTG with source s∗ and sink t∗ [12]. In complimentary metal-oxide semiconductor (CMOS) technology, the basic layout of a circuit C of transistors on a VLSI chip uses two rows of transistors: A row of pMOS transistors is laid out next to a row of nMOS transistors [13]. The circuit C can be represented by a pair of TTGs: The p-transistors are represented by G, where each edge of G represents a p-transistor. The n-transistors are represented by the dual graph G∗ of G, where each edge of G∗ represents an n-transistor. In Figure 1.1, ¯ and (1) shows a circuit implementing the Boolean function z = e¯ ∧ (¯ a ∨ ¯b) ∧ (¯ c ∨ d), (2) shows the corresponding TTGs G and G∗ . ∗ Received by the editors April 2, 1999; accepted for publication (in revised form) December 4, 2001; published electronically May 8, 2002. A preliminary version of this work was presented at the 40th Annual Symposium on Foundations of Computer Science, 1999, New York City, New York. http://www.siam.org/journals/sicomp/31-4/35432.html † Department of Mathematical Sciences, Tokyo Denki University, Hatoyama, Saitama 350-0394, Japan ([email protected]). ‡ Department of Computer Science and Engineering, State University of New York at Buffalo, Buffalo, NY 14260 ([email protected]). This author’s research was supported in part by NSF grant CCR-9912418. § Department of Computer Science and Engineering, University of Connecticut, Storrs, CT 06269 ([email protected]). 1 Previously called planar st-graphs and treated as digraphs just for convenience.

1255

1256

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG VDD e

e

a c

b

G a

b

d

c

d

e

e

b

d

d Polysilicon

p G*

c

c

b

VDD

z a

a

e*

a*

z b*

Metal

n

d*

c*

Diffusion

GND

Contact

GND (1)

(2)

(3)

¯ (2) The corresponding TTGs c ∨ d). Fig. 1.1. (1) A circuit C implementing z = e¯ ∧ (¯ a ∨ ¯b) ∧ (¯ G and G∗ . (3) A layout of C.

1.1. Double Euler trails and optimal layouts. A trail P in G is a sequence e1 e2 . . . ek of distinct and oriented edges of G such that, for each i ∈ {1, . . . , k − 1}, the ending vertex of ei and the starting vertex of ei+1 are the same. Possibly, P has repeated vertices. An Euler trail is a trail that visits each edge of G exactly once. For each edge e of G, let e∗ be the dual edge of e in G∗ . If the sequence P ∗ = e∗1 e∗2 . . . e∗k is also a trail in G∗ , we call P a double trail 2 in G and call P ∗ the dual trail of P . If P is a double trail and traverses every edge of G exactly once, we call P a double Euler trail (DET) in G. For each edge e in G, the p-transistor represented by e has the same input as the n-transistor represented by e∗ ; hence, in the layout, the two transistors are required to be laid out vertically aligned (to facilitate input line connection) [13]. Transistors which are physically adjacent and have common diffusion regions may be collapsed. Otherwise, a vertical gap must be inserted between the diffusion region of the two transistors. Two transistors corresponding to two consecutive edges on a double trail can be laid out physically adjacent without vertical gap [13]. Figure 1.1(3) shows a layout of C using this approach. Note that the sequence eab is a double trail of G. So, in the layout, no vertical gaps are needed between the transistors e, a, b. This is also true for transistors c, d because of the double trail cd. However, since the edges b and c are incident in G but not in G∗ , there is a vertical gap between the transistors b and c in the layout. In Figure 1.2, (1) shows a logically equivalent circuit and (2) shows the corresponding TTGs G and G∗ . Since abecd is a DET of G, the transistors can be laid out in this order with no vertical gap, as seen in Figure 1.2(3). 1.2. Problem definitions. The circuits in Figures 1.1(1) and 1.2(1) are logically equivalent. Thus, the TTGs G in Figures 1.1(2) and 1.2(2) should be viewed as different embeddings of each other. That is, to obtain a different embedding of a TTG, we may not only horizontally flip blocks of the TTG as one does traditionally but also vertically flip blocks of the TTG. We postpone the precise definition of “different embeddings” until the end of section 2. For convenience, we regard G as a different embedding of itself. 2 Previously

G∗ .

called “dual trail.” We reserve the term “dual trail” exclusively to refer to a trail in

1257

DOUBLE EULER TRAILS OF PLANAR GRAPHS VDD a a

b

G

b e

a

e

e

c

d

Polysilicon VDD

d

c c

b

Diffusion

p

d

Metal

z G* a b

e

z

b*

a*

c

e*

n

d

Contact

GND

d*

c* GND (1)

(2)

(3)

Fig. 1.2. (1) A circuit C logically equivalent to the circuit in Figure 1.1(1). (2) The corresponding TTGs G and G∗ . (3) A layout of C using the DET abecd.

As seen from Figures 1.1 and 1.2, even if G has no DET, a different embedding of G may have one. A valid embedding of G is a different embedding of G that has a DET. A double-trail cover (DTC) Q of G is a set of edge-disjoint double trails in G such that each edge of G appears in a trail in Q. The size of Q is the number of double trails in it. Q is a minimum DTC of G if the size of Q is minimized over all DTCs of G. A different embedding of G with a minimum DTC leads to a layout with the minimum number of vertical gaps (hence the minimum chip area). We are interested in the following problems: DET-F problem. Given a TTG G, decide whether G has a DET. DET-V problem. Given a TTG G, decide whether G has a valid embedding. DTC-F problem. Given a TTG G, find a minimum DTC of G. DTC-V problem. Given a TTG G, find a different embedding G of G and a minimum DTC Q of G such that the size of Q is minimized over all different embeddings of G. 1.3. Previous work and our result. The layout method described above was first introduced by Uehara and VanCleemput [13]. Most previous studies in this area are concerned with series-parallel (SP) graphs, a much restricted subclass of TTGs. This is partially because the problems above for general TTGs are more difficult to solve. A heuristic algorithm for solving the DTC-V problem for SP graphs was given in [13]. Lengauer and M¨ uller [7] developed linear-time algorithms for finding a minimum trail cover (not DTC) for SP graphs. Nair, Buss, and Reif [10] presented polynomial-time algorithms for solving the DTC-F problem and the DTC-V problem both for a restricted class of embedded SP graphs. Maziasz and Hayes [8, 9] gave a linear-time algorithm for solving the DTC-F problem for SP graphs and a worstcase exponential-time algorithm for the DTC-V problem for SP graphs. Linear-time algorithms for solving the DET-V problem for SP graphs were given in [5]. These algorithms are based on dynamic programming and are complicated. Whether the DTC-V problem for SP graphs can be solved in polynomial time is still open. For general TTGs, a linear-time algorithm for solving the DET-F problem was given in [1]. The DTC-F problem is NP-hard [14, 15], which implies that the DTC-V problem for TTGs is also NP-hard. Whether the DET-V problem for general TTGs

1258

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

can be solved in polynomial time is posed as an open question in [1]. Here, we answer this question in the affirmative by presenting a linear-time algorithm for the DET-V problem. Our algorithm is based on careful analysis of the structures of DTCs of TTGs. In more details, we first find out the types of those DTCs that are the intersection of a DET of a TTG G and a subgraph of G. We then define two operations for composing such DTCs of edge-disjoint subgraphs into a single such DTC of a larger subgraph. We further prove that the two operations have nice properties based on which a linear-time algorithm can be designed. The main data structure we use is the SPQR-decomposition tree of a TTG [3]. 1.4. Organization of this paper. Section 2 describes the SPQR decomposition of a TTG. Section 3 shows several useful properties of different embeddings of a TTG. Section 4 discusses the special case of the DET-V problem where neither the input TTG nor its dual graph has an odd-degree vertex. Section 5 gives a polynomial-time algorithm for the DET-V problem. Section 6 refines this algorithm to a linear-time algorithm. 2. SPQR decomposition. Throughout this paper, for a TTG G, G∗ denotes the dual graph of G, s(G) denotes the source of G, t(G) denotes the sink of G, and |G| denotes the total number of vertices and edges in G. For an unordered list L, we write L = ha1 , . . . , ak i, where a1 through ak are the elements of L. For an ordered list L, we write L = (a1 , . . . , ak ), where a1 , . . . , ak are the elements of L and are ordered in this order. In the rest of this section, fix a TTG G. A cut vertex of G is a vertex whose removal disconnects G. G is biconnected if it has no cut vertex. A biconnected component of G is a maximal subgraph of G with no cut vertex. A split pair of G is either a pair of adjacent vertices or a pair of vertices whose removal disconnects G′ , where G′ is the graph obtained from G by adding the edge {s(G), t(G)}. A split component of a split pair hu, vi is either an edge {u, v} or a maximal subgraph H of G such that H is a TTG with poles u and v and hu, vi is not a split pair of H. A split pair hu, vi of G is maximal if there is no other split pair hw1 , w2 i in G such that hu, vi is contained in a split component of hw1 , w2 i. The decomposition tree T of G describes a recursive decomposition of G with respect to its split pairs [2, 3]. T is a rooted ordered tree whose nodes are of four types: S, P, Q, and R. Each node µ of T has an associated TTG, called the skeleton of µ and denoted by Sk(µ). Also, it is associated with an edge in the skeleton of the parent χ of µ, called the virtual edge of µ in Sk(χ). T is recursively defined as follows. Trivial case. G consists of a single edge {s(G), t(G)}. Then, T consists of a single Q-node whose skeleton is G itself. Series case. G is not biconnected. Let c1 , . . . , ck−1 (k ≥ 2) be the cut vertices of G. Since G is a TTG, each ci ∈ {c1 , . . . , ck−1 } is contained in exactly two biconnected components Gi and Gi+1 of G such that s(G) is in G1 and t(G) is in Gk . The root of T is an S-node µ. Sk(µ) is a path e1 , . . . , ek , where the edge ei = {ci−1 , ci }, c0 = s(G), and ck = t(G). Parallel case. s(G) and t(G) constitute a split pair of G with split components G1 , . . . , Gk (k ≥ 2). Then, the root of T is a P-node µ. Sk(µ) consists of k parallel edges between s(G) and t(G), denoted by e1 , . . . , ek . Rigid case. None of the above cases applies. Let hs1 , t1 i, . . . , hsk , tk i (k ≥ 1) be the maximal split pairs of G. For i = 1, . . . , k, let Gi be the union of all the split components of hsi , ti i. The root of T is an R-node µ. Sk(µ) is obtained from G by replacing each subgraph Gi with an edge ei = {si , ti }. Note that adding the edge

1259

DOUBLE EULER TRAILS OF PLANAR GRAPHS

{s(G), t(G)} to Sk(µ) yields a triconnected graph. By this, Sk(µ) has no different embedding other than itself [11]. In the last three cases, µ has children ν1 , . . . , νk (in this order) such that νi is the root of the decomposition tree of graph Gi for all i ∈ {1, . . . , k}. The virtual edge of node νi is the edge ei in Sk(µ). Gi is called the pertinent graph of νi and is denoted by Pt(νi ). Note that G is the pertinent graph of the root of T . Figure 2.1 illustrates the decomposition tree of a TTG G. The skeletons of the nodes µ and ν are also shown.

14

P 13

6 5

7

4

9

{1,2}

10

3

11

2 8 1

(1)

υ

S 12

{2,3} {2,5} {3,4}

µ R S

S {6,14} {3,6}

R

{13,14} {1,8} {9,14} {1,9} {9,13} {12,13} {1,7} {7,14} {8,9} {9,12} P

{5,6}

S

{4,5}

S

{8,10} {10,12} {8,11} {11,12}

(2) Fig. 2.1. (1) A TTG G. (2) Its decomposition tree T .

By the definition of T , no child of an S-node is an S-node and no child of a P-node is a P-node. Lemma 2.1 (see [3]). T has O(|G|) nodes. Also, the total number of edges of the skeletons stored at the nodes of T is O(|G|). The dual decomposition tree of T is the decomposition tree of the dual graph of G. Lemma 2.2. The dual decomposition tree of T can be obtained from T by exchanging the roles of the S-nodes and the P-nodes and further changing the skeleton of each node to the dual graph of the skeleton. Proof. The proof is obvious. A different embedding of G is obtained from G by a sequence of operations from the following set [7, 8, 9, 10, 13]: • horizontally flipping the skeleton of an R-node around its poles; • permuting the children of a P-node; • vertically flipping the skeleton of an R-node, which is equivalent to horizontally flipping the dual skeleton around its poles; • permuting the children of an S-node, which is equivalent to permuting the children of the dual P-node. Note that if G is a different embedding of a TTG G, the circuits represented by G and G are logically equivalent. Also note that the commonly known definition of “different embeddings” allows only the first two operations [2, 3]. Hence, the meaning of the phrase “different embedding” used here is different from its commonly known meaning. 3. Properties of embeddings and double trails. Throughout this paper, a list is ordered unless stated explicitly otherwise. An unordered list is actually a multiset. So, for two unordered lists L1 = ha1 , . . . , ak i and L2 = hb1 , . . . , bℓ i, we write

1260

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

L1 ∪ L2 for the unordered list ha1 , . . . , ak , b1 , . . . , bℓ i. For an ordered (respectively, unordered) list L and a set S, let L − S denote the ordered (respectively, unordered) list obtained from L by deleting all appearances of each x ∈ S. The following fact is well known. Fact 1. For a connected graph G, the following two statements hold: • G has a closed Euler trail if and only if it has no odd-degree vertex; in this case G is called Eulerian. • G has an open Euler trail if and only if it contains exactly two odd-degree vertices, which are the first and the last vertex of the trail. In the rest of this section, fix a TTG G. Let T be the decomposition tree of G. A block of G is either the pertinent graph of a node in T or the union of the pertinent graphs of some consecutive children of a P- or S-node in T . A proper block of G is a block B such that G 6= B. Let B = Pt(µ), where µ is a node of T . For every child ν of µ in T , we call Pt(ν) a child block of B. The following properties of double trails are clear. They play very important roles in our algorithm. Noncrossing property. Let Q be a double trail of G. Let e′ and e′′ be two consecutive edges in Q. Then, e′ and e′′ appear consecutively around v in G, where v is the ending vertex of e′ in Q. Let B be a block of G. Let e1 (e2 , respectively) be the edge in B incident to s(B) that is on the west (east, respectively) side of B. (If there is only one edge in B incident to s(B) then e1 = e2 .) Let e3 (e4 , respectively) be the edge in B incident to t(B) that is on the west (east, respectively) side of B. (If there is only one edge in B incident to t(B), then e3 = e4 .) We call e1 , e2 , e3 , e4 the access edges of B. Each access edge ei is incident to a pole of B and its dual edge e∗i is incident to a pole of B ∗ ; only access edges of B satisfy this property. Access-edge property. Let Q be any double trail of G. Let e′ , e′′ be two consecutive edges in Q such that e′ is in B and e′′ is not in B. Then, e′ must be an access edge of B. Lemma 3.1 (see [1]). Let e = {u, v} be an edge in G and e∗ = {F1 , F2 } its dual edge. Let Q be a maximal double trail in G starting with e. If the direction of e in Q and the direction of e∗ in the dual trail Q∗ are given, then Q is uniquely determined and can be traced out in O(|Q|) time. Proof (sketch). Suppose that Q traverses e from u to v while Q∗ traverses e∗ from F1 to F2 . Then, the successor of e in Q must be the edge incident to v and on the face F2 of G. Repeating this argument, we can uniquely trace out all edges of Q. The degree parity of a vertex in G is 0 if its degree is even and is 1 otherwise. Fact 2. If G is Eulerian, then so is every different embedding of G. Proof. Let µ be a node of T , and B = Pt(µ). Clearly, no vertex gets a different degree after B is horizontally flipped. Similarly, when µ is a P-node, no vertex gets a different degree after the children of µ are permuted. Suppose that µ is an R-node. After B is vertically flipped, only the poles s(B) and t(B) may get a different degree in the resulting embedding. Let mB be the number of edges in B. For each vertex P v in B, let dB (v) be the degree of v in B. Thus, 2mB = dB (s(B)) + dB (t(B)) + v6=s(B),t(B) dB (v). Since dB (v) is even for all v 6∈ {s(B), t(B)}, dB (s(B)) and dB (t(B)) must have the same parity. Thus, vertically flipping B creates no odd-degree vertex. Next, suppose µ is an S-node. Let B1 , . . . , Bk be the child blocks of B. Since no Bi contains an odd-degree nonpole, the two poles s(Bi ) and t(Bi ) must have the same

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1261

degree parity within Bi (as proved in the last paragraph). Suppose that dB1 (s(B1 )) is even. Then, dB1 (t(B1 )) must be even. Since t(B1 ) = s(B2 ) and dB (t(B1 )) = dB1 (t(B1 )) + dB2 (s(B2 )) is even, dB2 (s(B2 )) must be even. Continuing this argument, we can see that all s(Bi ) and t(Bi ) must have even degree within Bi . By this, permuting the children of µ creates no odd-degree vertex. Similarly, if dB1 (s(B1 )) is odd, then all s(Bi ) and t(Bi ) must have odd degree within Bi . Thus, permuting the children of µ creates no odd-degree vertex. For a trail P in G and a proper block B of G, the intersection of P and B, denoted by P ∩ B, is the list (Q1 , Q2 , . . . , Qk ), where Q1 is the first (maximal) subtrail of P in B, Q2 is the second (maximal) subtrail of P in B, . . . , and Qk is the last (maximal) subtrail of P in B. An ordered DTC (ODTC) of G is a list (P1 , . . . , Pℓ ) such that {P1 , . . . , Pℓ } is a DTC of G. For an ODTC P = (P1 , . . . , Pℓ ) of G and a proper block B of G, the intersection of P and B, denoted by P ∩ B, is the list (Q1,1 , . . . , Q1,k1 , . . . , Qℓ,1 , . . . , Qℓ,kℓ ), where (Qi,1 , . . . , Qi,ki ) is the intersection of Pi and B for all i ∈ {1, . . . , ℓ}. Clearly, P ∩ B is an ODTC of B. Let ϕG : V → {1, 2, 3} be the function that maps s(G) to 1, maps t(G) to 2, and maps each nonpole of G to 3. The starting pair (respectively, ending pair) of a double trail P in G is the pair (ϕG (u), ϕG∗ (x)), where u is the starting (respectively, ending) vertex of P and x is the starting (respectively, ending) vertex of the dual trail of P . The extreme quadruple of a double trail P in G is the quadruple (p1 , p2 , p3 , p4 ), where (p1 , p2 ) is the starting pair of P and (p3 , p4 ) is the ending pair of P . The σ-extreme list of an ODTC (P1 , . . . , Pk ) is the list (q1 , . . . , qk ), where qi is the extreme quadruple of Pi for all i ∈ {1, . . . , k}. The π-extreme list of an ODTC (P1 , . . . , Pk ) is the list (p1 , q2 , . . . , qk ), where p1 is the ending pair of P1 and qi is the extreme quadruple of Pi for all i ∈ {2, . . . , k}. The δ-extreme list of an ODTC (P1 , . . . , Pk ) is the list (p1 , q2 , . . . , qk−1 , pk ), where p1 is the ending pair of P1 , pk is the starting pair of Pk , and qi is the extreme quadruple of Pi for all i ∈ {2, . . . , k − 1}. Lemma 3.2. Let B be a block of G. Let P = (P1 , . . . , Pℓ ) be an ODTC of G. Let D be a TTG, and let Q = (Q1 , . . . , Qk ) be an ODTC of D. Let H be the TTG obtained from G by replacing B with D. Then, the following three statements hold: 1. Suppose that (1) the σ-extreme list of Q equals that of P ∩ B and (2) no trail in P starts or ends with an edge of B. Then, H has an ODTC P ′ whose σ-extreme list equals that of P. 2. Suppose that (1) the π-extreme list of Q equals that of P ∩ B and (2) P1 starts with an edge of B while no trail in P − {P1 } starts or ends with an edge of B. Then, H has an ODTC P ′ whose π-extreme list equals that of P. 3. Suppose that (1) the δ-extreme list of Q equals that of P ∩ B and (2) P1 starts with an edge of B and Pℓ ends with an edge of B while no trail in P −{P1 , Pℓ } starts or ends with an edge of B. Then, H has an ODTC P ′ whose δ-extreme list equals that of P. Proof. For each Pi ∈ P, if Pi ∩ B is empty, then let Pi′ = Pi ; otherwise, let Pi′ be the trail obtained from Pi by replacing each Sj ∈ Pi ∩ B with Qj , where Sj is the jth trail in P ∩ B. Then, P ′ = (P1′ , . . . , Pℓ′ ) is the required ODTC of H. 4. The case where G and G∗ are Eulerian. Throughout this section, fix an Eulerian TTG G whose dual graph is also Eulerian. Let T be the decomposition tree of G. By Fact 2, each different embedding G of G and its dual G ∗ are still Eulerian. So, each DET P of a valid embedding of G must start and end at the same vertex, and so does the dual trail of P .

1262

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

4.1. Types of DTCs of proper blocks. Suppose that G has a valid embedding G and P is a DET of G. Fix a proper block B of G. Since P starts and ends at the same vertex and so does the dual trail of P , we may assume that the starting edge of P is not in B. Then, each double trail in P ∩ B must start and end at poles of B. Let P ∩ B = (P1 , . . . , Pk ). For each i ∈ {1, . . . , k}, let Pi∗ be the dual trail of Pi . Lemma 4.1. 1. If k ≥ 2, then each Pi ∈ {P1 , . . . , Pk } uses two distinct access edges of B. Consequently, k ≤ 2. 2. If Pi starts and ends at the same pole of B, then Pi∗ must start and end at different poles of B ∗ . 3. If k = 2 and P1 starts and ends at different poles of B, then P1∗ must start and end at the same pole of B ∗ . Proof. Let e1 and e2 be the two access edges that are incident to s(B) and on the west side and the east side of B, respectively. Let e3 and e4 be the two access edges that are incident to t(B) and on the west side and the east side of B, respectively. We prove the three statements separately as follows. Statement 1. Suppose k ≥ 2. Consider an arbitrary Pi ∈ {P1 , . . . , Pk }. Let e (respectively, e′ ) be the starting (respectively, ending) edge of Pi . Since the starting edge of P is not in B, e ∈ {e1 , . . . , e4 } by the access-edge property. Even if e′ is the ending edge of P , since P is an Euler trail, e′ must be incident to the starting edge of P which is not in B by our assumption. So, e′ ∈ {e1 , . . . , e4 }. Thus, we are done if e 6= e′ . Towards a contradiction, assume e = e′ . Then, e = {s(B), t(B)} is the unique edge of Pi . In turn, {s(B ∗ ), t(B ∗ )} is the unique edge of Pi∗ . It follows that B consists of a single edge, contradicting the assumption that k ≥ 2. Therefore, e 6= e′ and Pi uses two distinct access edges of B. Since B has at most four access edges (namely e1 through e4 ), k ≤ 2. Statement 2. Without loss of generality, suppose that Pi starts and ends at s(B). Then, e1 6= e2 . By the access-edge property, we can assume that Pi starts with e1 and ends with e2 . Hence, Pi∗ starts at the west side and ends at the east side of B. (See Figure 4.1(1).) Statement 3. Suppose that k = 2 and P1 starts and ends at different poles of B. Then, by statement 1, e1 through e4 are distinct edges. Without loss of generality, assume that P1 starts with e1 . Towards a contradiction, suppose that P1 ends with e4 . Then, P2 starts with e2 and ends with e3 . Since B is a plane graph, P1 and P2 must cross each other somewhere inside B. However, this is impossible by the noncrossing property. Hence, P1 ends with e3 ; in turn P1∗ starts and ends at the west side of B. (See Figure 4.1(2).) Based on Lemma 4.1, P ∩ B can be only of the following five possible types: • Type σ1 . k = 1; P1 starts at one pole and ends at the other pole, and so does P1∗ . • Type σ2 . k = 1; P1 starts at one pole and ends at the same pole while P1∗ starts at one pole and ends at the other pole. • Type σ3 . k = 1; P1 starts at one pole and ends at the other pole while P1∗ starts at one pole and ends at the same pole. • Type σ4 . k = 2; P1 starts at one pole u and ends at u while P2 starts at the other pole v and ends at v; P1∗ starts at one pole and ends at the other pole, and so does P2∗ . • Type σ5 . k = 2; P1 starts at one pole and ends at the other pole, and so does P2 ; P1∗ starts at one pole x and ends at x while P2∗ starts at the other pole y

1263

DOUBLE EULER TRAILS OF PLANAR GRAPHS

t(B) e

t(B) e

e

3

e

e

s(B)

e 2 s(B)

(1)

(2)

3

4

e

e

1

4

1

2

Fig. 4.1. The proof of Lemma 4.1.

P2

P2 P1

R(σ ) 1

R(σ ) 2

R(σ ) 3

R(σ4 )

x

y

P1

R(σ ) 5

Fig. 4.2. Representative graphs for σ-types.

and ends at y. Define Σ = {σ1 , . . . , σ5 }. Each σi is called a σ-type. For a TTG H, let Kσ (H) denote the set of all σi ∈ Σ such that a different embedding of H has a Type-σi ODTC. We call each member of Kσ (H) a σ-type of H. For each σi ∈ Σ, a representative graph R(σi ) is shown in Figure 4.2 in which the solid lines denote the edges in the trail P1 and the dual trail P1∗ , while the light lines denote the edges in the trail P2 and the dual trail P2∗ . Note that σi is the unique σ-type of R(σi ) for all i ∈ {1, . . . , 5}. 4.2. Composing DTCs. Let H1 and H2 be two vertex-disjoint TTGs. The series composition of H1 and H2 , denoted by H1 ⋆ H2 , is the TTG obtained from H1 and H2 by identifying t(H1 ) with s(H2 ), s(H1∗ ) with s(H2∗ ), and t(H1∗ ) with t(H2∗ ). The parallel composition of H1 and H2 , denoted by H1 ⋄ H2 , is the TTG obtained from H1 and H2 by identifying s(H1 ) with s(H2 ), t(H1 ) with t(H2 ), and t(H1∗ ) with s(H2∗ ). For an integer k ≥ 3 and k vertex-disjoint TTGs H1 , . . . , Hk , let H1 ⋆ H2 ⋆ · · · ⋆ Hk = (· · · ((H1 ⋆ H2 ) ⋆ H3 ) ⋆ · · · Hk−1 ) ⋆ Hk and H1 ⋄ H2 ⋄ · · · ⋄ Hk = (· · · ((H1 ⋄ H2 ) ⋄ H3 ) ⋄ · · · Hk−1 ) ⋄ Hk . We call H1 ⋆ · · · ⋆ Hk (respectively, H1 ⋄ · · · ⋄ Hk ) the series (respectively, parallel) composition of H1 through Hk . Define two binary operators ⋆ and ⋄ over Σ as in Tables 4.1 and 4.2; each empty entry in Table 4.1 (respectively, 4.2) indicates that the ⋆ (respectively, ⋄) operator is undefined for that entry. Lemma 4.2. Both ⋆ and ⋄ are commutative and associative operators over Σ. Proof. One can use Tables 4.1 and 4.2 to verify. Lemma 4.3. Let H be a TTG. Then, the following two statements hold: 1. Suppose H = H1 ⋆ H2 , where Kσ (H1 ) = {σi } and Kσ (H2 ) = {σj }. Then, Kσ (H) = {σi ⋆ σj } if σi ⋆ σj is defined, while Kσ (H) = ∅ otherwise.

1264

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

2. Suppose H = H1 ⋄ H2 , where Kσ (H1 ) = {σi } and Kσ (H2 ) = {σj }. Then, Kσ (H) = {σi ⋄ σj } if σi ⋄ σj is defined, while Kσ (H) = ∅ otherwise. Proof. By statement 1 in Lemma 3.2, it suffices to verify that for every σi , σj ∈ Σ, Kσ (R(σi ) ⋆ R(σj )) = {σi ⋆ σj } and Kσ (R(σi ) ⋄ R(σj )) = {σi ⋄ σj }. For the verification, it is helpful to note that for each σi ∈ Σ, R(σi ) remains unchanged after a horizontal or vertical flipping. We show only one example for each of the ⋆ and the ⋄ operators. The other cases can be verified similarly. Table 4.1 Operator ⋆ over Σ.

σ1 σ2 σ3 σ4 σ5

σ1 σ3

σ2

σ3 σ1

σ4

σ4 σ1

σ5 σ2

σ3 σ2

σ4

σ4 σ5

Table 4.2 Operator ⋄ over Σ.

σ1 σ2 σ3 σ4 σ5

σ1 σ2 σ1

σ2 σ1 σ2

σ3

σ4

σ5

σ5 σ3

σ3 σ4 σ5

σ5

Consider the graph R(σ1 ), with poles u and v, and the graph R(σ3 ) with poles v and w. Let x and y be the west side and the east side of their series composition H ′ = R(σ1 ) ⋆ R(σ3 ). (See Figure 4.3(1).) The only DTC of H ′ consists of a single double trail P1 which starts at u, passing through v and ends at w, while the dual trail P1∗ starts at x, travels to y, to x, and to y again. This is a Type-σ1 DTC. So Kσ (R(σ1 ) ⋆ R(σ3 )) = {σ1 } = {σ1 ⋆ σ3 } as to be shown. Consider the graph R(σ4 ) with poles u, v, the west side x and the east side y; and the graph R(σ5 ) with poles u, v, the west side y and the east side z. (See Figure 4.3(2).) Let H ′′ = R(σ4 ) ⋄ R(σ5 ). The only DTC of H ′′ consists of two double trails P1 and P2 as shown in Figure 4.3(2). This is a Type-σ5 DTC. So Kσ (R(σ4 ) ⋄ R(σ5 )) = {σ5 } = {σ4 ⋄ σ5 }. Let µ be a node in T and B = Pt(µ). For convenience, we also use Kσ (µ) to denote Kσ (B). Lemma 4.4. Let µ be a nonroot node of T and B = Pt(µ). Then, |Kσ (B)| ≤ 1. Moreover, Kσ (Pt(ν)) for all descendants ν (including µ itself ) of µ in T can be computed in O(|B|) time. Proof. The proof is by induction. In case µ is a leaf node of T , the lemma trivially holds because Kσ (B) = {σ1 }. Suppose that µ is a nonleaf node of T . Let ν1 , . . . , νk be the children of µ in T . Let Bi = Pt(νi ) for all i ∈ {1, . . . , k}. By the inductive hypothesis, |Kσ (Bi )| ≤ 1. If Kσ (Bi ) = ∅ for some i ∈ {1, . . . , k}, then clearly Kσ (B) = ∅. So, suppose that each Kσ (Bi ) consists of a unique σji ∈ Σ. Consider the following three cases: Case 1. µ is an R-node. Then, Sk(µ) has no different embedding other than itself. Let H be the TTG obtained from Sk(µ) by replacing the virtual edge of νi in Sk(µ)

1265

DOUBLE EULER TRAILS OF PLANAR GRAPHS

R(σ3)

w P* 1 v

x

R(σ ) 1

u (1)

P1

v

P* 2

y

x y

P2

z

R(σ4 )

u

R(σ ) 5

(2)

Fig. 4.3. The proof of Lemma 4.3.

with R(σji ) for all i ∈ {1, . . . , k}. Since Kσ (Bi ) = Kσ (R(σji )) for all i ∈ {1, . . . , k}, by repeatedly applying statement 1 in Lemma 3.2, we have Kσ (µ) = Kσ (H). Kσ (H) can be computed as follows. Let P1 be the maximal double trail in H which starts at s(H) and whose dual trail P1∗ starts at s(H ∗ ). Let M be the set of all edges of H not traversed by P1 . In case M = ∅, we check if {P1 } is a DTC of H of a σ-type; if it is, then Kσ (µ) consists of this σ-type, while Kσ (µ) = ∅ otherwise. Suppose M 6= ∅. If M contains no access edge of H, then Kσ (µ) = ∅. Otherwise, let e ∈ M be an access edge of H. We find the maximal double trail P2 in H such that e and e∗ are, respectively, the starting edge of P2 and its dual trail P2∗ . If {P1 , P2 } is a DTC of H of a σ-type, then Kσ (µ) consists of this σ-type, while Kσ (µ) = ∅ otherwise. Case 2. µ is an S-node. Then, each different embedding B of B can be written as B1′ ⋆ · · · ⋆ Bk′ , where (1′ , 2′ , . . . , k′ ) is a permutation of (1, 2, . . . , k) and Bi′ is a different embedding of Bi′ for all i ∈ {1, . . . , k}. By Lemma 4.3, if (· · · ((σj1′ ⋆ σj2′ ) ⋆ σj3′ ) ⋆ · · ·) ⋆ σjk′ is undefined, then Kσ (B) = ∅; otherwise, by Lemma 4.2, Kσ (B) = {(· · · ((σj1 ⋆ σj2 ) ⋆ σj3 ) ⋆ · · ·) ⋆ σjk }. Thus, |Kσ (B)| ≤ 1. Case 3. µ is a P-node. It is similar to Case 2. 4.3. The algorithm. We process the nodes of T in post-order. When processing a nonroot node µ of T , we compute Kσ (µ) as in the proof of Lemma 4.4. Let µ be the root of T . Let ν1 , . . . , νk be the children of µ in T . For each i ∈ {1, . . . , k}, let Bi = Pt(νi ). If Kσ (Bi ) = ∅ for some i ∈ {1, . . . , k}, then G has no valid embedding and we stop immediately. So, suppose that Kσ (B1 ) = {σj1 }, . . . , Kσ (Bk ) = {σjk }. We distinguish three cases as follows. • Case 1. µ is an R-node. Then, Sk(µ) has no different embedding other than itself. As in Case 1 in the proof of Lemma 4.4, we construct a TTG H from Sk(µ). By the same argument as in Case 1 in the proof of Lemma 4.4, G has a DET if and only if H has a DET. To test if H has a DET, we pick an arbitrary edge e in H and fix a direction as the starting point. The dual edge e∗ can be directed in two ways. Once the direction of e∗ is fixed, we can uniquely trace the dual trail by Lemma 3.1. More specifically, let e be the edge incident to s(B) whose dual edge e∗ is incident to s(H ∗ ). Let x be the endpoint of e∗ other than s(H ∗ ). Let P (respectively, Q) be the maximal double trail in H which starts at s(H) and whose dual trail starts at s(H ∗ ) (respectively, x). By Lemma 3.1, P and Q can be found in O(|Sk(µ)|) time. By statement 1 in Lemma 3.2, if either P or Q is a DET in H, then G has a DET. If neither P nor Q is a DET in H,

1266

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

then H has no DET, and hence G has no DET either. • Case 2. µ is an S-node. First we prove the following claim. Claim. For a TTG H = H1 ⋆ H2 with |Kσ (H1 )| ≤ 1 and |Kσ (H2 )| ≤ 1, H has a valid embedding if and only if Kσ (H1 ) = Kσ (H2 ) = {σ2 }. To see the “if” part of the claim, it suffices to observe that a series composition of two copies of R(σ2 ) has a valid embedding. To see the “only if” part, suppose that H has a DET P . Then, P is obtained by concatenating the double trail(s) in the DTC of H1 and the double trail(s) in the DTC of H2 . This can be done only in the following two possible ways. (a) The DTC of H1 consists of a single double trail P1 starting and ending at the same pole of H1 , and the DTC of H2 consists of a single double trail P2 starting and ending at the same pole of H2 . That is, Kσ (H1 ) = Kσ (H2 ) = {σ2 }. In this case, if H is obtained by identifying the common pole where both P1 and P2 start and end, we indeed get a DET of H. (b) The DTC of H1 consists of a single double trail P1 starting and ending at the same pole of H1 , and the DTC of H2 consists of two double trails P2 and P3 , each starting and ending at the different poles of H2 . (In this case, by concatenating P2 , P1 , P3 in this order, we get a closed Euler trail P of H.) That is, Kσ (H1 ) = {σ2 } and Kσ (H2 ) = {σ5 }. In this case, however, the dual trail P ∗ of P starts at one pole of the dual graph H ∗ and ends at the other pole of H ∗ . (This can be verified by using the representative graphs in Figure 4.2.) Hence, P ∗ is not a closed Euler trail of H ∗ . So, this case is impossible. This completes the proof of the claim. Observe that for each nonempty proper subset {1′ , . . . , h′ } of {1, . . . , k}, B1′ ⋆ · · · ⋆ Bh′ has at most one σ-type. This follows from Lemmas 4.2 and 4.3. By the claim and this observation, G has a valid embedding if and only if {1, . . . , k} can be partitioned into two sets {1′ , . . . , h′ }, {1′′ , . . . , g ′′ } such that σ2 is the σ-type of both B1′ ⋆ · · · ⋆ Bh′ and B1′′ ⋆ · · · ⋆ Bg′′ . By Table 4.1, such a partition is possible if and only if (1) σ2 is the σ-type of exactly two of B1 , . . . , Bk and (2) σ5 is the σ-type of all the rest. • Case 3. µ is a P-node. It suffices to modify the argument in Case 2 by replacing each symbol “⋆” with “⋄,” “σ2 ” with “σ3 ,” and “σ5 ” with “σ4 .” By Lemmas 2.1 and 4.4, the time needed to process the entire tree T is O(|G|). Thus, we have the following. Theorem 4.5. Given an Eulerian TTG G whose dual graph is also Eulerian, it takes O(|G|) time to decide if G has a valid embedding. 5. An O(|G|3 )-time algorithm. Throughout the rest of this paper, let G be a TTG, and let T be its decomposition tree. The reverse of a trail e1 e2 . . . ek in G is the trail ek ek−1 . . . e1 . Section 5.1 investigates how a DET of G can intersect a block of G. Section 5.2 (respectively, 5.3) shows how a DET P can intersect the series (respectively, parallel) composition of two or more blocks of G, given the way that P intersects the blocks. Section 5.4 describes the algorithm for deciding the existence of a DET. 5.1. Types of DTCs of proper blocks. Suppose that G has a valid embedding G and P is a DET of G. Let es and et be the starting and the ending edge of P , respectively. Fix a proper block B of G. Let P ∩ B = (P1 , . . . , Pk ). For each i ∈ {1, . . . , k}, let Pi∗ be the dual trail of Pi . Case 1. Neither es nor et is in B. Then, as discussed in section 4.1, P ∩ B can only be of a σ-type.

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1267

Case 2. Exactly one of es and et is in B. If es is in B, let Qi = Pi for all i ∈ {1, . . . , k}; otherwise, let Qi be the reverse of Pk−i+1 for all i ∈ {1, . . . , k}. Let Q∗i be the dual trail of Qi for each i ∈ {1, . . . , k}. Without loss of generality, suppose that Q1 starts with es and ends with an access edge of B that is incident to a pole u of B. Similarly to the proof of statement 1 in Lemma 4.1, we can show that each Qi ∈ {Q2 , . . . , Qk } must use exactly two access edges of B. Since B has at most four access edges, k must be either 1 or 2. If k = 2, the trail Q2 or its reverse either starts with an access edge incident to u and ends with an access edge incident to the other pole v of B, or it starts and ends with the two access edges incident to v. Based on these observations, the ODTC (Q1 , . . . , Qk ) can only be of the following possible types: • Type π1 . k = 1; Q1 ends at a pole; Q∗1 ends at a pole. • Type π2 . k = 2; Q1 ends at a pole, and Q2 starts at a pole and ends at the other pole; Q∗1 ends at a pole, and Q∗2 starts at a pole and ends at the other pole. • Type π3 . k = 2; Q1 ends at a pole, and Q2 starts at a pole and ends at the other pole; Q∗1 ends at a pole x, and Q∗2 starts at the other pole y and ends at y. • Type π4 . k = 2; Q1 ends at a pole u, and Q2 starts at the other pole v and ends at v; Q∗1 ends at a pole, and Q∗2 starts at a pole and ends at the other pole. Note that, for each type πi , the trail Q1 is required to end at a pole and starts with the edge es . However, the edge es might be either incident to a pole or not incident to a pole. Define Π = {π1 , . . . , π4 }. We call the elements of Π π-types. For a TTG H, let Kπ (H) denote the set of all πi ∈ Π such that a different embedding of H has a Type-πi DTC. We call each member of Kπ (H) a π-type of H. For each πi ∈ Π, a representative graph R(πi ) is shown in Figure 5.1. Note that for all i ∈ {1, . . . , 4}, πi is the unique π-type of R(πi ). Case 3. Both es and et are in B. Then, k > 1 or else B could not have been a proper block of G. Without loss of generality, suppose that P1 starts with es and Pk ends with et . Each of P1 and Pk uses at least one access edge of B. Similarly to the proof of statement 1 in Lemma 4.1, we can show that each Pi ∈ {P2 , . . . , Pk−1 } must use exactly two access edges of B. Thus, k must be either 2 or 3. By considering which access edges are used by which Pi , it can be seen that P ∩ B can be only one of the following possible types: • Type δ1 . k = 2; P1 ends at a pole, and P2 starts at the same pole; P1∗ ends at a pole, and P2∗ starts at the other pole. • Type δ2 . k = 2; P1 ends at a pole, and P2 starts at the other pole; P1∗ ends at a pole, and P2∗ starts at the same pole. • Type δ3 . k = 2; P1 ends at a pole, and P2 starts at the other pole; P1∗ ends at a pole, and P2∗ starts at the other pole. • Type δ4 . k = 3; P1 ends at a pole u, P2 starts at the other pole v and ends at v, and P3 starts at u; P1∗ ends at a pole x, P2∗ starts at x and ends at the other pole y, and P3∗ starts at y. • Type δ5 . k = 3; P1 ends at a pole u, P2 starts at u and ends at the other pole v, and P3 starts at v; P1∗ ends at a pole x, P2∗ starts at the other pole y and ends at y, and P3∗ starts at x. • Type δ6 . k = 3; P1 ends at a pole u, P2 starts at a pole and ends at the other

1268

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

Q 2

es R ( π 1)

Q 2

e

s

xQ Q es 1

R ( π2 )

1

Q y 2

R (π3 )

Q e 1 s

R (π4 )

Fig. 5.1. Representative graphs for π-types.

pole, and P3 starts at the pole v 6= u; P1∗ ends at a pole x, P2∗ starts at a pole and ends at the other pole, and P3∗ starts at the pole y 6= x. Note that for each type δi , the trail P1 is required to end at a pole and starts with the edge es . However, es might be either incident to a pole or not incident to a pole. The trail P2 in the types δ1 , δ2 , δ3 (the trail P3 in the types δ4 , δ5 , δ6 , respectively) is required to start at a pole and ends with the edge et . However, et might be either incident to a pole or not incident to a pole. Define ∆ = {δ1 , . . . , δ6 }. We note that when B = G, P ∩ B must be of the following type: • Type δ0 . k = 1. We call the elements of ∆ ∪ {δ0 } δ-types. For a TTG H, let Kδ (H) denote the set of all δi ∈ ∆ ∪ {δ0 } such that a different embedding of H has a Type-δi DTC. We call each member of Kδ (H) a δ-type of H. For each δi ∈ ∆, a representative graph R(δi ) is shown in Figure 5.2. Note that for all i ∈ {1, . . . , 6}, δi is the unique δ-type of R(δi ). Define Γ = Σ ∪ Π ∪ ∆. Let H be a representative graph in Figures 5.1 and 5.2. If Q1 and Q2 are two DTCs of H such that Q2 can be obtained from Q1 by reversing the direction of exactly one double trail on which neither es nor et appears, then we view Q1 and Q2 as the same DTC. A DTC Q of H is valid if Q is of a σ-, π-, or δ-type. From the figures, we can see that H has a unique valid DTC. Thus, if H is a graph in Figure 5.1, then we think that es and its dual edge have been oriented by the valid DTC of H. Similarly, if H is a graph in Figure 5.2, then we think that es and et and their dual edges have been oriented by the valid DTC of H. 5.2. Series composition of DTCs. This subsection shows how to compute the π- or δ-types of a series composition of two or more TTGs H1 , . . . , Hk , when the σ-, π-, or δ-types of H1 through Hk are given. This is needed by our algorithm to process the S-nodes of T . Let Γ1 = Σ1 ∪ Π1 ∪ ∆1 and Γ2 = Σ2 ∪ Π2 ∪ ∆2 be two subsets of Γ, where for i = 1, 2, Σi ⊆ Σ, Πi ⊆ Π, and ∆i ⊆ ∆. Define Γ1 ⋆ Γ2 = (∪σi ∈Σ1 ,σj ∈Σ2 Kσ (R(σi ) ⋆ R(σj ))) ∪ (∪σi ∈Σ1 ,πj ∈Π2 Kπ (R(σi ) ⋆ R(πj ))) ∪ (∪πi ∈Π1 ,σj ∈Σ2 Kπ (R(πi ) ⋆ R(σj ))) ∪ (∪σi ∈Σ1 ,δj ∈∆2 Kδ (R(σi ) ⋆ R(δj ))) ∪ (∪δi ∈∆1 ,σj ∈Σ2 Kδ (R(δi ) ⋆ R(σj ))) ∪ (∪πi ∈Π1 ,πj ∈Π2 Kδ (R(πi ) ⋆ R(πj ))). If Γ1 = ∅ or Γ2 = ∅, then Γ1 ⋆ Γ2 = ∅. Recall that, by the definition, Kσ (H) is the set of σi ∈ Σ such that a different embedding of H has a type-σi ODTC. In the case H = H1 ⋆ H2 , if we switch H1 and

1269

DOUBLE EULER TRAILS OF PLANAR GRAPHS

P 1

e

s

P 1

e

e

e

s

t

P 2

e

t

e

y

P 2

e

R(δ ) 2

R(δ ) 3

t

y

t P e 1

P 3

s

x

e

s P1

R(δ5)

e

t

P 2

u

R(δ4 )

P 3

e P3 x

s

P 2

R(δ ) 1

P 1

t P 2

v

v

u

y

v P 2 x

e P1 u R(δ6)

s

Fig. 5.2. Representative graphs for δ-types.

H2 , the graph H2 ⋆H1 is a different embedding of H, and hence the σ-types of H1 ⋆H2 and H2 ⋆ H1 both belong to Kσ (H). This remark is also true for Kπ (H) and Kδ (H). Thus, the operator ⋆ defined on Γ1 and Γ2 is trivially commutative by its definition. For later reference, we state this in the following lemma. Lemma 5.1. If Γ1 and Γ2 are two subsets of Γ, then Γ1 ⋆ Γ2 = Γ2 ⋆ Γ1 . For each σi ∈ Σ and each δj ∈ ∆, the (i, j)-entry of Table 5.1 contains all δk ∈ {σi } ⋆ {δj }. For each πi ∈ Π and each σj ∈ Σ, the (i, j)-entry of Table 5.2 contains all πk ∈ {πi } ⋆ {σj }. For each πi ∈ Π and each πj ∈ Π, the (i, j)-entry of Table 5.3 contains all δk ∈ {πi } ⋆ {πj }. These tables can be verified by inspecting the representative graphs in Figures 4.2, 5.1, and 5.2. As examples, we verify one entry from each of Tables 5.1, 5.2, and 5.3. They are shown in Figure 5.3. In each case, two representative graphs are composed in series by identifying the common pole v. The type of the resulting graph is shown in the figure. Suppose that H = H1 ⋆ H2 ⋆ · · · ⋆ Hk and that Kσ (Hi ), Kπ (Hi ), and Kδ (Hi ) have already been computed for all i ∈ {1, . . . , k}. Our goal is to calculate Kσ (H), Kπ (H), and Kδ (H) for the series composition H. Kσ (H) can be computed as in section 4.2. By definition, Kπ (H) contains all the π-types of all different embeddings of H. Essentially, this means that the computation of Kπ (H) requires the evaluation of all expressions consisting of one operand from some Kπ (Hi ) and one operand from each of Kσ (H1 ), . . . , Kσ (Hi−1 ), Kσ (Hi+1 ), . . . , Kσ (Hk ) connected by the operator ⋆. Although the operator ⋆ is commutative, it is not associative. This makes the calculation of Kπ (H) very complex. The calculation of Kδ (H) is even more complex. The rest of this subsection discusses how to perform these calculations. A ⋆-expression E, its value, and its operand multiset Op(E) are defined inductively as follows. Each γ ∈ Γ is a ⋆-expression, its value is {γ}, and its operand multiset is hγi. Each (possibly empty) Γ1 ⊆ Γ is a ⋆-expression, its value is Γ1 , and its operand multiset is hΓ1 i. If E1 and E2 are ⋆-expressions, then (E1 ⋆ E2 ) is a ⋆-expression, its operand multiset is Op(E1 ) ∪ Op(E2 ), and its value is (Γ1 ⋆ Γ2 ), where Γ1 and Γ2 are the value of E1 and E2 , respectively. We identify a ⋆-expression with its value. For a list (X1 , . . . , Xk ) of elements or subsets of Γ, let X1 ⋆X2 ⋆· · ·⋆Xk denote the ⋆-expression (· · · ((X1 ⋆X2 )⋆X3 )⋆· · · Xk ). For a subset Γ1 of Γ and a list L = (σi1 , . . . , σik ) of σ-types, let Γ1 ⋆ [L]⋆ denote the ⋆-expression Γ1 ⋆ σi1 ⋆ · · · ⋆ σik if k ≥ 1; and denote Γ1 otherwise. For a σi ∈ Σ and a nonnegative integer k, let σik denote the list of k σi ’s.

1270

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG Table 5.1 {σi } ⋆ {δj }. δ1 σ1 σ2 σ3 σ4 σ5

δ2 δ3

δ3 δ2

δ2

δ3

δ4

δ0 , δ4

δ1

δ4

δ5

δ6

δ1

δ1

δ4 δ5

δ4 δ6

Table 5.2 {πi } ⋆ {σj }.

π1 π2 π3 π4

σ1 π1 π3 π2 π4

σ2 π4 π1 π1

σ3 π1 π2 π3 π4

σ4

σ5

π4 π4

π2 π3 π4

Table 5.3 {πi } ⋆ {πj }.

π1 π2 π3 π4

π1 δ0 , δ2 , δ3 δ1 δ1

π2 δ1 δ3 , δ5 δ2 , δ6 δ2 , δ3 , δ4

π3 δ1 δ2 , δ6 δ3 , δ5 δ2 , δ3 , δ4

π4 δ2 , δ3 , δ4 δ2 , δ3 , δ4

The parse tree TE of a ⋆-expression E is defined inductively as follows. If |Op(E)| = 1, then TE consists of a single node labeled with the unique element of Op(E). If E = (E1 ⋆ E2 ), then TE is obtained from the parse tree TE1 of E1 and the parse tree TE2 of E2 by introducing a new node r and letting the roots of TE1 and TE2 be the children of r. For convenience, each node v in a parse tree TE is viewed as an ancestor of v itself in TE . Lemma 5.2. Suppose ∆1 ⊆ ∆. Let L = (σi1 , . . . , σiq ) be a list of σ-types. Then, the following two statements hold: 1. For every ⋆-expression E with Op(E) = hσi1 , . . . , σiq , ∆1 i, if σ2 is not in L, then E ⊆ ∆1 ⋆ [L]⋆ ; otherwise, E ⊆ ∆1 ⋆ [L − {σ5 }]⋆ . 2. Let U be the union of the values of all ⋆-expressions E with Op(E) = hσi1 , . . . , σiq , ∆1 i. If σ2 is not in L, then U = ∆1 ⋆[L]⋆ ; otherwise, U = ∆1 ⋆[L−{σ5 }]⋆ . Proof. We prove the two statements separately as follows. Statement 1. First, we claim that if σi and σj are (possibly the same) elements of Σ with {σi , σj } 6= {σ2 , σ5 }, then ∆1 ⋆ (σi ⋆ σj ) ⊆ ∆1 ⋆ σi ⋆ σj = ∆1 ⋆ σj ⋆ σi . One may verify this claim using Tables 4.1 and 5.1, under the assumption that |∆1 | = 1. This claim then holds for every ∆1 ⊆ ∆. Second, we claim that (∆1 ⋆σ5 ⋆σ2 )∪(∆1 ⋆σ2 ⋆σ5 ) ⊆ ∆1 ⋆(σ5 ⋆σ2 ) = ∆1 ⋆σ2 . One may verify this claim using Tables 4.1 and 5.1, under the assumption that |∆1 | = 1. This claim then holds for every ∆1 ⊆ ∆. Third, we claim that for every nonempty list L of σ-types and every permutation L′ of L, if σ2 is not in L, then ∆1 ⋆ [L′ ]⋆ ⊆ ∆1 ⋆ [L]⋆ ; otherwise, ∆1 ⋆ [L′ ]⋆ ⊆ ∆1 ⋆ [L − {σ5 }]⋆ . This is shown by induction on the number q of elements of L as follows. The claim trivially holds when q = 1. Let q ≥ 2 and L = (σi1 , . . . , σiq )

1271

DOUBLE EULER TRAILS OF PLANAR GRAPHS

R(σ ) 2

R(σ3) et

et

R ( π2 ) P

2

es

P 2

R(δ ) 5

R (π3 )

es es P 1 (1)

P

et 3

P 1

R (π3 )

R ( π2 ) (2)

es R (π3 ) P1

P 2 (3)

(4)

Fig. 5.3. (1) σ2 ⋆ δ5 = δ1 ; (2) π3 ⋆ σ3 = π3 ; (3) π2 ⋆ π3 = δ2 ; (4) π2 ⋆ π3 = δ6 .

be a list of σ-types. Let L′ = (σj1 , . . . , σjq ) be a permutation of L. If σ5 or σ2 does not occur in L, then, by the first claim, ∆1 ⋆ [L′ ]⋆ ⊆ ∆1 ⋆ [L]⋆ . So, suppose that both σ5 and σ2 occur in L. Consider a sublist (σjk , σjk+1 , . . . , σjℓ ) of L′ such that {σjk , σjℓ } = {σ5 , σ2 } and {σ5 , σ2 } ∩ {σjk+1 , . . . , σjℓ−1 } = ∅. By the first claim, ∆1 ⋆ [L′ ]⋆ = ∆1 ⋆ σj1 ⋆ · · · ⋆ σjk ⋆ σjℓ ⋆ σjk+1 ⋆ · · · ⋆ σjℓ−1 ⋆ σjℓ+1 ⋆ · · · ⋆ σjq . This together with the second claim implies that ∆1 ⋆ [L′ ]⋆ ⊆ ∆1 ⋆ σj1 ⋆ · · · ⋆ σjk−1 ⋆ σ2 ⋆ σjk+1 ⋆ · · · ⋆ σjℓ−1 ⋆ σjℓ+1 ⋆ · · · ⋆ σjq . Now, the third claim follows from the inductive hypothesis. Let L and E be as described in the lemma. Let TE be the parse tree of E, and let v be the leaf node labeled with ∆1 . Let v, u1 , . . . , um be the path from v to the root of TE . For each i ∈ {1, . . . , m}, let Ei be the ⋆-expression whose parse tree is the subtree of TE rooted at the child of ui that is not an ancestor of v. Then, E = ∆1 ⋆E1 ⋆· · ·⋆Em . Define E1′ = σj1 ⋆· · ·⋆σja , where hσj1 , . . . , σja i equals Op(E1 ) if σ2 is not in Op(E1 ), while it equals Op(E1 )−{σ5 } otherwise. Define E2′ = σk1 ⋆· · ·⋆σkb , ′ = σℓ1 ⋆ · · · ⋆ σℓc similarly. Since operator ⋆ is commutative and associative . . . , Em over Σ (by Lemma 4.2) and σ5 ⋆σ2 = σ2 , we have Ei = Ei′ for all i ∈ {1, . . . , m}. Thus, ′ E = ∆1 ⋆E1′ ⋆· · ·⋆Em . By Table 4.1, if two elements σg and σh of Σ satisfy σg ⋆σh = σ2 , then σ2 ∈ {σg , σh }; similarly, if two elements σg and σh of Σ satisfy σg ⋆ σh = σ5 , then σg = σh = σ5 . By this fact, for every i ∈ {1, . . . , m}, if σ2 (respectively, σ5 ) is not in Op(Ei′ ), then σ2 (respectively, σ5 ) does not result when we evaluate Ei′ from left to right. Thus, by the first claim, E ⊆ ∆1 ⋆σj1 ⋆· · ·⋆σja ⋆σk1 ⋆· · ·⋆σkb ⋆· · ·⋆σℓ1 ⋆· · ·⋆σℓc . Now, by the third claim, statement 1 holds. Statement 2. First suppose that σ2 is not in L. Then, by statement 1, U ⊆ ∆1 ⋆ [L]⋆ . On the other hand, ∆1 ⋆ [L]⋆ ⊆ U because ∆1 ⋆ [L]⋆ is a ⋆-expression whose operand multiset is hσi1 , . . . , σiq , ∆1 i. So, U = ∆1 ⋆ [L]⋆ . Next, suppose that σ2 is in L. Then, by statement 1, U ⊆ ∆1 ⋆ [L − {σ5 }]⋆ . On the other hand, we can modify the ⋆-expression ∆1 ⋆ [L − {σ5 }]⋆ by replacing one appearance of σ2 with (σ2 ⋆ σ5 ⋆ · · · ⋆ σ5 ) in which σ5 appears as many times as in L. The resulting ⋆-expression has the same value as ∆1 ⋆ [L − {σ5 }]⋆ , since σ2 ⋆ σ5 = σ2 , and is a ⋆-expression whose operand multiset is hσi1 , . . . , σiq , ∆1 i. So, ∆1 ⋆ [L − {σ5 }]⋆ ⊆ U . This completes the proof of statement 2. Lemma 5.2 still holds after replacing each appearance of “∆” in it with “Π,” as stated in the following. Lemma 5.3. Suppose Π1 ⊆ Π. Let L = (σi1 , . . . , σiq ) be a list of σ-types. Then, the following two statements hold: 1. For every ⋆-expression E with Op(E) = hσi1 , . . . , σiq , Π1 i, if σ2 is not in L,

1272

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

then E ⊆ Π1 ⋆ [L]⋆ ; otherwise, E ⊆ Π1 ⋆ [L − {σ5 }]⋆ . 2. Let U be the union of the values of all ⋆-expressions E with Op(E) = hσi1 , . . . , σiq , Π1 i. If σ2 is not in L, then U = Π1 ⋆[L]⋆ ; otherwise, U = Π1 ⋆[L−{σ5 }]⋆ . Proof. It suffices to modify the proof of Lemma 5.2 by replacing each appearance of “∆” with “Π” and “Table 5.1” with “Table 5.2.” Lemma 5.4. Suppose that Π1 ⊆ Π and Π2 ⊆ Π. Then, for every σ ∈ {σ1 , σ3 , σ4 }, Π1 ⋆ Π2 ⋆ σ = Π2 ⋆ Π1 ⋆ σ ⊆ Π1 ⋆ σ ⋆ Π2 = Π1 ⋆ (σ ⋆ Π2 ) = Π1 ⋆ (Π2 ⋆ σ). Proof. One may verify the lemma using Tables 5.1, 5.2, and 5.3, under the assumption that |Π1 | = |Π2 | = 1. This then implies the lemma for every Π1 ⊆ Π and every Π2 ⊆ Π. Lemma 5.5. Suppose that Π1 ⊆ Π and Π2 ⊆ Π. Let L = (σi1 , . . . , σiq ) be a list of σ-types. Let q2 and q5 be the number of appearances of σ2 and σ5 in L, respectively. Let L′ = L − {σ2 , σ5 }. Then, the following two statements hold: 1. For every ⋆-expression E with Op(E) = hσi1 , . . . , σiq , Π1 , Π2 i, if q2 ≥ 7, then E = ∅; otherwise, E ⊆ ∪(a,b,c,d,h,k) (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers such that (1) a + c + h = q2 ; (2) b ≤ 1, d ≤ 1, k ≤ 1, and b + d + k ≤ q5 ; (3) if a ≥ 1, then b = 0; (4) if c ≥ 1, then d = 0; (5) if h ≥ 1, then k = 0; and (6) if q2 = 0, then b + d + k ≥ min{1, q5 }. 2. Let U be the union of the values of all ⋆-expressions E with Op(E) = hσi1 , . . . , σiq , Π1 , Π2 i. If q2 ≥ 7, then U = ∅; otherwise, U = ∪(a,b,c,d,h,k) (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆[σ5b ]⋆ )⋆(Π2 ⋆[σ2c ]⋆ ⋆[σ5d ]⋆ )⋆[σ2h ]⋆ ⋆[σ5k ]⋆ , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers that satisfy the conditions (1) through (6) in statement 1. Proof. We prove the two statements separately as follows. Statement 1. Let TE be the parse tree of E, v1 be the leaf node of TE labeled with Π1 , v2 be the leaf node of TE labeled with Π2 , and w be the lowest common ancestor of v1 and v2 in TE . Let v1 , u1 , . . . , uℓ , w be the path from v1 to w in TE . Similarly, let v2 , uℓ+1 , . . . , up , w be the path from v2 to w in TE . Let w, up+1 , . . . , ur be the path from w to the root of TE . For each i ∈ {1, . . . , r}, let Ei be the ⋆-expression whose parse tree is the subtree of TE rooted at the child of ui that is neither an ancestor of v1 nor an ancestor of v2 . Then, E = (Π1 ⋆E1 ⋆· · ·⋆Eℓ )⋆(Π2 ⋆Eℓ+1 ⋆· · ·⋆Ep )⋆Ep+1 ⋆· · ·⋆Er . Suppose that ∪1≤x≤ℓ Op(Ex ) = hσj1 , . . . , σjf i, ∪ℓ+1≤x≤p Op(Ex ) = hσjf +1 , . . . , σjg i, and ∪p+1≤x≤r Op(Ex ) = hσjg+1 , . . . , σjq i. Let L1 be the list (σj1 , . . . , σjf ), L2 be the list (σjf +1 , . . . , σjg ), and L3 be the list (σjg+1 , . . . , σjq ). If σ2 is not in L1 , then let L′1 = L1 ; otherwise, let L′1 = L1 − {σ5 }. Similarly, L′2 and L′3 are defined from L2 and L3 , respectively. Then, by statement 1 in Lemma 5.2 and statement 1 in Lemma 5.3, E ⊆ (Π1 ⋆ [L′1 ]⋆ ) ⋆ (Π2 ⋆ [L′2 ]⋆ ) ⋆ [L′3 ]⋆ = (Π1 ⋆ [L′1 ]⋆ ) ⋆ (Π2 ⋆ [L′2 ]⋆ ) ⋆ [L′3 − {σ2 , σ5 }]⋆ ⋆ [L′3 − {σ1 , σ3 , σ4 }]⋆ . In turn, by Lemma 5.4, E ⊆ (Π1 ⋆ [L′1 ]⋆ ⋆ [L′3 − {σ2 , σ5 }]⋆ ) ⋆ (Π2 ⋆ [L′2 ]⋆ ) ⋆ [L′3 − {σ1 , σ3 , σ4 }]⋆ . So, by statement 1 in Lemma 5.3, E ⊆ (Π1 ⋆ [L′1 ]⋆ ⋆ [L′3 − {σ2 , σ5 }]⋆ ) ⋆ (Π2 ⋆ [L′2 − {σ1 , σ3 , σ4 }]⋆ ⋆ [L′2 − {σ2 , σ5 }]⋆ ) ⋆ [L′3 − {σ1 , σ3 , σ4 }]⋆ . In turn, by Lemma 5.4, E ⊆ (Π1 ⋆ [L′1 ]⋆ ⋆ [L′3 − {σ2 , σ5 }]⋆ ⋆ [L′2 − {σ2 , σ5 }]⋆ ) ⋆ (Π2 ⋆ [L′2 − {σ1 , σ3 , σ4 }]⋆ ) ⋆ [L′3 − {σ1 , σ3 , σ4 }]⋆ . Moreover, by statement 1 in Lemma 5.3, E ⊆ (Π1 ⋆[L′1 −{σ2 , σ5 }]⋆ ⋆[L′3 −{σ2 , σ5 }]⋆ ⋆[L′2 −{σ2 , σ5 }]⋆ ⋆[L′1 −{σ1 , σ3 , σ4 }]⋆ )⋆(Π2 ⋆ [L′2 −{σ1 , σ3 , σ4 }]⋆ )⋆[L′3 −{σ1 , σ3 , σ4 }]⋆ . Note that Op([L′ ]⋆ ) = Op([L′1 −{σ2 , σ5 }]⋆ )∪ Op([L′3 − {σ2 , σ5 }]⋆ ) ∪ Op([L′2 − {σ2 , σ5 }]⋆ ). Thus, by statement 1 in Lemma 5.3, E ⊆ (Π1 ⋆ [L′ ]⋆ ⋆ [L′1 − {σ1 , σ3 , σ4 }]⋆ ) ⋆ (Π2 ⋆ [L′2 − {σ1 , σ3 , σ4 }]⋆ ) ⋆ [L′3 − {σ1 , σ3 , σ4 }]⋆ . Let a (respectively, c and h) be the number of appearances of σ2 in L′1 (respectively, in L′2 and L′3 ). Let b (respectively, d and k) be the smaller of 1 and the number

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1273

of appearances of σ5 in L′1 (respectively, L′2 and L′3 ). By the definition of L′1 , L′2 , L′3 , the sextuple (a, b, c, d, h, k) satisfies the conditions (1) through (6) in the lemma. Note that for every π ∈ Π and every δ ∈ ∆, π ⋆ σ2 ⋆ σ2 ⋆ σ2 = ∅, δ ⋆ σ2 ⋆ σ2 ⋆ σ2 = ∅. If q2 ≥ 7, then at least one of a, c, h is ≥ 3 and hence E = ∅. Otherwise, since π ⋆ σ5 ⋆ σ5 = π ⋆ σ5 and δ ⋆ σ5 ⋆ σ5 = δ ⋆ σ5 for every π ∈ Π and every δ ∈ ∆, E ⊆ (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ . This completes the proof of statement 1. Statement 2. If q2 ≥ 7, then U = ∅ by statement 1. Next, suppose that q2 ≤ 6. Then, by statement 1, U ⊆ ∪(a,b,c,d,h,k) (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers that satisfy the conditions (1) through (6) in statement 1. On the other hand, if q2 = q5 = 0, then for each sextuple (a, b, c, d, h, k) satisfying the conditions (1) through (6) in statement 1, (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ is a ⋆-expression whose operand multiset is hσi1 , . . . , σiq , Π1 , Π2 i; and so (Π1 ⋆[L′ ]⋆ ⋆[σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ ⊆ U . If q2 ≥ 1 or q5 ≥ 1, then for each sextuple (a, b, c, d, h, k) satisfying the conditions (1) through (6) in statement 1, we can modify the ⋆-expression (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ either (i) by replacing one appearance of σ2 with (σ2 ⋆ σ5 ⋆ · · · ⋆ σ5 ) in which σ5 appears q5 − (b + d + k) times or (ii) by replacing one appearance of σ5 with (σ5 ⋆ · · · ⋆ σ5 ) in which σ5 appears q5 − (b + d + k) + 1 times. The resulting ⋆-expression has the same value as (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ , since σ2 ⋆ σ5 = σ2 and σ5 ⋆ σ5 = σ5 , and is a ⋆-expression whose operand multiset is hσi1 , . . . , σiq , Π1 , Π2 i. So, (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ ⊆ U . Consequently, ∪(a,b,c,d,h,k) (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ ⊆ U , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers that satisfy the conditions (1) through (6) in statement 1. This completes the proof of statement 2. 5.3. Parallel composition of DTCs. Let Γ1 = Σ1 ∪ Π1 ∪ ∆1 and Γ2 = Σ2 ∪ Π2 ∪ ∆2 be two subsets of Γ, where for i = 1, 2, Σi ⊆ Σ, Πi ⊆ Π, and ∆i ⊆ ∆. Define Γ1 ⋄ Γ2 = (∪σi ∈Σ1 ,σj ∈Σ2 Kσ (R(σi ) ⋄ R(σj ))) ∪ (∪σi ∈Σ1 ,πj ∈Π2 Kπ (R(σi ) ⋄ R(πj ))) ∪ (∪πi ∈Π1 ,σj ∈Σ2 Kπ (R(πi ) ⋄ R(σj ))) ∪ (∪σi ∈Σ1 ,δj ∈∆2 Kδ (R(σi ) ⋄ R(δj ))) ∪ (∪δi ∈∆1 ,σj ∈Σ2 Kδ (R(δi ) ⋄ R(σj ))) ∪ (∪πi ∈Π1 ,πj ∈Π2 Kδ (R(πi ) ⋄ R(πj ))). If Γ1 = ∅ or Γ2 = ∅, then Γ1 ⋄ Γ2 = ∅. As in the paragraph right before Lemma 5.1, we can argue that the operator ⋄ is commutative by its definition. For later reference, we state this in the following lemma. Lemma 5.6. If Γ1 and Γ2 are two subsets of Γ, then Γ1 ⋄ Γ2 = Γ2 ⋄ Γ1 . For each σi ∈ Σ and each δj ∈ ∆, the (i, j)-entry of Table 5.4 contains all δk ∈ {σi } ⋄ {δj }. For each πi ∈ Π and each σj ∈ Σ, the (i, j)-entry of Table 5.5 contains all πk ∈ {πi } ⋄ {σj }. For each πi ∈ Π and each πj ∈ Π, the (i, j)-entry of Table 5.6 contains all δk ∈ {πi } ⋄ {πj }. These tables can be verified by inspecting the graphs in Figures 4.2, 5.1, and 5.2. As examples, we verify one entry from each of the Tables 5.4, 5.5 and 5.6. They are shown in Figure 5.4. In each case, two representative graphs are composed in parallel by identifying their common poles. The type of the resulting graph is shown in the figure. By modifying the four paragraphs right before Lemma 5.2 by replacing each letter “⋆” with “⋄,” we can define a ⋄-expression E, its value, etc. Moreover, we can prove

1274

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG Table 5.4 {σi } ⋄ {δj }. δ1 δ3 δ1

σ1 σ2 σ3 σ4 σ5

δ2

δ3 δ1 δ3

δ0 , δ5 δ2

δ4

δ5

δ6

δ2 δ4 δ5

δ5

δ2 δ6 δ5

Table 5.5 {πi } ⋄ {σj }.

π1 π2 π3 π4

σ1 π1 π4 π3 π2

σ2 π1 π2 π3 π4

σ3 π3 π1 π1

σ4

σ5

π2 π3 π4

π3 π3

Table 5.6 {πi } ⋄ {πj }.

π1 π2 π3 π4

π1 δ0 , δ1 , δ3 δ2 δ2

π2 δ2 δ3 , δ4 δ1 , δ3 , δ5 δ1 , δ6

π3 δ1 , δ3 , δ5 δ1 , δ3 , δ5

π4 δ2 δ1 , δ6 δ1 , δ3 , δ5 δ3 , δ4

the following four lemmas, just via modifying the proofs of Lemmas 5.2 through 5.5 by replacing each appearance of “σ2 ,” “σ3 ,” “σ4 ,” “σ5 ,” “⋆,” “q2 ,” “q5 ,” “Table 5.1,” “Table 5.2,” and “Table 5.3” in them with “σ3 ,” “σ2 ,” “σ5 ,” “σ4 ,” “⋄,” “q3 ,” “q4 ,” “Table 5.4,” “Table 5.5,” and “Table 5.6,” respectively. We state these corresponding lemmas as follows. Lemma 5.7. Suppose ∆1 ⊆ ∆. Let L = (σi1 , . . . , σiq ) be a list of σ-types. Then, the following two statements hold: 1. For every ⋄-expression E with Op(E) = hσi1 , . . . , σiq , ∆1 i, if σ3 is not in L, then E ⊆ ∆1 ⋄ [L]⋄ ; otherwise, E ⊆ ∆1 ⋄ [L − {σ4 }]⋄ . 2. Let U be the union of the values of all ⋄-expressions E with Op(E) = hσi1 , . . . , σiq , ∆1 i. If σ3 is not in L, then U = ∆1 ⋄[L]⋄ ; otherwise, U = ∆1 ⋄[L−{σ4 }]⋄ . Lemma 5.8. Suppose Π1 ⊆ Π. Let L = (σi1 , . . . , σiq ) be a list of σ-types. Then, the following two statements hold: 1. For every ⋄-expression E with Op(E) = hσi1 , . . . , σiq , Π1 i, if σ3 is not in L, then E ⊆ Π1 ⋄ [L]⋄ ; otherwise, E ⊆ Π1 ⋄ [L − {σ4 }]⋄ . 2. Let U be the union of the values of all ⋄-expressions E with Op(E) = hσi1 , . . . , σiq , Π1 i. If σ3 is not in L, then U = Π1 ⋄[L]⋄ ; otherwise, U = Π1 ⋄[L−{σ4 }]⋄ . Lemma 5.9. Suppose that Π1 ⊆ Π and Π2 ⊆ Π. Then, for every σ ∈ {σ1 , σ2 , σ5 }, Π1 ⋄ Π2 ⋄ σ = Π2 ⋄ Π1 ⋄ σ ⊆ Π1 ⋄ σ ⋄ Π2 = Π1 ⋄ (σ ⋄ Π2 ) = Π1 ⋄ (Π2 ⋄ σ). Lemma 5.10. Suppose that Π1 ⊆ Π and Π2 ⊆ Π. Let L = (σi1 , . . . , σiq ) be a list of σ-types. Let q3 and q4 be the number of appearances of σ3 and σ4 in L, respectively. Let L′ = L − {σ3 , σ4 }. Then, the following two statements hold: 1. For every ⋄-expression E with Op(E) = hσi1 , . . . , σiq , Π1 , Π2 i, if q3 ≥ 7, then E = ∅; otherwise, E ⊆ ∪(a,b,c,d,h,k) (Π1 ⋄ [L′ ]⋄ ⋄ [σ3a ]⋄ ⋄ [σ4b ]⋄ ) ⋄ (Π2 ⋄ [σ3c ]⋄ ⋄ [σ4d ]⋄ ) ⋄ [σ3h ]⋄ ⋄ [σ4k ]⋄ , where (a, b, c, d, h, k) ranges over all sextuples of

1275

DOUBLE EULER TRAILS OF PLANAR GRAPHS

R(δ4 ) et

R ( π2) es e

s

P 2

P 1 (1)

R(σ4 )

R(σ ) 3

(2)

P 1

R ( π2) es

e

P 2

t

R (π4 ) (3)

P 2

es R (π4 )

et

P 1

P 3

R ( π2 ) (4)

Fig. 5.4. (1) σ3 ⋄ δ4 = δ2 ; (2) π2 ⋄ σ4 = π2 ; (3) π2 ⋄ π4 = δ1 ; (4) π2 ⋄ π4 = δ6 .

nonnegative integers such that (1) a + c + h = q3 ; (2) b ≤ 1, d ≤ 1, k ≤ 1, and b + d + k ≤ q4 ; (3) if a ≥ 1, then b = 0; (4) if c ≥ 1, then d = 0; (5) if h ≥ 1, then k = 0; and (6) if q3 = 0, then b + d + k ≥ min{1, q4 }. 2. Let U be the union of the values of all ⋄-expressions E with Op(E) = hσi1 , . . . , σiq , Π1 , Π2 i. If q3 ≥ 7, then U = ∅; otherwise, U = ∪(a,b,c,d,h,k) (Π1 ⋄ [L′ ]⋄ ⋄ [σ3a ]⋄ ⋄[σ4b ]⋄ )⋄(Π2 ⋄[σ3c ]⋄ ⋄[σ4d ]⋄ )⋄[σ3h ]⋄ ⋄[σ4k ]⋄ , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers that satisfy the conditions (1) through (6) in statement 1. 5.4. An O(|G|3 )-time algorithm. Let es and et be a pair of distinct edges of G. We want to decide whether G has a valid embedding that has a DET starting with es and ending with et . To do this, we process the nodes of T in post-order. For each node µ of T such that neither es nor et is in Pt(µ), we compute Kσ (Pt(µ)) as in section 4.3; we may assume that |Kσ (Pt(µ))| = 1 since otherwise no valid embedding of G has a DET starting with es and ending with et . For each Q-node µ such that Pt(µ) consists of es only or et only, we set Kπ (Pt(µ)) = {π1 }. Consider the processing of a non-Q-node µ such that es or et is in Pt(µ). Let ν1 , . . . , νr be the children of µ in T . Let B = Pt(µ). For each i ∈ {1, . . . , r}, let Bi = Pt(νi ), and ei be the virtual edge of νi in Sk(µ). • Case 1. B contains both es and et but no child of B does. Without loss of generality, we may assume that B1 contains es and B2 contains et . Then, none of B3 , . . . , Br contains es or et . Let Π1 = Kπ (B1 ) and Π2 = Kπ (B2 ). For each j ∈ {3, . . . , r}, let Kσ (Bj ) = {σℓj }. Let L be the list (σℓ3 , . . . , σℓr ). – Case 1.1. µ is an R-node. Then, Sk(µ) has no different embedding other than itself. Based on statements 1 and 2 in Lemma 3.2, we compute Kδ (B) as follows. We initialize Kδ (B) = ∅. After this, for each quadruple D = (πi1 , πi2 , G1 , G2 ) such that πi1 ∈ Kπ (B1 ), πi2 ∈ Kπ (B2 ), and G1 (respectively, G2 ) is obtained from R(πi1 ) (respectively, R(πi2 )) by horizontally and/or vertically flipping it, we first construct a TTG HD from Sk(µ) by replacing e1 with G1 , e2 with G2 , and ej with R(σℓj ) for all j ∈ {3, . . . , r}. We then obtain the maximal double trail P1 in HD such that (1) es and its dual edge e∗s are, respectively, the starting edge of P1 and its dual trail P1∗ and (2) the direction of es in P1 and that of e∗s in P1∗ are the same as oriented by the unique valid DTC of G1 . Similarly, we obtain the maximal double trail P2 in HD such that (1) et and its dual edge e∗t are, respectively, the starting edge of P2 and its dual trail P2∗ and (2) the direction of et in P2 and that of e∗t in P2∗ are the same as oriented by the unique valid DTC of G2 . Let P2′ be the

1276

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

reverse of P2 . Let M be the set of all edges of HD traversed by neither P1 nor P2 . Suppose M = ∅. If P1 and P2′ are distinct, we check if P1 and P2′ form a DTC of HD of a δ-type. If P1 and P2′ are the same, we check if P1 forms a DTC of HD of a δ-type. In both cases, if the condition is true, we add this δ-type to Kδ (B). Suppose that M 6= ∅ and P1 and P2 are edge-disjoint. We try to find an access edge e ∈ M such that e is incident to a pole u of HD and the ∗ . If such e exists, then dual edge e∗ of e is incident to a pole x of HD we obtain the maximal double trail P3 in HD such that (1) e and e∗ are, respectively, the starting edge of P3 and its dual trail P3∗ and (2) u and x are, respectively, the starting vertex of P3 and P3∗ . Note that the other endpoint of e (respectively, e∗ ) is not a pole of HD (respectively, ∗ ). If {P1 , P2′ , P3 } is a DTC of HD of a δ-type, we add this δ-type to HD Kδ (B). Similarly, if {P1 , P2′ , P3′ } is a DTC of HD of a δ-type, we add this δ-type to Kδ (B), where P3′ is the reverse of P3 . – Case 1.2. µ is an S-node. Let q2 and q5 be the number of appearances of σ2 and σ5 in L, respectively. Let L′ = L − {σ2 , σ5 }. By statement 2 in Lemma 5.5 and statements 1 and 2 in Lemma 3.2, if q2 ≥ 7, then Kδ (B) = ∅; otherwise, Kδ (B) = ∪(a,b,c,d,h,k) (Π1 ⋆ [L′ ]⋆ ⋆ [σ2a ]⋆ ⋆ [σ5b ]⋆ ) ⋆ (Π2 ⋆ [σ2c ]⋆ ⋆ [σ5d ]⋆ ) ⋆ [σ2h ]⋆ ⋆ [σ5k ]⋆ , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers that satisfy the conditions (1) through (6) in statement 1 in Lemma 5.5. – Case 1.3. µ is a P-node. Let q3 and q4 be the number of appearances of σ3 and σ4 in L, respectively. Let L′ = L − {σ3 , σ4 }. By statement 2 in Lemma 5.10 and statements 1 and 2 in Lemma 3.2, if q3 ≥ 7, then Kδ (B) = ∅; otherwise, Kδ (B) = ∪(a,b,c,d,h,k) (Π1 ⋄ [L′ ]⋄ ⋄ [σ3a ]⋄ ⋄ [σ4b ]⋄ ) ⋄ (Π2 ⋄ [σ3c ]⋄ ⋄ [σ4d ]⋄ ) ⋄ [σ3h ]⋄ ⋄ [σ4k ]⋄ , where (a, b, c, d, h, k) ranges over all sextuples of nonnegative integers that satisfy the conditions (1) through (6) in statement 1 in Lemma 5.10. • Case 2. B contains both es and et and so does one child block of B. Without loss of generality, we can assume that B1 contains both es and et . Then, none of B2 ,. . . , Br contains es or et . Let ∆1 = Kδ (B1 ) − {δ0 }. For each j ∈ {2, . . . , r}, let Kσ (Bj ) = {σℓj }. Let L be the list (σℓ2 , . . . , σℓr ). – Case 2.1. µ is an R-node. Then, based on statements 1 and 3 in Lemma 3.2, we compute Kδ (B) as follows. We initialize Kδ (B) = ∅. After this, for each pair D = (δi , G1 ) such that δi ∈ ∆1 and G1 is obtained from R(δi ) by horizontally and/or vertically flipping it, we first construct a TTG HD from Sk(µ) by replacing e1 with G1 and ej with R(σℓj ) for all j ∈ {2, . . . , r}. Similarly to Case 1.1, we then check if HD has a δ-type DTC; if it has, we add the δ-type of the DTC into Kδ (B). – Case 2.2. µ is an S-node. Then, by statement 2 in Lemma 5.2 and statements 1 and 3 in Lemma 3.2, if σ2 is not in L, then Kδ (B) = ∆1 ⋆ [L]⋆ ; otherwise, Kδ (B) = ∆1 ⋆ [L − {σ5 }]⋆ . – Case 2.3. µ is a P-node. Then, by statement 2 in Lemma 5.7 and statements 1 and 3 in Lemma 3.2, if σ3 is not in L, then Kδ (B) = ∆1 ⋄ [L]⋄ ; otherwise, Kδ (B) = ∆1 ⋄ [L − {σ4 }]⋄ . • Case 3. B contains one of es and et . We assume that B contains es ; the other case is similar. Without loss of generality, we can assume that B1 contains es . Then, none of B2 , . . . , Br contains es or et . Let Π1 = Kπ (B1 ). For each

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1277

j ∈ {2, . . . , r}, let Kσ (Bj ) = {σℓj }. Let L be the list (σℓ2 , . . . , σℓr ). – Case 3.1. µ is an R-node. Then, based on statements 1 and 2 in Lemma 3.2, we compute Kπ (B) as follows. We initialize Kπ (B) = ∅. After this, for each pair D = (πi , G1 ) such that πi ∈ Π1 and G1 is obtained from R(πi ) by horizontally and/or vertically flipping it, we first construct a TTG HD from Sk(µ) by replacing e1 with G1 and ej with R(σℓj ) for all j ∈ {2, . . . , r}. Similarly to Case 1.1, we then check if HD has a π-type DTC; if it has, we add the π-type of the DTC into Kπ (B). – Case 3.2. µ is an S-node. Then, by statement 2 in Lemma 5.3 and statements 1 and 2 in Lemma 3.2, if σ2 is not in L, then Kπ (B) = Π1 ⋆ [L]⋆ ; otherwise, Kπ (B) = Π1 ⋆ [L − {σ5 }]⋆ . – Case 3.3. µ is a P-node. Then, by statement 2 in Lemma 5.8 and statements 1 and 2 in Lemma 3.2, if σ3 is not in L, then Kπ (B) = Π1 ⋄ [L]⋄ ; otherwise, Kπ (B) = Π1 ⋄ [L − {σ4 }]⋄ . By the above discussions, it takes O(|Sk(µ)|) time to process µ. Thus, by Lemma 2.1, the time needed to compute Kδ (G) is O(|G|). Note that G has a DET starting with es and ending with et if and only if δ0 ∈ Kδ (G). Thus, by trying all pairs (es , et ) of edges of G, we can decide in O(|G|3 ) time whether G has a DET. Theorem 5.11. Given a TTG G, it takes O(|G|3 ) time to decide if G has a valid embedding. 6. An O(|G|)-time algorithm. This section refines the algorithm in section 5.4. The basic idea is that we do not specify the starting and the ending edges in advance. Rather, we try to discover them when processing T in post-order. Throughout this section, we assume that G∗ is not Eulerian; the case where G is not Eulerian is similar. Let T ∗ be the dual decomposition tree of T . First, we need some definitions and lemmas. Recall that the degree parity of a vertex in G is 0 if its degree is even and is 1 otherwise. The pole-parity multiset MG of G consists of the degree parities of the poles of G. The pole-status of G is the pair (MG , MG∗ ), where MG and MG∗ are the pole-parity multiset of G and G∗ , respectively. G is E-good if it is Eulerian. G is O-good if its odd-degree vertices are just its poles. G is good if it is either E- or O-good. G is bad if it has at least one odd-degree nonpole. A node µ of T is E-good (respectively, O-good, good, or bad) if all different embeddings of Pt(µ) are E-good (respectively, O-good, good, or bad). Lemma 6.1. Let µ be a node of T . Let B = Pt(µ). Then, exactly one of the following (1) through (3) holds: (1) µ is E-good; (2) µ is O-good; (3) µ is bad. Moreover, for all descendants ν (including µ itself ) of µ in T , it takes O(|B|) total time to (a) decide whether ν is E-good, O-good, or bad, and (b) compute the pole-parity multiset of Pt(ν) when ν is good. Proof. The proof is by induction. In case µ is a leaf node of T , B is a single edge; hence, µ is O-good. Next, suppose that µ is a nonleaf node. Let ν1 , . . . , νq be the children of µ in T . For each i ∈ {1, . . . , q}, let Bi = Pt(νi ) and ei be the virtual edge of νi in Sk(µ). If some child of µ is bad, then µ must be bad. So, assume that no child of µ is bad. By the inductive hypothesis, each child of µ is either E- or O-good. Let B be an (arbitrary) different embedding of B. For each i ∈ {1, . . . , q}, let Bi be the child block of B that is a different embedding of Bi . For the purpose of deciding whether B is E-good, O-good, or bad, we may assume that Bi = Bi for all i ∈ {1, . . . , q} because

1278

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

Bi is E-good (respectively, O-good) if and only if Bi is too. Case 1. µ is a P-node. Then, B can be obtained from B by permuting the children of µ. Permuting the children of µ does not change the degree parity of any vertex in B. Thus, if an odd (respectively, even) number of children of µ is O-good, µ is O-good (respectively, E-good). Case 2. µ is an S-node. Then, B can be obtained from B by permuting the children of µ. When every child of µ is E-good, permuting the children of µ does not change the degree parity of any vertex in B, and hence B is E-good and so is µ. Similarly, when every child of µ is O-good, µ is O-good. So, suppose that µ has both E-good children and O-good children. Then, some E-good Bi must be next to an O-good Bj in B. The common pole of Bi and Bj in B has odd degree. Thus, B is bad and so is µ. Case 3. µ is an R-node. Then, Sk(µ) has no different embedding other than itself. B is obtained from Sk(µ) by replacing ei with Bi for all i ∈ {1, . . . , q}. Note that the edges of Sk(µ) are just e1 , . . . , eq . For all i ∈ {1, . . . , q}, we mark ei if νi is O-good. If some nonpole in Sk(µ) is incident to an odd number of marked edges, then µ is bad. Otherwise, if a pole of Sk(µ) is incident to an odd number of marked edges, then µ is O-good; otherwise, µ is E-good. Next we describe the implementation of this procedure. Let Tµ be the subtree of T rooted at the node µ. We perform a post-order computation on Tµ . Each leaf node ν is an O-good node, and both poles of Pt(ν) have odd parity. For each internal node ν in Tµ , whether ν is E-good, O-good, or bad, the pole-parity multiset of Pt(ν) can be determined as in the three cases above, in at most O(|Sk(ν))| time. Thus, the total time needed is O(|B|) by Lemma 2.1. By Lemma 2.2, each node of T is also a node of the dual decomposition tree T ∗ of T . A node µ of T ∗ is E-good (respectively, O-good, good, or bad) if all different embeddings of the dual graph of Pt(µ) are E-good (respectively, O-good, good, or bad). Lemma 6.1 still holds after changing T to T ∗ , Pt(µ) to its dual graph, and Pt(ν) to its dual graph. Let µ be a node of T and B = Pt(µ). µ is doubly good if for every different embedding B of B, neither B nor B ∗ has an odd-degree nonpole. µ is doubly bad if for every different embedding B of B, B or B ∗ has at least one odd-degree nonpole. By Lemma 6.1, µ is either doubly good or doubly bad. µ is critical if (1) all children of µ are doubly good and (2) µ is doubly bad or is the root of T . Lemma 6.2. If G has a valid embedding, then either one or two nodes of T are critical. Proof. Note that each leaf node of T is doubly good. Thus, at least one node of T is critical. If the root of T is critical, then all nodes of T except the root must be doubly good and the root is the unique critical node. Otherwise, let µ1 , . . . , µk be the critical nodes in T and Bi = Pt(µi ). By the definition of critical nodes, none of µ1 , . . . , µk can be an ancestor of another. Thus, no two of B1 , . . . , Bk share an edge. On the other hand, for each i ∈ {1, . . . , k}, either Bi or Bi∗ has an odd-degree nonpole; any DET of G must start or end with an edge in Bi . Therefore, if k ≥ 3, G cannot have a DET. Lemma 6.3. Let µ be a doubly bad node of T , and let B = Pt(µ). Then, all different embeddings B of B such that B has a π-type DTC have the same pole-status p, which can be computed as follows: 1. If µ is an E-good node of T , then p = (h0, 0i, h0, 1i). 2. If µ is an O-good node of T , then p = (h1, 1i, h0, 1i).

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1279

3. If µ is an E-good node of T ∗ , then p = (h0, 1i, h0, 0i). 4. If µ is an O-good node of T ∗ , then p = (h0, 1i, h1, 1i). 5. If µ is a bad node of both T and T ∗ , then p = (h0, 1i, h0, 1i). Proof. Suppose that a different embedding B of B has a π-type DTC. Then, both B and B ∗ have at most one odd-degree nonpole (see Figure 5.1). Indeed, at least one of B and B ∗ has exactly one odd-degree nonpole because µ is doubly bad. If µ is a bad node of T , then the pole-parity multiset of B is h0, 1i. On the other hand, by Lemma 6.1, if µ is an E-good (respectively, O-good) node of T , then the pole-parity multiset of B is h0, 0i (respectively, h1, 1i). Similarly, by checking whether µ is a good node of T ∗ , we can decide the pole-parity multiset of B ∗ . Let B = Pt(µ), where µ is a nonroot node of T . A π- or δ-type γ of B is useful if some valid embedding G of G has a DET P such that P ∩ B is of Type γ, where B is the block of G that is a different embedding of B. Even for a doubly good node µ, the block B = Pt(µ) might contain the starting edge es and/or the ending edge et of a DET of a valid embedding of G (when es and/or et is incident to a pole of B). Thus, a σ-type of B might actually be a π- or δ-type. In the following, we investigate which σ-type can be mapped to which π- or δ-type. The mapping from σ-types to π-types is specified by the following function: f : {1, . . . , 5} → {1, . . . , 4}, where f (1) = f (2) = f (3) = 1, f (4) = 4, and f (5) = 3. Lemma 6.4. Let µ be a doubly good nonroot node of T . Let B = Pt(µ). Suppose that πj is a useful π-type of B. Then, Kσ (B) = {σi } for some σi ∈ Σ, and πj = πf (i) . Proof. Suppose that a DET P of a valid embedding G of G starts with an edge es of B but ends with an edge not in B, where B is the block of G that is a different embedding of B. Let P ∗ be the dual trail of P . Since µ is doubly good, neither B nor B ∗ has an odd-degree nonpole. Moreover, since G∗ is not Eulerian, P ∗ must start at an odd-degree vertex of B ∗ by Facts 1 and 2. Thus, P ∗ starts at a pole of B ∗ . On the other hand, P starts at a pole of B. This is because of the following: (1) If G is Eulerian, P starts and ends at the same vertex of B. Since es is in B and the ending edge et is not in B, their common end vertex must be a pole of B. (2) If G is not Eulerian, P starts at an odd-degree vertex of B by Facts 1 and 2. By these facts, P ∩ B is of a σ-type; this type is unique by Lemma 4.4. Let σi be this type. To determine the π-type of P ∩ B, we first note that if P ∩ B is of Type σ1 , σ2 , or σ3 , then P ∩ B consists of a single trail and hence can be only of Type π1 . Thus, π1 = πf (i) for i = 1, 2, 3. Now, suppose that P ∩ B is of Type σ4 . Then, P ∩ B consists of two double trails P1 and P2 , where P1 starts with es . Moreover, P1 starts and ends at the same pole of B, and so does P2 ; the dual trail P1∗ of P1 starts and ends at different poles of B ∗ , and so does the dual trail P2∗ of P2 . Thus, P ∩ B is of Type π4 . On the other hand, P ∩ B is not of Type π1 because P ∩ B consists of two double trails; P ∩ B is not of Type π2 or π3 either because P2 starts and ends at the same pole of B. Therefore, π4 = πf (4) . Similarly, we can verify that π3 = πf (5) . The mapping from σ-types to δ-types is specified by the following function: g : {1, 2, 3, 5} → {1, . . . , 4}, where g(1) = 2, g(2) = 4, g(3) = 3, and g(5) = 1. Lemma 6.5. Suppose that G is Eulerian. Let µ be a doubly good nonroot node of T . Let B = Pt(µ). Suppose that δj is a useful δ-type of B. Then, the following two statements hold: 1. If µ is not an S-node, then Kσ (B) = {σ5 } and δj = δg(5) .

1280

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

2. If µ is an S-node, then Kσ (B) = {σi } for some σi ∈ {σ1 , σ2 , σ3 } and δj = δg(i) . Proof. Suppose that a DET P of a valid embedding G of G starts with an edge es of B and ends with an edge et of B, where B is the block of G that is a different embedding of B. Let P ∗ be the dual trail of P . Since G is Eulerian but G∗ is not, P starts and ends at the same vertex of B (say, v) while P ∗ starts and ends at different vertices of B ∗ , by Facts 1 and 2. Both es and et are incident to v. Case 1. v is a pole of B. Then, since µ is doubly good, P ∗ starts at one pole of ∗ 6 G, B and ends at the other pole. Thus, P ∩ B is of a σ-type. Moreover, since B = P ∩ B contains more than one trail (otherwise, the single trail in P ∩ B would be the entire DET P ). Hence, P ∩ B is of Type σ4 or σ5 . Indeed, it is not of Type σ4 because P starts and ends at the same vertex. Thus, P ∩ B is of Type σ5 and hence consists of two double trails P1 and P2 , where P1 starts with es and P2 ends with et . To determine the δ-type of P ∩ B, we note that P1 starts at v and ends at the other pole u of B while P2 starts at u and ends at v. Moreover, since P ∩ B = (P1 , P2 ) is of Type σ5 , the dual trail P1∗ of P1 starts and ends at the same pole x of B ∗ while the dual trail P2∗ of P2 starts and ends at the other pole y of B ∗ . Thus, P ∩ B is of Type δ1 . On the other hand, P ∩B is not of Type δ4 , δ5 or δ6 because P ∩B consists of only two double trails. Moreover, P ∩ B is not of Type δ2 because the ending pole of P1∗ is different from the starting pole of P2∗ . Similarly, P ∩ B is not of Type δ3 because the ending pole of P1 is the same as the starting pole of P2 . Therefore, δ1 = δg(5) . Case 2. v is not a pole of B. Then, since P ∗ starts at one pole of B ∗ and ends at the other pole, one of es and et is on the west side of B and the other is on the east side. Thus, v is a cut vertex of B and µ is an S-node. Let B1 (respectively, B2 ) be the block of B whose source (respectively, sink) is that of B and whose sink (respectively, source) is v. Then, B = B1 ⋆ B2 . Since B ∗ is good, neither B1∗ nor B2∗ has an odd-degree nonpole. We assume that es is on the west side of B1 ; the other cases are similar. Case 2.1. B1 contains et . Then, et is on the east side of B1 . Moreover, P ∗ starts at the source of B1∗ and ends at the sink of B1∗ , by Facts 1 and 2. As in Case 1, we can prove that P ∩ B1 is of Type σ5 and hence consists of two double trails P1 and P3 , where P1 starts with es and P3 ends with et . On the other hand, P ∩ B2 must start at the sink of B2 and can leave B2 only at its sink; so, P ∩ B2 consists of a single trail P2 and is of Type σ2 . Consequently, P ∩ B is of Type σ5 ⋆ σ2 = σ2 by Table 4.1. To determine the δ-type of P ∩ B, we note that P1 starts at v and ends at the other pole u of B1 while P3 starts at u and ends at v. Moreover, P2 starts at the pole w 6= v of B2 and ends at w. Since u, v, w are three distinct vertices of B, no two of the trails P1 through P3 can be concatenated into a single trail in P ∩ B. So, P ∩ B = (P1 , P2 , P3 ) because P1 starts with es and P3 ends with et . In turn, P ∩ B is of Type δ4 . On the other hand, P ∩ B is not of Type δ1 , δ2 , or δ3 because P ∩ B consists of three trails; P ∩ B is not of Type δ5 or δ6 because P2 starts and ends at the same vertex of B. Therefore, δ4 = δg(2) . Case 2.2. B1 does not contain et . Then, et is on the east side of B2 . Moreover, by Facts 1 and 2, P ∗ starts at the source of B1∗ and ends at the sink of B2∗ . By this and the fact that P starts and ends at the common pole v of B1 and B2 , P ∩ B1 must start at v and cannot reenter B1 after leaving it, while P ∩ B2 must start at the sink of B2 and cannot leave B2 after entering it. Consequently, P ∩ B1 consists of a single double trail P1 , and P ∩ B2 consists of a single double trail P2 too. So, both P ∩ B1 and P ∩ B2 are of Type π1 . In turn, P ∩ B = (P1 , P2 ) is of Type δ2 or δ3 by

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1281

Table 5.3; P ∩ B cannot be of Type δ0 or else B could not have been a proper block of G. Moreover, each of P1 and P2 starts and ends at different vertices; so each of P ∩ B1 and P ∩ B2 is of Type σ1 or σ3 . Suppose that one of P ∩ B1 and P ∩ B2 is of Type σ1 and the other is of Type σ3 . We assume that P ∩ B1 is of Type σ1 and P ∩ B2 is of Type σ3 ; the other case is similar. Then, the unique σ-type of B is σ1 ⋆ σ3 = σ1 by Table 4.1. Note that the starting vertex of P ∗ (which is also the starting vertex of the dual trail P1∗ of P1 ) and the ending vertex of P ∗ (which is also the ending vertex of the dual trail P2∗ of P2 ) are different vertices in G∗ . Since P ∩ B1 = (P1 ) is of Type σ1 , the starting and the ending vertices of P1∗ must be different. On the other hand, since P ∩ B2 = (P2 ) is of Type σ3 , the starting and the ending vertices of P2∗ must be the same. These requirements together imply that the ending vertex of P1∗ and the starting vertex of P2∗ must be the same pole of B ∗ . Therefore, the ODTC P ∩ B = (P1 , P2 ) is not of Type δ3 but is of Type δ2 . So, δ2 = δg(1) . Suppose that both of P ∩ B1 and P ∩ B2 are of Type σ1 or both of them are of Type σ3 . Then, the unique σ-type of B is σ3 by Table 4.1. Similarly to the above case where P ∩ B1 and P ∩ B2 are of different σ-types, we can prove that the ending vertex of the dual trail P1∗ of P1 and the starting vertex of the dual trail P2∗ of P2 must be different poles of B ∗ . Hence, the ODTC P ∩ B = (P1 , P2 ) is not of Type δ2 but is of Type δ3 . So, δ3 = δg(3) . Lemma 6.6. Suppose that G is not Eulerian. Let µ be a doubly good nonroot node of T . Let B = Pt(µ). Suppose that δj is a useful δ-type of B. Then, Kσ (B) equals {σ4 } or {σ5 } and δj = δ3 . Proof. Suppose that a DET P of a valid embedding G of G starts with an edge es of B and ends with an edge et of B, where B is the block of G that is a different embedding of B. Let P ∗ be the dual trail of P . Since B is a proper block of G, P ∩ B consists of at least two trails P1 and P2 , where P1 starts with es and P2 ends with et . Since µ is doubly good, neither B nor B ∗ has an odd-degree nonpole. By Facts 1 and 2, P starts at a pole of B and ends at the other pole of B, and P ∗ starts at a pole of B ∗ and ends at the other pole of B ∗ . So, both es and et are access edges of B. In turn, each of P1 and P2 uses exactly two access edges of B. Since B has at most four access edges, P1 and P2 are the only two trails in P ∩ B. Therefore, P ∩ B = (P1 , P2 ) is of Type σ4 or σ5 . Let P1∗ and P2∗ be the dual trail of P1 and P2 , respectively. Case 1. P ∩ B is of Type σ4 . Then, P1 starts at a pole u of B and ends at u while P1∗ starts at a pole x of B ∗ and ends at the other pole y of B ∗ . Because neither G nor G ∗ is Eulerian, P2 starts at the other pole v of B and ends at v while P2∗ starts at x and ends at y. Thus, P ∩ B is of Type δ3 . Case 2. P ∩ B is of Type σ5 . Then, P1 starts at a pole u of B and ends at the other pole v of B while P1∗ starts at a pole x of B ∗ and ends at x. Because neither G nor G ∗ is Eulerian, P2 starts at u and ends at v while P2∗ starts at the other pole y of B ∗ and ends at y. Thus, P ∩ B is of Type δ3 . Let µ be a node of T , and let ν be a child of µ in T . A σ-, π-, or δ-type γ1 of Pt(µ) is consistent with a σ-, π-, or δ-type γ2 of Pt(ν) if a different embedding H of Pt(µ) has a Type-γ1 DTC Q such that Q ∩ B is a Type-γ2 DTC of B, where B is the block of H that is a different embedding of Pt(ν). To describe the improved algorithm concisely, we abuse the notation to use Kπ (B) (respectively, Kδ (B)) to mean its arbitrary subset that contains all useful π-types (respectively, δ-types) of a block B of G. The algorithm works as follows. First, for all nodes µ of T , we determine if µ is a

1282

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

good node of T and compute the pole-parity multiset of Pt(µ) if so; we also determine if µ is a good node of T ∗ and compute the pole-parity multiset of the dual graph of Pt(µ) if so. By Lemma 6.1, this takes O(|G|) time in total. Then, we find the critical nodes of T based on Lemma 6.1. If T has more than two critical nodes, then we stop immediately since G has no valid embedding by Lemma 6.2. So, suppose that T has one or two critical nodes. For all doubly good nonroot nodes µ of T , we compute Kσ (µ) as in section 4.3. After this, we distinguish two cases as follows. • Case 1. T has two critical nodes, say µ and µ′ . Let B = Pt(µ) and B ′ = Pt(µ′ ). Then, µ is not an ancestor of µ′ and vice versa. Thus, both µ and µ′ are doubly bad, and every DET of a valid embedding of G starts with an edge of one of B and B ′ and ends with an edge of the other. We need to compute Kπ (B) and Kπ (B ′ ). After knowing Kπ (B) and Kπ (B ′ ), we are done by calling the algorithm in section 5.4 to compute Kδ (G). We describe the computation of Kπ (B) below. Kπ (B ′ ) is computed similarly. Let ν1 , . . . , νq be the children of µ in T . For each i ∈ {1, . . . , q}, let ei be the virtual edge of νi in Sk(µ). If |Kσ (νi )| = 0 for some i ∈ {1, . . . , q}, then Kπ (B) = ∅ by Lemma 6.4. So, suppose Kσ (νi ) consists of a unique σki ∈ Σ for all i ∈ {1, . . . , q}. – Case 1.1. µ is an R-node. Let H = Sk(µ). By an extreme vertex of H, we mean a pole of H or a nonpole v of H such that for an odd number of edges ei incident to v in H, νi is an O-good node of T . Similarly, by an extreme face of H, we mean the west or east side of H or an inner face F of H such that for an odd number of edges ei on the boundary of F , νi is an O-good node of T ∗ . If H has more than three extreme vertices, then it has at least two odd-degree nonpoles, x and y. In every DET P of G, each of x and y must be either the starting vertex or the ending vertex. However, we allow only one of the starting and the ending vertices of P to be in H. Hence, G has no DET in this case. Similarly, if H has more than three extreme faces, then G has no valid embedding. Let W be the set of all children νi of µ such that ei is incident to an extreme vertex of H and is also on an extreme face of H. Since µ is an R-node, for each (extreme) vertex v of H and each (extreme) face F of H, at most two edges incident to v are on F ; so, a very rough estimate shows |W | ≤ 18. Moreover, every DET of a valid embedding of G either starts or ends with an edge of Pt(νi ) for some νi ∈ W . Thus, for each νi ∈ W , we set Kπ (Pt(νi )) = {πf (ki ) } and then compute the set Πi of all π-types of B consistent with Type πf (ki ) of Pt(νi ) as in Case 3.1 in section 5.4. By Lemma 6.4 and statements 1 and 2 in Lemma 3.2, ∪νi ∈W Πi is Kπ (B). – Case 1.2. µ is an S-node (respectively, P-node). For each j ∈ {1, . . . , 5}, let Ij = {i ∈ {1, . . . , q} | σki = σj }. For each j ∈ {1, . . . , 5} such that Ij 6= ∅, we select an arbitrary i ∈ Ij , set Kπ (Pt(νi )) = {πf (ki ) }, and compute the set Πj of all π-types of B consistent with Type πf (ki ) of Pt(νi ) as in Case 3.2 (respectively, 3.3) in section 5.4. By Lemma 6.4 and statements 1 and 2 in Lemma 3.2, ∪1≤j≤5,Ij 6=∅ Πj is Kπ (B). • Case 2. T has exactly one critical node, say µ. Let B = Pt(µ). If µ is the root of T , we need to compute Kδ (B); otherwise, we need to compute Kπ (B) and Kδ (B). The former case is easier, and here we consider only the latter case. So, we assume that µ is not the root. Then, µ is doubly bad. Let ν1 , . . . , νq be the children of µ in T . For each i ∈ {1, . . . , q}, let ei be the virtual edge of νi in Sk(µ). If Kσ (νi ) = ∅ for some i ∈ {1, . . . , q}, then Kπ (B) = Kδ (B) = ∅ by

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1283

Lemmas 6.4, 6.5, and 6.6. So, suppose Kσ (νi ) = {σki } for all i ∈ {1, . . . , q}. For each j ∈ {1, . . . , 5}, let Ij = {i ∈ {1, . . . , q} | σki = σj }. For each j ∈ {1, 2, 3}, let Ij′ = {i ∈ Ij | νi is an S-node}. Let I5′ = {i ∈ I5 | νi is not an S-node}. – Case 2.1. µ is an R-node. Kπ (B) can be computed as in Case 1.1. We next explain the computation of Kδ (B). Let H = Sk(µ). As in Case 1.1, we define extreme vertices and extreme faces of H. If H has more than four extreme vertices, then it has at least three odd-degree nonpoles and each of them must be the starting or the ending vertex of any DET of G. Hence, G has no DET in this case. Similarly, if H has more than four extreme faces, then G has no valid embedding. If G is not Eulerian, we define a set W of children of µ as in Case 1.1; otherwise, let W be the set of all children νi of µ such that (1) ei is on an extreme face of H and (2) at least one endpoint of ei is on two extreme faces of H. Since µ is an R-node, for each pair of (extreme) faces of H, at most two vertices can appear on both of them; so, a very rough estimate shows |W | ≤ 96. Moreover, every DET of a valid embedding of G that starts and ends both with edges of B must start with an edge of Pt(νi ) and end with an edge of Pt(νj ) for some νi , νj ∈ W (possibly νi = νj ). Thus, for each νi ∈ W and each νj ∈ W with νi 6= νj , we set Kπ (Pt(νi )) = {πf (ki ) } and Kπ (Pt(νj )) = {πf (kj ) }, and further compute the set ∆i,j of all δtypes of B consistent with both Type πf (ki ) of Pt(νi ) and Type πf (kj ) of Pt(νj ), as in Case 1.1 in section 5.4. Moreover, for each νi ∈ W , we compute a set ∆i as follows. In case G is not Eulerian, if σki ∈ {σ4 , σ5 }, then we set Kδ (Pt(νi )) = {δ3 }, and set ∆i to be the set of all δ-types of B consistent with Type δ3 of Pt(νi ), as in Case 2.1 in section 5.4; otherwise, we set ∆i = ∅. In case G is Eulerian, if either (1) νi is not an S-node and σki = σ5 or (2) νi is an S-node and σki ∈ {σ1 , σ2 , σ3 }, then we set Kδ (Pt(νi )) = {δg(ki ) }, and set ∆i to be the set of all δ-types of B consistent with Type δg(ki ) of Pt(νi ), as in Case 2.1 in section 5.4; otherwise, we set ∆i = ∅. By Lemmas 3.2, 6.4, 6.5, and 6.6, the union of the computed sets ∆i,j and ∆i is Kδ (B). – Case 2.2. µ is an S-node (respectively, P-node). Kπ (B) can be computed as in Case 1.2. We next explain the computation of Kδ (B). For each j ∈ {1, . . . , 5} with |Ij | ≥ 2, we arbitrarily select two distinct i, i′ ∈ Ij , set Kπ (Pt(νi )) = {πf (ki ) } and Kπ (Pt(νi′ )) = {πf (ki′ ) }, and compute the set ∆j of all δ-types of B consistent with both Type πf (ki ) of Pt(νi ) and Type πf (ki′ ) of Pt(νi′ ), as in Case 1.2 (respectively, 1.3) in section 5.4. Also, for each pair of distinct j, j ′ ∈ {1, . . . , 5} with Ij 6= ∅ and Ij ′ 6= ∅, we arbitrarily select one i ∈ Ij and one i′ ∈ Ij ′ , set Kπ (Pt(νi )) = {πf (ki ) } and Kπ (Pt(νi′ )) = {πf (ki′ ) }, and compute the set ∆j,j ′ of all δ-types of B consistent with both Type πf (ki ) of Pt(νi ) and Type πf (ki′ ) of Pt(νi′ ), as in Case 1.2 (respectively, 1.3) in section 5.4. Furthermore, in case G is Eulerian, for each j ∈ {1, 2, 3, 5} with Ij′ 6= ∅, we arbitrarily select one i ∈ Ij′ , set Kδ (Pt(νi )) = {δg(ki ) }, and compute the set ∆′j of all δ-types of B consistent with Type δg(ki ) of Pt(νi ), as in Case 2.2 (respectively, 2.3) in section 5.4. On the other hand, in case G is not Eulerian, for each j ∈ {4, 5} with Ij 6= ∅, we arbitrarily select one i ∈ Ij , set Kδ (Pt(νi )) = {δ3 }, and compute the set ∆′j of all δ-types of

1284

ZHI-ZHONG CHEN, XIN HE, AND CHUN-HSI HUANG

B consistent with Type δ3 of Pt(νi ), as in Case 2.2 (respectively, 2.3) in section 5.4. By Lemmas 3.2, 6.4, and 6.5, the union of the computed sets ∆j , ∆j,j ′ , and ∆′j is Kδ (B). After processing the unique critical node µ, we know Kπ (B) and Kδ (B). Note that µ is doubly bad and Kσ (B) = ∅. We then proceed to processing the parent χ of µ. Let Bχ = Pt(χ). Let µ1 , . . . , µp be the children of χ, where µ1 = µ. For each i ∈ {1, . . . , p}, let e′i be the virtual edge of µi in Sk(χ). Since B or B ∗ has an odd-degree nonpole, each DET of a valid embedding of G must start and/or end with an edge of B. So, for each i ∈ {2, . . . , p}, if Kσ (Pt(µi )) = ∅, then Kπ (Pt(µi )) = ∅ too, and hence G has no valid embedding. Thus, we may assume each Kσ (Pt(µi )) consists of a unique σℓi ∈ Σ. Kπ (Bχ ) can be computed from Kπ (B), Kσ (Pt(µ2 )), . . . , Kσ (Pt(µp )), as in Case 3 in section 5.4. To compute Kδ (Bχ ), we first compute the set ∆0 of all δ-types of Bχ consistent with a δ-type in Kδ (B), as in Case 2 in section 5.4. After this, for each πh ∈ Kπ (B), we compute a set ∆h as follows. – Case 2.3. χ is an R-node. We use Lemma 6.3 to compute the unique pole-status S of the different embeddings of B that have a π-type DTC. Let H = Sk(χ). Let v1 and v2 be the endpoints of e′1 . Let F1 and F2 be the endpoints of the dual edge of e′1 . For each list L = (a1 , a2 , b1 , b2 ) such that S = (ha1 , a2 i, hb1 , b2 i), we compute a set ∆L as follows. For each vertex v 6∈ {v1 , v2 } of H, we define v to be an extreme vertex of H as in Case 1.1. Similarly, for each vertex F 6∈ {F1 , F2 } of H ∗ , we define F to be an extreme face of H as in Case 1.1. For each j ∈ {1, 2}, we say that vj is an extreme vertex of H if (1) vj is a pole of H, or (2) aj = 0 and an odd number of edges e′i 6= e′1 incident to vj satisfy that µi is an O-good node of T , or (3) aj = 1 and an even number of edges e′i 6= e′1 incident to vj satisfy that µi is an O-good node of T . Similarly, for each j ∈ {1, 2}, we say that Fj is an extreme face of H if (1) Fj is a pole of H ∗ , or (2) bj = 0 and an odd number of edges e′i 6= e′1 on Fj satisfy that µi is an O-good node of T ∗ , or (3) bj = 1 and an even number of edges e′i 6= e′1 on Fj satisfy that µi is an O-good node of T ∗ . As in Case 2.1, H has at most four extreme vertices and at most four extreme faces, unless G has no valid embedding. As in Case 2.1, we define a set W of children µi of χ. Let W ′ = W − {µ}. For each µi ∈ W ′ , we set Kπ (Pt(µi )) = {πf (ℓi ) }, and then compute the set ∆′i of all δ-types of Bχ consistent with both Type πh of Pt(µ) and Type πf (ℓi ) of Pt(µi ), as in Case 1.1 in section 5.4. Let ∆L = ∪µi ∈W ′ ∆′i . Let ∆h be the union of the computed sets ∆L . – Case 2.4. χ is an S-node (respectively, P-node). For each j ∈ {1, . . . , 5}, let Ij′′ = {i ∈ {2, . . . , p} | σℓi = σj }. For each j ∈ {1, . . . , 5} with |Ij′′ | ≥ 1, we arbitrarily select one i ∈ Ij′′ , set Kπ (Pt(µi )) = {πf (ℓi ) }, and compute the set ∆′j of all δ-types of Bχ consistent with both Type πh of Pt(µ) and Type πf (ℓi ) of Pt(µi ), as in Case 1.2 (respectively, 1.3) in section 5.4. Let ∆h be the union of the computed sets ∆′j . By Lemmas 3.2, 6.4, 6.5, 6.6, and 6.3, Kδ (Bχ ) = ∆0 ∪ (∪πh ∈Kπ (B) ∆h ). This completes the processing of χ; each ancestor of χ is processed in the same way. Once we finish processing the root of T , we have Kδ (G); G has a valid embedding if and only if δ0 ∈ Kδ (G).

DOUBLE EULER TRAILS OF PLANAR GRAPHS

1285

Obviously, processing each node µ of T takes O(|Sk(µ)|) time. Thus, we have the following. Theorem 6.7. Given a TTG G whose dual graph is not Eulerian, it takes O(|G|) time to decide if G has a valid embedding. Acknowledgment. The authors would like to thank the referee for suggestions that considerably improved the readability of this paper. REFERENCES [1] B. S. Carlson, C. Y. R. Chen, and D. S. Meliksetian, Dual Eulerian properties of plane multigraphs, SIAM J. Discrete Math., 8 (1995), pp. 33–50. [2] G. Di Battista and R. Tamassia, On-line maintenance of triconnected components with spqrtrees, Algorithmica, 15 (1996), pp. 302–318. [3] G. Di Battista and R. Tamassia, On-line planarity testing, SIAM J. Comput., 25 (1996), pp. 956–997. [4] S. Even and R. Tarjan, Computing an st-numbering, Theoret. Comput. Sci., 2 (1976), pp. 339–344. [5] T.-Y. Ho, T.-Y. Sung, L.-H. Hsu, C.-H. Tsai, and J.-Y. Hwang, The recognition of double Euler trails in series-parallel networks, J. Algorithm, 28 (1998), pp. 216–257. [6] A. Lempel, S. Even, and I. Cederbaum, An algorithm for planarity testing of graphs, in Theory of Graphs, International Symposium, Gordon Breach, New York, 1967, pp. 215– 232. ¨ller, Linear algorithms for optimizing the layout of dynamic CMOS [7] T. Lengauer and R. Mu cells, IEEE Trans. Circuits and Systems, 35 (1988), pp. 279–285. [8] R. L. Maziasz and J. P. Hayes, Layout optimization of static CMOS functional cells, in Proceedings of the 24th ACM/IEEE Design Automation Conference, 1987, ACM, New York, pp. 544–551. [9] R. L. Maziasz and J. P. Hayes, Layout optimization of static CMOS functional cells, IEEE Trans. Computer-Aided Design, 9 (1990), pp. 708–719. [10] R. Nair, A. Buss, and J. Reif, Linear time algorithms for optimal CMOS layout, in VLSI: Algorithms and Architectures, P. Bertolazzi and F. Luccio, eds., Elsevier Science, NorthHolland, Amsterdam, 1985, pp. 327–338. [11] T. Nishizeki and N. Chiba, Planar Graphs: Theory and Algorithms, North-Holland, Amsterdam, 1988. [12] P. Rosenstiehl and R. E. Tarjan, Rectilinear planar layouts and bipolar orientations of planar graphs, Discrete Comput. Geom., 1 (1986), pp. 343–353. [13] T. Uehara and W. M. VanCleemput, Optimal layout of CMOS functional arrays, IEEE Trans. Comput., 30 (1981), pp. 305–312. [14] S. Ueno, K. Tsuji, and Y. Kajitani, On dual Eulerian paths and in plane graphs, in Proceedings of the IEEE International Symposium on Circuits and Systems, Espoo, Finland, 1988, pp. 1835–1838. [15] S. Ueno, K. Tsuji, and Y. Kajitani, A note on dual trail partition of a plane graph, IEICE Trans., E 74 (1991), pp. 1915–1917.