Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Euler Paths in Series Parallel Graphs 

[Extended Abstract]
S. Rao Kosaraju
Department of Computer Science
The Johns Hopkins University
Baltimore, MD 21218

ABSTRACT for that permutation, Series( 1 2    m ) is drawn such


G ;G ; ;G

that each i +1 is to the right of i . Parallel ( 1 2    m )


G j G j G ;G ; ;G

Given a series-parallel graph, we consider the problem of is drawn by locating each i +1 above i and by placing
G j G j

drawing its layout in the plane (and the planar dual of the the merged and on the left and on the right, respectively.
s t

layout) such that the euler count of the layout is minimized. Note that each of the series and the parallel constructs per-
This problem is of considerable importance to the design of mits ! di erent permutations in the drawing.
m

CMOS circuits. Even though it was believed that there can- For any SP graph layout, the dual is de ned as for planar
not exist a polynomial time algorithm for this problem, we graphs. A typical SP graph layout and its dual are shown
have been able to design a polynomial time algorithm. The in Figure ??. Note that the labels of the edges get mapped
degree of the polynomial is unrealistically large. The main as labels of edges in the dual layout in an obvious way.
interest is in the existence of a polynomial time algorithm Let and d be an SP graph layout and its dual, respec-
H H

for the problem. We are not aware of any natural problem tively. Let = 1 2    n be any string of labels such that
x e e e

for which a natural dynamic programming based algorithm each edge label of appears once in the string. (Denote
H

has such a large degree. such an as a label string of .) Break (greedily from left
x H x

to right) into minimum number of substrings 1 2    m x ;x ; ;x

such that = 1d 2    m , and each i is an euler (sub)path


x x x x x
1. INTRODUCTION in both and . Then we ddenote as the euler count of
H H m

A series-parallel graph (SP graph) is an undirected graph x (with respect to and ). Let the length j 1 2    i j
H H x x x

with 2 speci ed vertices and and is de ned as follows. A be i , for 1  


` 1. We refer to each position i as
i m `
s

graph with an edge between and is an SP graph. If i


t
a break position of . (or there is a break between ` and
x e i

` +1 ) For the above layout, if the string is then


s t G

with i and i , for 1   , are SP graphs, then the series


s t i m
e i

= , and its euler count is 3. (Note that there


x abecdf gh

graph obtained by merging i+1 with i , 1   , (with 1


s t i m s
x abe cd f gh

is a break after since is not an euler path in the


and m as speci ed
t vertices) and the parallel graph obtained abe abec

dual.) The break positions are 3 and 5. The euler count for
by merging all 0i into a single vertex and all 0i into a
s s s t s
a layout is the minimum euler count, minimized over all the
single vertex are SP graphs. The series and the paral-
t
possible label strings. For example, for the above layout,
lel constructs are designated as Series( 1 2    m ) and G ;G ; ;G
the euler count is 2, and it is realized by the label string
Parallel( 1 2    m ), respectively. We are interested in
G ;G ; ;G
(= ). Denote a label string that realizes
SP graphs in which the edges are labeled with distinct sym- abedcf gh abedc f gh

the euler count of as the worst-case label string for .


bols. The size of the graph, , is given by the number of
n
H

The euler count for an SP graph is the euler count of its


H

edges in the graph. layout that has minimum euler count.


Planar layouts of SP graphs are produced in an obvious There are two problems that have received considerable
way. A single edge SP graph is drawn with the edge horizon- attention in the literature. Both the problems are of great
tal. (For simplicity of description we adopt horizontal orien- signi cance in the design of CMOS circuit layouts. [?, ?, ?,
tation; but this is not essential.) The series and the parallel ?]
constructs have a lot of exibility in drawing the layout. Let
( 1 2    m ) be any permutation of (1 2    ). Then
i ;i ; ;i ; ; ;m Problem 1: Given an SP graph layout and its dual
d , compute its euler count.
H

Supported by NSF grant CCR-9821058 and ARO grant H

DAAH04-96-1-0013 Problem 2: Given an SP graph , compute its euler G

count.
There is a linear time algorithm for the rst problem [?].
Even for the general class of planar graph layouts, there is
a linear time algorithm [?] for problem 1.
As explained by Nyland & Reif in [?], the second problem
Permission to make digital or hard copies of all or part of this work for
personal or classroom use is granted without fee provided that copies are
not made or distributed for profit or commercial advantage and that copies for SP graphs is of great practical signi cance. Each edge
bear this notice and the full citation on the first page. To copy otherwise, to corresponds to a transistor, and the sequence of edges that
republish, to post on servers or to redistribute to lists, requires prior specific form euler paths in the graph and its dual can be laid out
permission and/or a fee.
compactly such that adjacent transistors share a common
STOC’01, July 6-8, 2001, Hersonissos, Crete, Greece.
Copyright 2001 ACM 1-58113-349-9/01/0007 ... 5.00. $ di usion layer. Consequently, transforming the graph into

237
g h
f
c d
e e h
s a b t s f
d b t
g
c

DUAL
Figure 1: A Planar Layout and Its Dual

an equivalent form that reduces the euler count is highly X and have labels 1 2    k , in order as shown in
Y u ;u ; ;u

desirable. This problem is considerably harder. There is no the gure. In the dual layout, these edges will be in series,
known polynomial time algorithm for it. It was implicitly and hence 2    k 1 cannot have a continuous transition
u ; ;u

assumed in [?] that there cannot exist a polynomial time al- with edges of . Hence there can be at most 2 continuous
X

gorithm: \In attempting to nd the smallest set of paths that transitions in this case.
traverse both graphs, one must avoid the manipulation of a A general case is shown in Figure ??. In this case, is X

parallel-series graph into equivalent graphs. ... Since there in parallel with one layout above ( 3 ) and another below
Y

are n! di erent orderings of n elements, the exploration of ( 4 ), and this parallel layout is in series with one layout to
Y

all parallel-series graphs to achieve an optimal layout could the left ( 1 ) and another to the right ( 2 ). By a simple
Y Y

be extremely time-consuming and is therefore unacceptable." extension of the argument of the above simple case, we can
Maziasz and Hayes [?, ?] develop an exponential time al- show that each i , 1   4, can provide at most 2 continu-
Y i

gorithm for this problem. In [?], a linear time algorithm ous transitions. Hence there can exist at most 8 continuous
is developed for testing whether the euler count of a given transitions for . The case in which is in series with two
X X

SP graph is 1. In this paper, we develop a polynomial time layouts, one on each side, and this series layout is in parallel
algorithm for problem 2; i.e. for the problem of computing with two layouts, one on each side, can he handled in an
the euler count for a given SP graph. In this preliminary analogous way. 2
version, to simplify the presentation, we will not present the This lemma can be strengthened into the following form.
fastest algorithm. Even our fastest algorithm has a speed The proof involves consideration of several cases of compos-
that is a very large degree polynomial. ing series and parallel constructs.
Extensive literature exists for drawing xed graphs [?]. Lemma 2: For any SP graph layout and d, any
But none of them deals with drawing a graph when the graph d
sub-layout and , and any label string of , there
H H

has potentially exponential number of equivalent forms and X X

can be at most 4 continuous transitions.


x H

the goal is to select the equivalent form that results in an


optimal drawing. The next lemma bounds the total number of transitions in
a worst-case label string for . H

2. ALGORITHM DEVELOPMENT Lemma 3: For dany SP graph layout and d, any H H

sub-layout and , there exists a worst-case label string


Given an SP graph layout H and its dual H d, a sub-layoutd
X X

d for with at most 8 transitions.


X and its dual X are de ned in an obvious way. (X and X
H

must be proper SP graph layouts and they should not leave Proof: Let be any worst-case label string for . Break
x H

any \holes" in the plane.) An example of a sub-layout and x into substrings, = 1 2 3    such that either the odd
x x x x

its dual for the layout of Figure ?? is shown in Figure ??. indexed substrings 1 3    or the even-indexed substrings
x ;x ;

Let = 1 2    n be any label string of . In , position 2 4    are in the sub-layout . Without loss of general-
x ;x ; X
x e e e H

is a transition (between and rest of ) if out of i and


x
ity, we consider the case in which 2 4    are in . Note
x ;x ; X
i X H

i+1 exactly one is in . A transition is a continuous


e
that any 2i substring with discontinuous (transition) ends
x
e X i

transition if there is no break between i and i+1 for contributes 2 to the euler count of and can be moved to any
x

and d ; otherwise it is a discontinuous transition. For the


e e H
position with a discontinuous transition without increasing
H

sub-layout of Figure ??, if the label string is then the euler count. Consequently we can move the even indexed
the transition positions are 1,5 and 7 (
abdef ghc

) in which substrings around such that the resulting string will have at
a bdef gh c

transition positions 1 and 5 are continuous. most 4 substrings from without increasing the euler count
X

of the string. (This corresponds to one end being a con-


Lemma 1: For any SP graph layout and d, any tinuous transition and the other end being a discontinuous
sub-layout and d , and any label string of , there
H H

X X x H transition.) Each substring provides at most 2 transitions.


can be at most 8 continuous transitions. 2
Proof Sketch: First consider a simple case in which We can improve this lemma signi cantly by allowing re-
H is simply in series with as shown in Figure ??. Let
X Y versals of substrings; but we skip this re nement in this
the edges in which are incident at the common vertex of
Y extended version.

238
f
c d
e e
b f
d b

DUAL
Figure 2: A Sub-layout and Its Dual

u1
Y u2 X

u
k

Figure 3: When H is X in series with Y

Y3

Y1 X Y2

Y4

Figure 4: A General form of H

239
We can assume that = 1 2    k , where  9 and
x x x the degree of the polynomial is too large for the algorithm
x k

in which either the even- or the odd-indexed substrings are to be of any practical value.
from . If we x the sub-layout and vary the rest of
X X
Clearly, we have been very lax in our time estimates.
the layout , worst-case label string for and its number
H
Tightening H
the analysis, we can get a much smaller value
of substrings in also vary. However, independent of the
X
for the degree; but it will still be a large value. In the com-
rest of , the contribution of , for any particular , can be
H X
plete version we will discuss many such improvements.
H

characterized by one of the following: ( 1 1 2 2    p p ), We strongly believe


p; ` ; r ; ` ; r ;
that a very low degree polynomial
;` ;r

where  4 (corresponds to the number of substrings in ),


p
time algorithm can be designed for this problem. The main
X

and each i and`


th i , corresponding
r to the left and the right contribution of this paper is to establish the fact that this
ends of the substring, can take one of two values \con-
i
problem is in P-time.
tinuous" and \discontinuous". This speci es the number of
substrings within , and the transition condition of4 each
X

end of every substring. Thus there are at most p=1 22p , 3. REFERENCES
which is less than 29 , di erent possible ways can con- [1] B.S. Carlson, C.Y.R. Chen and D.S. Meliksetian: Dual
X

tribute to a particular . (Of course, this is not a tight


H Eulerian Properties of Plane Multigraphs, SIAM J.
estimate.) Disc. Math., 1995, 33-50.
Let the underlying SP graph for which is a layout be [2] Z.-Z. Chen, X. He and C.-H. Huang: Finding Double
X

G X . Note that X has many possible layouts, being one


G Euler Trails of Planar Graphs in Linear Time, Proc.
X

of those. For each of the 29 possible conditions, di erent IEEE Foundations of Computer Science, 1999, 319-329.
layouts of X contribute di erent euler counts to . For
G
[3] G. Di Battista, P. Eades, R. Tamassia and I.G. Tollis:
H

each condition we specify the minimum possible euler count Graph Drawing; Algorithms for the Visualization of
(minimized over the layouts for X ). It is also easy to prove
G
Graphs, Prentice Hall, New Jersey, 1999.
that there exists a constant such that for Xcand for any [4] T.-Y. Ho, T.-Y Sung, L.-H. Hsu, C.-H. Tsai and J.-Y.
G

two of the 29 di erent conditions, the corresponding euler Hwang: The Recognition of Double Euler Trails in
counts cannot di er by more than . Hence we can express c
Series-Parallel Networks, J. Algorithms, 1998, 216-257.
each euler count as a xed value,  and an o9 set value taken [5] R.L. Maziasz and J.P. Hayes: Layout Optimization of
from f0 1    g. Thus we specify X by 2 di erent values
; ; c G
Static CMOS Functional Cells, Proc. 24th ACM/IEEE
where each value is taken from f0 1 2    g, and a xed ; ;
Design Automation Conf., 1987, 544-551.
; ;c

. For simplicity, let us assume that  = 0 and ignore [6] R.L. Maziasz and J.P. Hayes: Layout Optimization of
it. (It is quite easy to incorporate the exact value into9 the Static CMOS Functional Cells, IEEE Trans. on
discussion.) Thus X can be characterized by one of 2 (=
G
Computer-Aided Design, 1990, 708-719.
c

d ) di erent possible values. Let us denote the corresponding [7] R. Muller and T. Lengauer: Linear Algorithms for Two
value of X as its characteristic value.
G
CMOS Layout Problems, In Proc. of Aegean Workshop
Now we develop a polynomial time algorithm for comput- on Computing VLSI Algorithms and Architectures,
ing the euler count of a given SP graph of size n. Springer Lecture Notes in Computer Science 227, 1985,
G

Algorithm 121-132.
Without loss of generality, we can assume that is spec- [8] L.S. Nyland and J.H. Reif: Algebraic Technique for
i ed with alternating series and parallel constructs. (If, for Generating Optimal CMOS Circuitry in Linear Time,
G

Math. Applic., 1996, 85-108.


example, has within it a speci cation Series( , Series( )) [9] Computers
G
R. Nair, A. Bruss and J. Reif: Linear Time Algorithms
P Q; R

we can replace it by Series( )). For each of the sub


P; Q; R
for Optimal CMOS Layout, In VLSI Algorithms and
SP graphs of we compute its characteristic value, speci ed
G
Architectures, Proc. of the International Workshop on
above, by a bottom-up procedure. Parallel Computing and VLSI, 1985, North-Holland,
The computation for the base case of the SP graph with 327-338.
one edge is easy, and is not presented. [10] T. Uehara and W.M. van Cleemput: Optimal Layout
Let us consider a general construct Series( 1 2    m ), of CMOS Functinal Arrays, IEEE Trans. on
U ;U ; ;U

and let us assume that we have already computed the char- Computers , 1981, 305-312.
acteristic values for the i 's. Now for each value we count
U j

the number of i 's that have the characteristic value . Thus


U j

we group the i 's into U values: ( 1 2    d ), where j


d n ;n ; ;n n

is the number of i0 with characteristic value . Then by


U s j

applying a standard dynamic programming technique we


compute the characteristic value for Series( 1 2    m ). U ;U ; ;U

(This computes a characteristic value for each ( 1 2    d ) p ;p ; ;p

such that each i  i .) We need to compute no more


p n

than 1 2    d di erent characteristic values in the dy-


n n n

namic programming. Each computation requires (1) steps O

since is a constant. The number of computations is maxi-


d

mized when 1 = 2 =d    d = . Hence the number of


n n n m=d

computations is ( ) . The parallel construct can be han-


m=d

dled analogously. Summing over all the levels of series and


parallel speci cation, the total complexity is ( d ). The re- O n

sulting algorithm is a polynomial time algorithm. However,

240

You might also like