DAGmaps: Space Filling Visualization of Directed Acyclic Graphs



Similar documents
EQUATIONS OF LINES AND PLANES

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Reasoning to Solve Equations and Inequalities

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

Section 5-4 Trigonometric Functions

A.7.1 Trigonometric interpretation of dot product A.7.2 Geometric interpretation of dot product

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

Graphs on Logarithmic and Semilogarithmic Paper

Basic Research in Computer Science BRICS RS Brodal et al.: Solving the String Statistics Problem in Time O(n log n)

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful

Homework 3 Solutions

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn

Geometry 7-1 Geometric Mean and the Pythagorean Theorem

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

Experiment 6: Friction

Vectors Recap of vectors

Regular Sets and Expressions

2 DIODE CLIPPING and CLAMPING CIRCUITS

Econ 4721 Money and Banking Problem Set 2 Answer Key

Integration. 148 Chapter 7 Integration

Factoring Polynomials

Math 314, Homework Assignment Prove that two nonvertical lines are perpendicular if and only if the product of their slopes is 1.

. At first sight a! b seems an unwieldy formula but use of the following mnemonic will possibly help. a 1 a 2 a 3 a 1 a 2

MATH 150 HOMEWORK 4 SOLUTIONS

Operations with Polynomials

Concept Formation Using Graph Grammars

Answer, Key Homework 10 David McIntyre 1

Helicopter Theme and Variations

1. Find the zeros Find roots. Set function = 0, factor or use quadratic equation if quadratic, graph to find zeros on calculator

Unit 6: Exponents and Radicals

Solving the String Statistics Problem in Time O(n log n)

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

6.2 Volumes of Revolution: The Disk Method

Or more simply put, when adding or subtracting quantities, their uncertainties add.

Section 7-4 Translation of Axes

AntiSpyware Enterprise Module 8.5

Review guide for the final exam in Math 233

PHY 140A: Solid State Physics. Solution to Homework #2

5 a LAN 6 a gateway 7 a modem

0.1 Basic Set Theory and Interval Notation

FAULT TREES AND RELIABILITY BLOCK DIAGRAMS. Harry G. Kwatny. Department of Mechanical Engineering & Mechanics Drexel University

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

Euler Euler Everywhere Using the Euler-Lagrange Equation to Solve Calculus of Variation Problems

Binary Representation of Numbers Autar Kaw

and thus, they are similar. If k = 3 then the Jordan form of both matrices is

Multiplication and Division - Left to Right. Addition and Subtraction - Left to Right.

One Minute To Learn Programming: Finite Automata

CS99S Laboratory 2 Preparation Copyright W. J. Dally 2001 October 1, 2001

Vector differentiation. Chapters 6, 7

Pure C4. Revision Notes

Math 135 Circles and Completing the Square Examples

9 CONTINUOUS DISTRIBUTIONS

Scalable Mining of Large Disk-based Graph Databases

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

SPECIAL PRODUCTS AND FACTORIZATION

AREA OF A SURFACE OF REVOLUTION

How To Make A Network More Efficient

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity

Integration by Substitution

4.11 Inner Product Spaces

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

Kinetic Collision Detection Between Two Simple Polygons

Lecture 5. Inner Product

Solution to Problem Set 1

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS Spring 2009

19. The Fermat-Euler Prime Number Theorem

** Dpt. Chemical Engineering, Kasetsart University, Bangkok 10900, Thailand

Section 1: Crystal Structure

Vectors and dyadics. Chapter 2. Summary. 2.1 Examples of scalars, vectors, and dyadics

RTL Power Optimization with Gate-level Accuracy

Warm-up for Differential Calculus

CHAPTER 11 Numerical Differentiation and Integration

addition, there are double entries for the symbols used to signify different parameters. These parameters are explained in this appendix.

Section 5.2, Commands for Configuring ISDN Protocols. Section 5.3, Configuring ISDN Signaling. Section 5.4, Configuring ISDN LAPD and Call Control

All pay auctions with certain and uncertain prizes a comment

The remaining two sides of the right triangle are called the legs of the right triangle.

Version 001 Summer Review #03 tubman (IBII ) 1

PHY 222 Lab 8 MOTION OF ELECTRONS IN ELECTRIC AND MAGNETIC FIELDS

Understanding Basic Analog Ideal Op Amps

Small Businesses Decisions to Offer Health Insurance to Employees

Applications to Physics and Engineering

Basic Analysis of Autarky and Free Trade Models

Morgan Stanley Ad Hoc Reporting Guide

Small Business Networking

In addition, the following elements form an integral part of the Agency strike prevention plan:

Lectures 8 and 9 1 Rectangular waveguides

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

Physics 43 Homework Set 9 Chapter 40 Key

1.2 The Integers and Rational Numbers

Transcription:

Journl of Grph Algorithms nd Applictions http://jg.info/ vol. 13, no. 3, pp. 319 347 (2009) DAGmps: Spce Filling Visuliztion of Directed Acyclic Grphs Vssilis Tsirs 1,2 Sofi Trintfilou 1,2 Ionnis G. Tollis 1,2 1 Institute of Computer Science, Foundtion for Reserch nd Technology-Hells, Vssilik Vouton, P.O. Box 1385, Herklion, GR-71110 Greece 2 Deprtment of Computer Science, University of Crete, P.O. Box 2208, Herklion, Crete, GR-71409 Greece Astrct Gene Ontology informtion relted to the iologicl role of genes is orgnized in hierrchicl mnner tht cn e represented y directed cyclic grph (DAG). Spce filling visuliztions, such s the treemps, hve the cpcity to disply thousnds of items legily in limited spce vi two-dimensionl rectngulr mp. Treemps hve een used to visulize the Gene Ontology y first trnsforming the DAG into tree. However this trnsformtion hs severl undesirle effects such s producing trees with lrge numer of nodes nd scttering the rectngles ssocited with the duplictes of node round the disply rectngle. In this pper we introduce the prolem of visulizing DAG with spce filling techniques without converting it to tree first, we present two specil cses of the prolem, nd we discuss complexity issues. Sumitted: Jnury 2008 Article type: Regulr pper Reviewed: April 2008 Finl: Jnury 2009 Revised: August 2008 Accepted: Decemer 2008 Pulished: Novemer 2009 Communicted y: S.-H. Hong nd T. Nishizeki This work ws supported in prt y INFOBIOMED code: IST-2002-507585 nd the Greek Generl Secretrit for Reserch nd Technology under Progrm ARISTEIA, Code 1308/B1/3.3.1/317/12.04.2002. E-mil ddresses: tsirs@ics.forth.gr (Vssilis Tsirs) strint@ics.forth.gr (Sofi Trintfilou) tollis@ics.forth.gr (Ionnis G. Tollis)

320 Tsirs, Trintfilou, Tollis DAGmps 1 Introduction The Gene Ontology project (GO) [1], provides controlled voculry to descrie gene nd gene product ttriutes in n orgnism. The GO is the union of three ontologies, ech representing key concept in moleculr iology: the Moleculr Function of gene products; their role in multi-step Biologicl Processes; nd their locliztion to Cellulr Components. The uilding locks of the three ontologies re the terms which consist of numericl identifier, nme nd numer of ttriutes such s definition. The ontologies re continuously updted ut since they chnge very slowly their structure cn e considered lmost constnt. At the time tht this pper ws written the three ontologies contined 8464, 15841 nd 2253 terms respectively. The ontologies re structured s directed cyclic grph (DAG) where the set of vertices is the set of terms nd n edge is reltionship from more specilized term to less specilized term. GO terms cn e linked y five type of reltionships: is, prt of, regultes, positively regultes or negtively regultes. Due to its huge size, visulizing the whole GO with the usul node-link representtion leds to visul clutter. The reson for this clutter is tht, the node-link representtions do not mke optiml use of the ville spce since most of the pixels re used for the ckground. On the other hnd, spce filling techniques mke optiml use of the ville spce nd hve the cpcity to show thousnds of items legily. At the core of spce filling visuliztion is lyout function tht tkes s rguments list of k positive numers {x 1, x 2,..., x k } nd rectngle R nd returns prtition of R into rectngles R 1, R 2,..., R k, where re(r i ) is proportionl to x i. The numer of possile prtitions is huge nd finding solution such s to minimize the size of the perimeters of the rectngles is NP-complete [3]. Heuristic lgorithms produce prtitions with desirle properties in resonle time. For exmple, the squrified lyout, introduced y Bruls et l. [5], strives to produce rectngles with spect rtio s close s possile to one, where spect rtio = mx(width/height, height/width). In the cse of treemps the nodes of tree re visulized s rectngles whose re is proportionl to numeric ttriute of the nodes with the property tht the vlue of the ttriute in prent node is equl to the sum of the vlues of its children nodes. The rectngle tht represents the root of tree is prtitioned into rectngles representing its children nd the lgorithm is repeted recursively Vesicle lumen GO:0031983 is_ prt_of orgnelle lumen GO:0031983 Memrne ound vescile GO:0031988 is_ is_ is_ orgnelle prt GO:0044422 vesicle GO:0031982 memrne enclosed lumen GO:0031974 prt_of is_ is_ is_ orgnelle GO:0043226 is_ cellulr component GO:0005575 is_ ll Figure 1: A smll sugrph of the GO DAG.

JGAA, 13(3) 319 347 (2009) 321 ll iologicl_process metolic process cellulr met primry met mcromole nucleo nucleo io pr cellu cell pro cel iosynth regulti ct nitr cellulr process cellulr metolic regultion of cellulr d nucleo cell cell cellulr c cell c gen cell ctiv developmentl process iologicl regultio ntomicl s multic regultion of i system regul reg n pos cellulr nt re regultion of iologicl pro immune system regultion of regu reg im positiv re multicellul locliz regultion of multi for ech node of the tree [4, 5, 15]. In treemp the hierrchy structure is presented using severl pproches including the nested [10, 15], the cscded [12, 13], nd the cushion [18] presenttions. Treemps hve een used to visulize compound grphs tht contin oth hierrchicl (rooted tree) reltions nd djcency reltions [9]. Spce filling techniques re used for the hierrchicl or inclusion reltions nd lines or curves for the djcency reltions. In the context of GO, treemps hve een used to visulize microrry dt, where ech gene trnscript is ssigned ll possile pths tht strt from it nd terminte to the most generl term (the ll term) of GO [2]. Symeonidis et l. [16] proposed to decompose the complete GO DAG into tree y duplicting the vertices with mny incoming edges, nd then to use treemp lgorithm to visulize the tree (Figure 8). The dupliction of vertex however triggers the dupliction of ll of its out-neighors. Therefore the trnsformtion of DAG response to stimulus immu regu respons est multi- ne positiv cellulr_component cell cell prt intr cell prt intrcellul orgnelle org m moleculr_function ctlytic tr Figure 2: Trnsforming the GO DAG into tree nd then drwing it s treemp. The first five lyers from the root re shown. The tree structure is visulized vi nesting. The multiple copies of the node regultion of cellulr process re shown with green ckground color. The color of nodes refers to the reltionship etween GO term nd its prent GO term. We use white color for is reltionship, light rown color for prt of, gry color for regultes, red color for positively regultes nd lue color for negtively regultes. E.g., metolic process is iologicl process which is ll. Also cell prt is cellulr component nd prt of cell.

322 Tsirs, Trintfilou, Tollis DAGmps into tree leds to trees with (potentilly exponentilly) mny more nodes thn the originl DAG. At the time tht this pper ws written the initil GO DAG hd 26558 vertices, while the produced equivlent tree hd 872460 nodes. Another drwck of duplicting the vertices is tht the rectngles ssocited with the multiple replics of vertex re scttered round the disply rectngle (Figure 2). In this pper we introduce the prolem of drwing DAG using spce filling techniques without converting it to tree first. We consider severl vritions of the prolem, we present some chrcteriztions of simple fmilies of DAGs tht dmit such drwing, nd provide complexity results for the generl prolem. 2 Prolem Definition 2.1 Preliminries Suppose tht G = (V, E) is directed cyclic grph (DAG) with n = V vertices nd m = E edges. A pth of length k from vertex u to vertex w is sequence v 0, v 1, v 2,..., v k of vertices such tht u = v 0, w = v k, nd (v i 1, v i ) E for i = 1, 2,..., k. There is lwys zero-length pth from u to u. If there is pth p from u to w, we sy tht w is rechle from u vi p nd we write u p w. A lyering of G is prtition of V into susets L 1, L 2,..., L h, such tht if (u, v) E, where u L i nd v L j, then i > j. A DAG with lyering is lyered DAG. The spn of n edge (u, v) with u L i nd v L j is i j. The DAG is proper if no edge hs spn greter thn one. A DAG G cn e mde proper y replcing ech long edge (u, v) of spn k > 1 with pth u = v 1, v 2,..., v k = v, dding the dummy vertices v 2,..., v k 1 [6]. If e = (u, v) E is directed edge, we sy tht e is incident from u (or outgoing from u) nd incident to v (or incoming to v); vertex u is the origin of e nd vertex v is the destintion of e. The origin of e is denoted y orig(e) nd the destintion of e y dest(e). For every vertex u V, N + (u) = {v (u, v) E} nd N (u) = {v (v, u) E} re the sets of out-neighors nd in-neighors of vertex u, respectively. Anlogously, Γ + (u) = {e E orig(e) = u} nd Γ (u) = {e E dest(e) = u} re the sets of edges incident from nd to vertex u, respectively. Finlly, we denote the set of edges incident from the nodes of lyer L i, i {2,..., h} y E i (E i = u Li Γ + (u)). 2.2 Drwing Constrints Treemps disply tree hierrchy vi the inclusion invrint. Nmely, the drwing rectngle of ny node (different from the root) is included within the drwing rectngle of its prent. When the grph is DAG, the ove invrint should e replced y the invrint tht the drwing rectngle of ny vertex is included within the union of the rectngles of its in-neighors. Aprt from this invrint it is plusile to ssume tht the drwing rectngles of two vertices

JGAA, 13(3) 319 347 (2009) 323 do not overlp when ech node is not rechle from the other nd tht the drwing rectngle of vertex is covered y the drwing rectngles of its outneighors. Another oservtion is tht in DAGs n edge my e visulized s rectngle which is contined in the intersection of the origin nd the destintion vertex rectngles. Let R u denote the drwing region of vertex u V nd similrly R e denote the drwing region of n edge e E. Then the ove invrint nd ssumptions re summrized in Definition 1. Definition 1 (DAGmp drwing) A DAGmp drwing of DAG G = (V, E) is spce filling visuliztion of G tht stisfies the following drwing constrints: B1. Every vertex is drwn s rectngle (R u is rectngle for every u V ). B2. The union of the rectngles of the sources of G is equl to the initil drwing rectngle (R = s S R s, where S V is the set of sources of G). B3. Every edge is drwn s rectngle tht hs non-zero re nd which is contined in the intersection of the origin nd destintion vertex rectngles ( e = (u, v) E, R e is rectngle, R e R u R v nd re(r e ) 0). B4. For every pir of edges e 1 = (u 1, v 1 ), e 2 = (u 2, v 2 ) E, e 1 e 2, such tht u 1 is not rechle from v 2 nd u 2 is not rechle from v 1, the rectngles R e1 nd R e2 do not overlp (re(r e1 R e2 ) = 0). B5. The rectngle of every non-source vertex u V is equl to the union of the rectngles of edges incident to u (R u = e Γ (u)r e ). B6. The rectngle of every non-sink vertex u V is equl to the union of the rectngles of edges incident from u (R u = e Γ+ (u)r e ). From constrints B1-B6 it is trivil to prove tht: Proposition 1 In DAGmp drwing of DAG G the following hold: ) The rectngle of every non-source vertex u V is contined in the union of rectngles of its in-neighors (R u v N (u)r v ). ) The rectngle of every non-sink vertex u V is covered y the rectngles of its out-neighors (R u v N + (u)r v ). c) For every pir of vertices u, v V if there is no pth from u to v nd from v to u then their rectngles R u, R v do not overlp (re(r u R v ) = 0). The drwing rules of Definition 1 re quite generl since they do not constrin the re of the sink vertices, or how the re of vertex is distriuted to its incoming edges. To simplify the nlysis of the prolem we constrin these two prmeters y mking the following ssumptions.

324 Tsirs, Trintfilou, Tollis DAGmps Definition 2 (Additionl drwing constrints) A1. The sink vertices re drwn in equl re rectngles. A2. The rectngles of the edges incident to vertex hve equl res (For every non-source vertex u nd every e Γ (u), re(r e ) = re(ru) Γ (u) ). () Edge drwing () Drwing of prllel edges Figure 3: An exmple where n edge rectngle is the intersection of the origin nd destintion vertex rectngles. In the cse of multigrphs, if there re k prllel edges etween n origin vertex nd destintion vertex, the intersection rectngle is ritrrily prtitioned into k equl re rectngles. In rel pplictions, we my choose to drw only vertex rectngles, only edge rectngles, or oth. We usully drw edge rectngles when the DAG hs multiple edges or when the edges crry out importnt informtion such s the type of reltionship etween two vertices. See Figure 4 for n exmple. Hving defined the drwing rules, we cn define the following prolems: 1. Given DAG G 1, does G 1 dmit DAGmp? 2. In cse tht the nswer to the first prolem is negtive, wht is the minimum numer of vertex duplictions tht re needed to trnsform G 1 into DAG G 2 tht dmits DAGmp? 2.3 Exmples nd Counter-Exmples of DAGs tht Admit DAGmp Exmples of DAGs tht dmit DAGmp pper in Figure 5. From the counterexmple of Figure 6 we see tht there re DAGs tht do not dmit DAGmp drwing. The DAG in Figure 6() cnnot e drwn due to djcency constrint violtion. The first-lyer vertices e, f, g, h, i, j constrin the pirs of second-lyer vertices {, },{, c},{, d},{, c},{, d},{c, d} to e drwn in djcent rectngles. However we cnnot hve such configurtion. In this cse in order to drw the DAG we cn either duplicte one of the vertices e, f, g, h, i, j or relx some of constrints of Definition 1, s we did in Figure 6() where we relxed constrint B1. However, llowing the set of possile drwings of vertex to include ny

JGAA, 13(3) 319 347 (2009) 325 simply connected region of the plne complictes the prolem without offering gurntee tht DAG will dmit DAGmp. A counter-exmple, sed on the four color (mp coloring) theorem, is two-lyer DAG hving five second-lyer vertices nd ten first-lyer vertices (one sink for every pir of sources). 2.4 Vertex Dupliction Usully, DAG encountered in prctice does not dmit DAGmp. In this cse we should relx one or more of constrints B1-B6, A1-A2 or chnge the form of the DAG. Symeonidis et l. [16] chose to trnsform the DAG into forest of trees y performing vertex duplictions. An exmple of vertex dupliction is shown in Figure 7, where fter the cretion of two replics of vertex h the DAG of Figure 6() is trnsformed into new DAG which dmits drwing. ll cellulr component cell cell prt iologicl process cellulr process cellulr component orgniztion orgnelle memrne-ounded orgnelle orgnelle prt cellulr metolic process metolic process primry metolic process Figure 4: In this exmple sugrph of the GO DAG is drwn. The color refers to the reltionship etween two GO terms. We use white color for is reltionship nd light rown color for prt of reltionship. The term cellulr metolic process is cellulr process nd is metolic process. The term cell prt is cellulr component nd prt of cell. (Compre the visuliztion of cell prt etween this figure nd Figure 2.) c d c c e e d e f d f d e f f c () The K 3,3 DAG () A circulr DAG Figure 5: Exmples of DAGs tht dmit DAGmps.

326 Tsirs, Trintfilou, Tollis DAGmps c d d e f g h i j c () Adjcency constrints violtion c d d e f g h i j c () Relxing constrint B1 Figure 6: Exmple of DAG tht cnnot hve drwing tht stisfy ll constrints B1-B6. However y relxing constrint B1 the DAG dmits DAGmp. c d c d e i h1 g h2 e f g h i j e f g h1 h2 i j f c j d Figure 7: After the dupliction of vertex h the DAG of Figure 6() is trnsformed into DAG tht dmits DAGmp. 2.5 Exponentil Increse in the Numer of Vertices Trnsforming DAG G into tree vi vertex dupliction (see Figure 8) gurntees the dmissiility of the drwing ut my led to n exponentil increse in the numer of vertices. In worst cse scenrio, DAG G hs n vertices rrnged in n lyers (Figure 9). For simplicity we use the sme numering for vertices c c d1 e1 c d2 e2 d d 1 d 2 f1 f2 e f e 1 f1 e 2 f 2 Figure 8: Exmple of trnsforming DAG into tree nd then drwing it s treemp.

JGAA, 13(3) 319 347 (2009) 327 nd for lyers. DAG G hs n (n 1)/2 directed edges. There is directed edge from every vertex i to every vertex j with i > j. Suppose tht G is trnsformed into tree hving T n nodes. Then the reltion etween n nd T n is: T 1 = 1 = 2 0, T 2 = 1 + T 1 = 2 1, T 3 = 1 + T 2 + T 1 = 2 2 And y induction on n: T n = 1 + T n 1 + T n 2 +... + T 1 = T n 1 + T n 1 = 2 T n 1 = 2 2 n 2 = 2 n 1 4 3 2 1 Figure 9: A DAG with four vertices, hving the structure descried in the worst cse scenrio. 3 Specil Cses We continue y considering two specil cses. The first cse is sed on restricted form of DAGs, the second on restricted form of DAGmps. 3.1 Two Terminl Series Prllel Digrphs A Two Terminl Series Prllel (TTSP) digrph is recursively defined s follows [6, 17]. Definition 3 (Two Terminl Series Prllel digrphs) i) A digrph consisting of two vertices joined y single edge is TTSP (the se grph); ii) If G 1 nd G 2 re TTSP digrphs, so is the digrph otined y either of the following opertions: ) Series composition: identify the sink of G 1 with the source of G 2. ) Prllel composition: identify the source of G 1 with the source of G 2 nd the sink of G 1 with the sink of G 2. A TTSP digrph G is nturlly ssocited with rooted inry tree T, which is clled the decomposition tree (or prse tree) of G, nd which provides informtion on how the grph G is constructed using series nd prllel compositions.

328 Tsirs, Trintfilou, Tollis DAGmps G 1 G 1 G 2 G 2 () The se TTSP digrph () Series composition (c) Prllel composition Figure 10: Recursive definition of TTSP digrph. P P c d e f c P S P g S P S g S g d e P f c d e f Figure 11: Given TTSP digrph G, we construct its decomposition tree y performing prllel nd series reductions. Then we merge the djcent P-nodes. Definition 4 The decomposition tree T of TTSP digrph G = (V, E) hs three types of nodes: S-nodes, P-nodes nd Q-nodes. The leves of T re Q- nodes nd represent se grphs of G. The internl nodes re either P-nodes or S-nodes. T is defined recursively s follows: i) If G is se grph, then T consists of single Q-node. ii) If G is creted y prllel composition of TTSP digrphs G 1 nd G 2, let T 1 nd T 2 e the decomposition trees of G 1 nd G 2 respectively, then the root of T is P-node nd hs sutrees T 1 nd T 2. iii) If G is creted y series composition of TTSP digrphs G 1 nd G 2, where the sink of G 1 is identified with the source of G 2, let T 1 nd T 2 e the decomposition trees of G 1 nd G 2, respectively, then the root of T is n S-node nd hs left sutree T 1 nd right sutree T 2. The decomposition tree, which is not unique since severl prllel compositions my e comined in different wys nd similrly severl series compositions, hs O(m) nodes nd cn e computed in O(m) time s y-product of the series nd prllel reduction steps of the TTSP recognition lgorithm proposed y Vldes et l. [17]. In order to use the decomposition tree s input to DAGmp drwing lgorithm the neighoring P-nodes re merged to single

JGAA, 13(3) 319 347 (2009) 329 node such tht the resulting tree my hve P-nodes of out-degree lrger thn two. The TTSP recognition lgorithm [17] mintins list of vertices tht initilly includes ll vertices except the source nd the sink. The lgorithm proceeds y removing ny vertex v from this list nd performing s mny prllel reductions on the edges incident to (from) it s it is possile efore either leving the vertex with single entering edge nd single exiting edge, or discovering tht the vertex still hs t lest two distinct in-neighors or two distinct out-neighors. In the first lterntive, the vertex is removed y series reduction nd the two vertices djcent to it dded to the unstisfied list if they re not there lredy. This process is repeted until the unstisfied list ecomes empty, t which point the sme process is pplied to the source nd the sink (in order to eliminte ny multiple edges etween them) efore stopping. The unstisfied list ecomes empty, either ecuse ll vertices (except source nd sink) hve een deleted y series reductions or ecuse every remining vertex hs two distinct in-neighors or two distinct out-neighors. In the first cse the DAG is TTSP; in the second it is not. The following lgorithm finds DAGmp drwing of TTSP digrph. Algorithm 1 TTSP DAGmp drwing Input: TTSP digrph G nd rectngle R Output: A DAGmp drwing of G 1. Construct the decomposition tree T of G [17] nd merge the neighoring P-nodes. In the resulting tree, P-nodes my hve more thn two children. 2. S-nodes of T re ssocited with vertices of G s follows. If n S-node is creted s result of series reduction etween two edges (v, u) nd (u, w) of G, then ssocite this S-node with vertex u of G. All vertices of G, prt from the source nd the sink, hve corresponding S-node in T. 3. Assign sizes to nodes of the decomposition tree T. 4. Assign rectngle R to the root node of T. 5. Let u e the current node of T nd R u the rectngle ssigned to it. 6. If u is n S-node then ) Let u L nd u R e the left nd right children of node u. ) Assign rectngles R L = R u nd R R = R u to nodes u L nd u R respectively. c) Recursively repet the procedure from step 5 for nodes u L nd u R. 7. If u is P-node then ) Let u 1, u 2,..., u k e the children of u nd let x 1, x 2,..., x k e their sizes.

330 Tsirs, Trintfilou, Tollis DAGmps ) Cll lyout function with input the rectngle R u nd the sizes x 1, x 2,..., x k to find prtition of R u into rectngles R 1, R 2,..., R k where re(r i ) is proportionl to x i. c) for i = 1 : k ssign rectngle R i to node u i nd recursively repet the procedure from step 5 for node u i. 8. When the ove recursive procedure finishes, the rectngle ssigned to Q-node of T is lso ssigned to the ssocited edge of G. The rectngle ssigned to n S-node of T is lso ssigned to the ssocited vertex of G. 9. Assign rectngle R to the source nd sink of G. 10. Drw vertex nd/or edge rectngles ccording to priority criterion. 1 1->3 1->2 1->4 2->1 4->10 3->5 3->6 3->7 4->8 6-> 7-> 8-5-> 9->11 10->11 1->3 3->5 5->9 9->11 3->6 3->7 6->9 7->9 2 3 4 5 6 7 8 9 10 1->4 4->10 10->11 4->8 8->10 1->2 2->11 11 () A TTSP () A DAGmp drwing using lyout tht slices the rectngles in the verticl direction (c) A DAGmp drwing using the squrified lyout proposed y Bruls et l. [5] Figure 12: Exmple of TTSP digrph DAGmp drwing. Only edge rectngles re shown. The hierrchy structure is shown vi nesting. For n exmple where only vertex rectngles re shown see Figure 13(i). The tricky prt of the lgorithm is how to ssign sizes to nodes of the decomposition tree. If u is n internl node of the decomposition tree, nd u 1, u 2,..., u k re its children then the constrints re: 1. If u is n S-node then size(u) = size(u 1 ) = size(u 2 ). 2. If u is P-node then size(u) = size(u 1 ) +... + size(u k ). These constrints re not sufficient for unique solution, nd there is some freedom on the choice of the size of some lef nodes. In the exmples of Figure 12 the sizes were clculted using the dditionl ssumption tht if mong the children nodes of P-node there re some Q-nodes then ll hve the sme size.

JGAA, 13(3) 319 347 (2009) 331 1 1 1->3 1 1->3 3 1->4 1->2 1->4 4 1->2 2 () Vertex 1 () Outgoing edges of vertex 1 (c) Vertices 2, 3 nd 4 1 1->3 3 3->5 3->6 3->7 1 1->3 3 3->5 5 3->6 6 3->7 7 1 1->3 3 3->5 5 3->6 6 3->7 7 5->9 6->9 7->9 1->4 4 4->10 4->8 1->2 2 2->11 1->4 4 4->10 4->8 8 1->2 2 2->11 1->4 4 4->10 4->8 8 8->10 1->2 2 2->11 (d) Outgoing edges of vertices 2, 3 nd 4 (e) Vertices 5, 6, 7 nd 8 (f) Outgoing edges of vertices 5, 6, 7 nd 8 1 1->3 3 3->5 5 3->6 6 3->7 7 5->9 9 6->9 7->9 1 1->3 3 3->5 5 3->6 6 3->7 7 5->9 9 6->9 7->9 9->11 1 1->3 3 3->5 5 3->6 6 3->7 7 5->9 9 6->9 7->9 9->11 1->4 4 4->10 4->8 8 8->10 1->2 2 2->11 1->4 4 4->10 10->11 4->8 8 8->10 1->2 2 2->11 1->4 4 4->10 10->11 4->8 8 8->10 1->2 2 2->11 (g) Vertices 9 nd 10 (h) Outgoing edges of vertices 9 nd 10 (i) Vertex 11 Figure 13: Step y step drwing of the DAG of Figure 12. The vertex rectngles re shown with white color while the edge rectngles re shown with light gry color. The nesting lgorithm, used in this exmple, is slightly different thn the nesting lgorithm used in Figure 12(c), since cre ws tken to drw edge rectngles within the intersection of their origin nd destintion vertex rectngles. Lemm 1 Let G = (V, E) e TTSP digrph nd e 1 = (u 1, v 1 ), e 2 = (u 2, v 2 ) e two edges of G. If there is no pth in G from v 1 to u 2 nd from v 2 to u 1 then Algorithm 1 drws edges e 1 nd e 2 in non overlpping rectngles.

332 Tsirs, Trintfilou, Tollis DAGmps Proof: Let A = {w V w p u 1 nd w p u 2 }. Notice tht A lwys contins the source. Now, let A e the vertex which hs the mximum longest pth distnce from the source mong the vertices of A. We will show tht vertex is uniquely defined. If u 1 = u 2, then = u 1 = u 2. If u 1 u 2, suppose on the contrry, tht there re two vertices 1, 2 A, 1 2 hving the sme longest pth distnce from the source. There is no pth from 1 to 2 or from 2 to 1, since 1 nd 2 hve the sme longest pth distnce from the source. p Then the sugrph of G formed y vertices nd edges of the pths 1 u1, p p p 1 u2, 2 u1 nd 2 u2 is homeomorphic to K 2,2. We conclude tht G is not TTSP digrph, which is contrdiction. p p Similrly, let B = {w V v 1 w nd v2 w}. Notice tht B lwys contins the sink. Now, let B e the vertex which hs the mximum longest pth distnce to the sink mong the vertices of B. Vertex is unique. The proof is similr to the one for vertex. Any pth strting t, terminting t nd contining edge e 1 meets every pth strting t, terminting t nd contining edge e 2 only t the end vertices nd. Therefore edges e 1 nd e 2 elong to two different TTSP sugrphs mong the k 2 digrphs G 1,..., G k (ll sugrphs of G) tht hve source nd sink. If T 1,..., T k denote the decomposition trees of G 1,..., G k nd ρ 1,..., ρ k their roots, then the decomposition tree T of G contins P-node whose children re the nodes ρ 1,..., ρ k. The rectngle ssigned to this P-node is prtitioned mong its children y Algorithm 1. Therefore edges e 1 nd e 2 re drwn in non-overlpping rectngles. Theorem 1 Every TTSP digrph dmits DAGmp drwing, which cn e computed in Θ(m) time. Proof: We will show tht the drwing produced y Algorithm 1 is comptile with the constrints of Definition 1. Algorithm 1 ssigns rectngle to every vertex nd edge of G. Every edge of G is ssigned the rectngle of the ssocited Q-node of T. The source nd the sink of G re ssigned the initil drwing rectngle. Now, suppose tht u is vertex of G tht is neither source nor sink. Then there is t lest one edge incident to u nd t lest one edge incident from u. The TTSP recognition lgorithm fter performing numer of series nd prllel reductions leves exctly one edge (v, u) incident to u nd exctly one edge (u, w) incident from u. Finlly, the TTSP recognition lgorithm removes node u y performing series reduction, in which edges (v, u) nd (u, w) re sustituted y edge (v, w). The lel of edge (v, w) is n S-node hving s left sutree the lel of edge (v, u) nd s right sutree the lel of edge (u, w). This S-node of T is ssocited with vertex u of G nd the rectngle ssigned to this S-node is lso ssigned to vertex u. Clerly, constrints B1 nd B2 re stisfied. Next we will show tht constrint B3 is stisfied. Let e = (u, v) e n edge of G. It is re(r e ) 0 since Algorithm 1 lwys divides rectngle into non-trivil rectngles. If u is the source of G then it is ssigned the initil drwing rectngle nd therefore

JGAA, 13(3) 319 347 (2009) 333 R e R u. Similrly if v is the sink of G then R e R v. If u is not the source of G then the TTSP recognition lgorithm ssocites u with n S-node of T. Edge e is represented y Q-node which is locted in the right sutree of the tree rooted t this S-node. Similrly, if v is not the sink of G then edge e is represented y Q-node which is locted in the left sutree of the tree rooted t the S-node ssocited with vertex v. Algorithm 1 ssigns the rectngle of n S-node to the left nd right sutrees rooted t the S-node. These rectngles my e frther prtitioned efore Q-nodes of the sutrees re ssigned rectngles. Therefore, in ll cses we hve: R e R u nd R e R v R e R u R v. Constrint B4 is stisfied due to Lemm 1. We will show tht constrint B5 is stisfied y induction on the composition rules of TTSP digrphs. If G is se grph composed of two vertices connected y n edge then the rectngle of the sink is equl to the rectngle of the edge nd constrint B5 is stisfied. Now, suppose tht for two TTSP digrphs G 1 nd G 2 constrint B5 is stisfied. Let G e the TTSP digrph tht is produced y identifying the sink of G 1 with the source of G 2. The rectngle ssigned to the source nd the sink of G is equl to the rectngles ssigned to the source nd sink vertices of G 1 nd G 2. Using the induction hypothesis, we conclude tht the rectngle of every non-source vertex of G is equl to the union of rectngles of its incoming edges. Now, let G denotes the TTSP digrph tht is produced y prllel composition of G 1 nd G 2. Rectngle R s ssigned to source s of G is prtitioned into two rectngles R s1 nd R s2. Rectngle R s1 is ssigned to source s 1 of G 1 nd rectngle R s2 to source s 2 of G 2. Rectngle R t of the sink t of G is prtitioned into two rectngles R t1 nd R t2 ssigned to sink t 1 of G 1 nd to sink t 2 of G 2 respectively. It hold tht R t1 = R s1 nd R t2 = R s2 ecuse the source nd sink rectngles of G 1 (resp. G 2 ) re equl. Then y the induction hypothesis, constrint B5 holds for every non-source nd non-sink vertices of G. It remins to show tht constrint B5 holds for sink t of G. The set of edges Γ G (t) incident to t of G is equl to the union of the sets of edges Γ G 1 (t 1 ) nd Γ G 2 (t 2 ) incident to t 1 of G 1 nd to t 2 of G 2 respectively. Also R t = R t1 R t2 nd y the induction hypothesis R t1 (resp. R t2 ) is equl to the union of the rectngles of edges Γ G 1 (t 1 ) (resp. Γ G 2 (t 2 )). Therefore R t is equl to the union of the rectngles of edges Γ G (t) = Γ G 1 (t 1 ) Γ G 2 (t 2 ). The proof tht the constrint B6 is stisfied, is similr to the proof for constrint B5. Therefore, ll constrints of Definition 1 re stisfied. The Θ(m) worst cse time holds since the TTSP recognition lgorithm runs in Θ(m) time nd the drwing lgorithm performs one trversl of the decomposition tree which hs Θ(m) nodes. 3.2 One-Dimensionl DAGmps We continue y restricting the wys in which the initil rectngle is prtitioned; nmely we consider only verticl (or only horizontl) prtitions. Definition 5 A DAGmp is clled one-dimensionl if the rectngles representing the vertices nd the edges of DAG hve their top nd ottom (left nd

334 Tsirs, Trintfilou, Tollis DAGmps right) sides on the top nd ottom (left nd right) sides respectively of the initil drwing rectngle (i.e., the initil rectngle is sliced only long the verticl (horizontl) direction). See Figure 12() for n exmple. Since the height (resp. width) of ll the rectngles is constnt nd equl to the height (resp. width) of the initil drwing rectngle, the prolem is onedimensionl nd the rectngles R q cn e represented y intervls I q (Figure 14). Next we will define nd study the prolem of recognizing whether DAG dmits one-dimensionl DAGmp. c d e c d e c d e Figure 14: A one-dimensionl DAGmp exmple. Prolem 1 (ONE-DIMENSIONAL DAGMAP) INSTANCE: A DAG G. QUESTION: Does G dmit one-dimensionl DAGmp? In this section we study restricted version of the one-dimensionl DAGmp prolem. We consider the cse tht DAG G = (V, E) is lyered with vertex prtition V = L 1... L h, h > 1, such tht the sources of G re in L h nd the sinks of G re in L 1. Without loss of generlity we ssume tht the lyering is proper. To ech vertex nd edge of G we ssign rtionl numer which is the length of its drwing intervl. If length(i) is the length of the initil intervl I then ech sink vertex u L 1 is ssigned the numer length(i) L 1, denoted y size(u). The edges incident to sink vertex u re ssigned sizes ccording to constrint A2 of Definition 2 (for ech e Γ (u), size(e) = size(u) Γ (u) ), the vertices in L 2 re ssigned sizes using constrint B6 of Definition 1 (for ech u L 2, size(u) = e Γ + (u) size(e)), nd so on. After clculting sizes for vertices nd edges the following Lemm holds. Lemm 2 If the sources of proper lyered DAG G = (L 1... L h, E) re in lyer L h, the sinks re in lyer L 1 nd G hs no isolted vertices then: ) v L i size(v) = length(i), i {1,..., h}, nd ) e E i size(e) = length(i), i {2,..., h} Proof: Initilly size length(i) L 1 is ssigned to ech sink nd the size is propgted towrd the sources such tht the size of non-source vertex is equl to the sum of sizes of its incoming edges nd the size of non-sink vertex is equl to the sum of sizes of its outgoing edges. Since there re no sources in lyers L i, i < h, no sinks in lyers L i, i > 1 nd no isolted vertices it is strightforwrd to see tht ) nd ) hold.

JGAA, 13(3) 319 347 (2009) 335 To proceed with our nlysis we need some definitions. A drwing of lyered grph G in the plne is lyered drwing if the vertices of every L i, 1 i h, re plced on horizontl line l i = {(x, i) x R}, nd every edge (u, v) E, u L i, v L j, 1 j < i h, is drwn s line segment etween the lines l i nd l j. A lyered drwing of G is clled lyered plnr if no two edges cross except t common endpoints. A lyered grph is lyered plnr if it hs lyered plnr drwing. A lyered drwing of G determines for every L i, 1 i h, totl order i on the vertices of L i given y the left to right order of the vertices on l i. A lyered emedding consists of permuttion of the vertices of L i for every i {1,..., h} with respect to lyered drwing. A lyered emedding with respect to lyered plnr drwing is clled lyered plnr. Theorem 2 Let G = (V, E) e proper lyered DAG with vertex prtition V = L 1 L 2... L h, where h > 1, such tht the sources re in L h nd the sinks re in L 1. DAG G dmits one-dimensionl DAGmp if nd only if it is lyered plnr. Proof: Suppose tht G dmits one-dimensionl DAGmp. Then, y Proposition 1, there is totl ordering of the intervls of vertices in L i, i {1,..., h}. The ordering of the intervls defines n ordering on the vertices of L i. Therefore the one-dimensionl DAGmp defines lyered emedding of G. We will show tht this emedding is lyered plnr. It suffices to show tht etween two consecutive lyers L i nd L i 1, i {2,..., h}, there re no edge crossings. For this, suppose tht two edges e 1 = (u 1, v 1 ) nd e 2 = (u 2, v 2 ) cross. Then u 1 < i u 2 nd v 1 > i 1 v 2 or u 1 > i u 2 nd v 1 < i 1 v 2. Without loss of generlity we ssume tht u 1 < i u 2 nd v 1 > i 1 v 2. Then I u1 < I u2 nd I v1 > I v2. The contrdiction comes from the fct tht we cnnot hve I e1 I u1 I v1 nd I e2 I u2 I v2, with length(i e1 ) 0 nd length(i e2 ) 0 nd length(i e1 I e2 ) = 0. We rrived t contrdiction ecuse we ssumed tht two edges in E i cross. Therefore the emedding is lyered plnr. Conversely, suppose tht G is lyered plnr. Then G dmits plnr lyered emedding. This emedding defines totl order on the vertices of ech lyer L i, i {1,..., h} s well s on the edges etween two lyers since for (u 1, v 1 ), (u 2, v 2 ) E i, i {2,..., h}, it holds either u 1 i u 2 nd v 1 i 1 v 2 or u 1 i u 2 nd v 1 i 1 v 2. Now, suppose tht we hve clculted the size of vertex intervls nd of edge intervls for constructing one-dimensionl DAGmp of G. In drwing, we rrnge the intervls {I v v L i }, i {1,..., h} ccording to the ordering of vertices in L i. For i {1,..., h} the intervls {I v v L i } cover the initil rectngle I nd pirwise do not overlp. Therefore they constitute prtition of I. Similrly the ordering of edges in E i, i {2,..., h} defines n ordering on the corresponding edge intervls {I e e E i } which form prtition of I. We will show tht the size nd orderings of vertices nd edges of G define one-dimensionl DAGmp of G y showing tht the constrints of Definition 1 re stisfied. Clerly constrint B1 is stisfied.

336 Tsirs, Trintfilou, Tollis DAGmps Constrint B2 is stisfied ecuse v L h size(v) = length(i) (see Lemm 2). For constrint B3 we hve tht every edge e = (u, v) E is drwn s n intervl I e of non-zero length. It remins to show tht I e I u I v. For this ssume tht e E i, i {2,..., h} nd consider how the intervls of vertices in L i 1 re relted to intervls of edges in E i. Let v 1, v 2,..., v k e the vertices of L i 1 rrnged in the order defined y the plnr lyered emedding of G. In the ordering of edges in E i the incoming edges of v 1 come first. Therefore I v1 = e Γ (v 1)I e. Assuming tht for 1 j l < k it holds tht I vj = e Γ (v j)i e we will show tht I vl+1 = e Γ (v l+1 )I e. The union e Γ (v l+1 )I e is n intervl since the incoming edges of vertex v l+1 re consecutive in the ordering of edges E i. Additionlly we hve tht intervls I vl+1 nd e Γ (v l+1 )I e strt t the sme point since I v1... I vl = ( e Γ (v 1)I e )... ( e Γ (v l )I e ) nd they hve the sme length since size(i vl+1 ) = e Γ (v l+1 ) size(i e ) = size( e Γ (v l+1 )I e ). Therefore for every w L i 1 we hve I w = e Γ (w)i e. Similrly we cn show tht for every w L i we hve I w = e Γ + (w)i e. Finlly we hve tht I e I u nd I e I v I e I u I v. From the ove rguments it follows tht constrints B5 nd B6 re stisfied. Constrint B4 is stisfied when two edges elong to the sme edge set E i, i {2,..., h} since the set {I e e E i } is prtition of intervl I. Now, suppose tht e 1 = (u 1, v 1 ) nd e 2 = (u 2, v 2 ) re two edges such tht: ) v 1 L i nd u 2 L j with i > j, ) there is no pth from v 1 to u 2 nd c) length(i e1 I e2 ) 0. We will show tht these ssumptions led to contrdictions. We hve: I e1 I v1 nd I e2 I u2. Therefore I e1 I e2 I v1 I u2 length(i v1 I u2 ) 0. This together with eqution I v1 = e Γ + (v 1)I e imply tht there is n outgoing edge o 1 = (v 1, w 1 ) of vertex v 1 such tht its intervl I o1 overlps with intervl I u2. Therefore length(i o1 I u2 ) 0 length(i w1 I u2 ) 0. If w 1 = u 2 then there is pth from v 1 to u 2, contrdiction. If w 1 u 2 then vertex w 1 nd u 2 do not elong to the sme lyer since length(i w1 I u2 ) 0. Therefore i 1 > j. Continuing in this wy we rgue tht there is n outgoing edge o 2 = (w 1, w 2 ) of vertex w 1 such tht its intervl I o2 overlps with intervl I u2, nd so on. This procedure termintes fter finite numer of steps nd leds either to pth from v 1 to u 2 or to vertex w l tht elongs to lyer L j such tht length(i wl I u2 ) 0. The first conclusion contrdicts with the hypothesis tht there is no pth from v 1 to u 2, while the second contrdicts with the hypothesis tht the set {I v v L j } is prtition of intervl I. We rrive t contrdictions ecuse we ssumed tht edge intervls I e1 nd I e2 overlp lthough there is no pth from dest(e 1 ) to orig(e 2 ). Therefore constrint B4 is stisfied. From the ove theorem it follows tht the ONE-DIMENSIONAL DAGMAP prolem is reduced to LAYER PLANARITY TEST. The lter prolem cn e decided in liner time. When the LAYER PLANARITY TEST lgorithm indictes tht lyered grph G is lyered plnr then plnr emedding of G cn e otined in liner time using lgorithm LAYER PLANAR EMBED [11].

JGAA, 13(3) 319 347 (2009) 337 Algorithm 2 ONE-DIMENSIONAL DAGMAP TEST Input: lyered DAG G = (L 1... L h, E) tht is proper nd hs its sources in lyer L h nd its sinks in lyer L 1. Output: true if G dmits one-dimensionl DAGmp, nd flse otherwise. 1. return LAYER-PLANARITY-TEST(G) Algorithm 3 ONE-DIMENSIONAL DAGMAP DRAW Input: plnr lyered DAG G = (L 1... L h, E) tht is proper nd hs its sources in lyer L h nd its sinks in lyer L 1, nd rectngle R. Output: DAGmp drwing of G. 1. Find plnr emedding of G using lgorithm LAYER-PLANAR-EMBED. 2. Assign sizes to vertices nd edges of G. 3. Using the orderings nd sizes of vertices nd edges drw G. Theorem 3 Every lyered DAG G = (L 1... L h, E), tht is proper nd hs its sources in lyer L h nd its sinks in lyer L 1, cn e recognized for whether it dmits one-dimensionl DAGmp or not in time O(m). If G dmits one-dimensionl DAGmp then drwing of G cn e produced in time O(n). 3.3 Minimiztion of Vertex Duplictions in One-Dimensionl DAGmps Motivted y Algorithms 2 nd 3 we pose the question of whether n h-lyer grph G 1, tht is proper nd hs its sources in lyer L h nd its sinks in lyer L 1, cn e trnsformed into plnr h-lyer DAG G 2 y performing minimum numer of vertex duplictions. We will show tht the prolem of minimizing the vertex duplictions tht re needed in order to convert G 1 into G 2 is NP-hrd. Prolem 2 (DUPLICATIONS IN ONE-DIMENSIONAL DAGMAPS) INSTANCE: A DAG G 1 nd n integer K. QUESTION: Cn G 1 e trnsformed into DAG G 2 tht dmits one-dimensionl DAGmp y duplicting t most K vertices? When the input is restricted to two-lyer DAGs where ech first-lyer vertex hs in-degree two, the ove prolem is relted to TWO-LAYER PLANARIZA- TION prolem. Definition 6 A cterpillr is connected grph tht hs pth clled the ckone such tht ll vertices of degree lrger thn one lie on. The edges of cterpillr tht re not on the ckone re the legs of the cterpillr. Lemm 3 [7] A two-lyer grph G = (L 1 L 2, E) is two-lyer plnr if nd only if it is collection of disjoint cterpillrs.

338 Tsirs, Trintfilou, Tollis DAGmps Prolem 3 (TWO-LAYER PLANARIZATION) INSTANCE: A positive integer K nd two-lyer grph G = (L 1 L 2, E). QUESTION: Cn G e mde two-lyer plnr y deleting t most K edges? Theorem 4 [7] The TWO-LAYER PLANARIZATION prolem is NP-complete nd remins NP-complete when ech vertex in L 1 hs degree two. Theorem 5 The DUPLICATIONS IN ONE-DIMENSIONAL DAGMAPS prolem is NP-complete nd remins NP-complete even when the input is restricted to simple two-lyer DAGs where ech first-lyer vertex hs in-degree two. Proof: The prolem elongs to NP since given K vertex duplictions we cn check in liner time if the trnsformed DAG dmits one-dimensionl DAGmp. We will show tht the prolem is NP-hrd y reducing the TWO-LAYER PLA- NARIZATION prolem to it. The reduction is trivil. Let G e two-lyer DAG, where ech first-lyer vertex hs in-degree two. If e = (u, v) is n edge of G then deletion of the edge corresponds to dupliction of vertex v. Conversely, dupliction of vertex v corresponds to deletion of one of two edges tht re incident to v. Suppose tht the TWO-LAYER PLANARIZATION prolem hs solution. Then there re K edges {e 1, e 2,..., e K } whose deletion leds to grph G 2 tht is two-lyer plnr. According to Lemm 3, the grph G 2 is collection of disjoint cterpillrs. Let {v 1, v 2,..., v K } e the first lyer vertices incident to edges {e 1, e 2,..., e K }. Now suppose tht if insted of deleting the edges {e 1, e 2,..., e K }, we duplicte the vertices {v 1, v 2,..., v K }, nd let {v 1, v 2,..., v K } e the replics of vertices {v 1, v 2,..., v K } which re ttched to edges {e 1, e 2,..., e K }. The new grph, cll it G 3, is collection of disjoint cterpillrs. This is ecuse if we ignore the edges {e 1, e 2,..., e K } nd the incident vertices {v 1, v 2,..., v K }, grph G 3 is equl to grph G 2 which is collection of disjoint cterpillrs. Then, since vertices {v 1, v 2,..., v K } hve degree one the incident edges {e 1, e 2,..., e K } cn e considered s legs ttched to the ckone of some cterpillr. This implies tht G 3 is cterpillr nd from Lemm 3 it follows tht G 3 is two-lyer plnr. Then, from Theorem 2, it follows tht G 3 dmits one-dimensionl DAGmp. Conversely, suppose tht the DUPLICATIONS IN ONE-DIMENSIONAL DAGMAPS prolem hs solution nd let {v 1, v 2,..., v K } e set of K vertices whose dupliction leds to DAG G 3 tht dmits DAGmp drwing. According to Theorem 2, DAG G 3 is two-lyer plnr. DAG G 3 remins two-lyer plnr if we delete one of the two replics of vertices {v 1, v 2,..., v K } together with the incident edge. This corresponds to the deletion of K edges from the initil grph G. Therefore the TWO-LAYER PLANARIZATION prolem hs solution. We showed tht the DUPLICATIONS IN ONE-DIMENSIONAL DAGMAPS prolem hs solution if nd only if the TWO-LAYER PLANARIZATION prolem hs solution. Therefore the prolem is NP-complete.

JGAA, 13(3) 319 347 (2009) 339 4 The Generl Cse 4.1 The Recognition Prolem Suppose tht we hve lyered DAG. Tking the vertices of lyer L k isolted from the rest of the DAG, the prolem is similr to floorpln prolem where the initil rectngle is dissected into n k = L k soft rectngles, i.e., rectngles whose re is fixed ut their dimensions my vry. The numer of possile dissections (the solution spce) is ounded elow y Ω(n k!2 3n /n 4 k ) nd ove y O(n k!2 5n /n 4.5 k ) [14]. Considering two consecutive lyers L k+1 nd L k of DAG, the lyouts of the two lyers re constrined y the edges mong the two lyers, ccording to the drwing rules. The comined solution spce my e empty or contin numer of solutions. We will show tht deciding whether the solution spce is empty or not is NP-complete. We cll this decision prolem DAGMAP nd we define it s: Prolem 4 (DAGMAP) INSTANCE: A DAG G. QUESTION: Does G dmit DAGmp? Our hrdness result for DAGMAP is sed on trnsformtion from the following decision prolem. Prolem 5 (3-PARTITION) INSTANCE: A multiset A of 3m positive integers A = {α 1, α 2,..., α 3m } where the α i s re ounded ove y polynomil in m nd Σ 4 < α i < Σ 2, where Σ = 1 m (α 1 + α 2 +... + α 3m ). QUESTION: Cn A e prtitioned into m triples A 1, A 2,..., A m such tht ech triple hs the sme sum? Specificlly ech triple must sum to Σ. 3-PARTITION is strongly NP-complete since it remins NP-complete even when representing the numers in the input instnce in unry [8]. The condition Σ 4 < α i < Σ 2 forces every set of α i s summing to Σ to hve size exctly 3. Theorem 6 The DAGMAP prolem is NP-complete even if we restrict it to forests of two-lyer DAGs. Proof: Given dissection of the initil drwing rectngle into L k rectngles for ech lyer L k, k {1,..., h} of DAG G, we cn check in polynomil time if these dissections correspond to DAGmp drwing of G. Moreover, in the VLSI lyout literture, there re few techniques for succinctly encoding the prtition of rectngle into soft rectngles [14]. Therefore the DAGMAP prolem elongs to NP. Next we will show tht DAGMAP is NP-hrd. Given n instnce A = {α 1, α 2,..., α 3m } of 3-PARTITION we will construct forest of two-lyer DAGs tht dmits DAGmp drwing if nd only if the 3-PARTITION prolem hs solution.

340 Tsirs, Trintfilou, Tollis DAGmps lyer 2 lyer 2 lyer 1 α i vertices () DAG G αi nd one possile drwing of it α 1 α 2 α 3 α 4 α 5 α 3m () An exmple of the mpping from integers α i to rectngles of re α i Figure 15: To ech α i A we correspond DAG G αi with α i + 1 vertices nd to G αi we correspond drwing rectngle R αi of re α i. Without loss of generlity we ssume tht the first-lyer vertices of DAG re drwn in unit re rectngles. For ech α i A we consider two-lyer DAG G αi which hs one vertex in lyer two nd α i vertices in lyer one. The second-lyer vertex is drwn s rectngle, R αi, with re α i, ut without ny constrint on the spect rtio of its sides. The first-lyer vertices re drwn s unit re rectngles y slicing with prllel horizontl line segments the rectngle of the second-lyer vertex (Figure 15). The totl re occupied y rectngles R αi, i {1, 2,..., 3m} is α 1 + α 2 +... + α 3m = mσ. We wnt to drw rectngles R αi, i {1, 2,..., 3m} on m equl nd pirwise isolted rectngulr regions inside the initil rectngle R. To do this we consider n dditionl DAG whose drwing leves m empty rectngulr regions (gps), ech of re Σ. We cll this dditionl DAG the enforcer, since its drwing enforces the previously defined 3m rectngles to e drwn inside the m gps. The shpe of the enforcer is unique up to left, right, up or down orienttion inside the initil rectngle R (Figure 16). In the following, without loss of generlity, we ssume tht the shpe of the enforcer is similr to the one of Figure 16(). Enforcer: The DAG used s enforcer (Figure 17) hs 2m + 2 vertices on the second lyer, the vertices β nd 1, 2,..., 2m + 1. Every odd numered vertex hs Σ exclusive out-neighors, while for the even numered vertices there re no exclusive out-neighors. Therefore vertices 1, 3,..., 2m+1 hve Σ more re thn vertices 2, 4,..., 2m. The role of vertex β nd of first-lyer vertices with in-degree greter thn one is to lign rectngles R 1, R 2,..., R 2m+1 nd to force

JGAA, 13(3) 319 347 (2009) 341 () One possile drwing () Another possile drwing Figure 16: The drwing of the enforcer leves m gps, ech of re Σ. β used for lignment 1 2 3 2m 2m+1 1 2 3 2m 2m+1 γ 2m+1 vertices used for lignment used to complete the drwing used for djcency Σ vertices Figure 17: The DAG used s enforcer in the proof. rectngles R i nd R i+1, i {1, 2,..., 2m} to e djcent. Ech of the first-lyer vertices 1, 2,..., (2m+1) hs two in-neighors. One is vertex β nd the other is the corresponding numered second-lyer vertex. In the drwing rectngle R β is djcent to ll rectngles R 1, R 2,..., R 2m+1. Therefore rectngles R 1, R 2,..., R 2m+1 should e drwn round the sides of rectngle R β. Rectngle R γ is drwn on top of rectngles R 1, R 2,..., R 2m+1 nd hs zero re intersection with rectngle R β. Therefore it forces rectngles R 1, R 2,..., R 2m+1 to e drwn consecutively long one side of rectngle R β. Additionlly, since the re of rectngle R γ is eqully distriuted mong rectngles R 1, R 2,..., R 2m+1, it forces these rectngles to hve the sme width. The second-lyer vertices i nd i + 1, i {1, 2,..., 2m} hve common outneighor which constrins their rectngles to e djcent. The second common out-neighor of vertices i nd i + 1, is used for completing the drwing. Also for completing the drwing, vertex 1 hs n exclusive out-neighor nd similrly vertex 2m+1. To sum up, the first lyer hs (m+1)σ+6m+4 vertices nd therefore the totl re occupied y the drwing of the enforcer is (m + 1)Σ + 6m + 4

342 Tsirs, Trintfilou, Tollis DAGmps Lyer 2 vertices β 1 2 3 4 5 2m 2m+1 Lyer 1 vertices 1 2 3 4 5 γ 2m 2m+1 Σ vertices Figure 18: One possile drwing of the enforcer. () Three rectngles () One wy to fill the gp (c) Another wy to fill the gp Figure 19: An exmple of how three rectngles, of totl re Σ, fill gp. (Figure 18). The totl re occupied y the drwings of the enforcer nd of DAGs G αi, i {1, 2,..., 3m} is: ((m+1)σ+6m+4)+mσ = (2m+1)(Σ+3)+1. Now suppose tht the 3-PARTITION instnce hs solution. Then the elements of A cn e prtitioned into m triples A 1, A 2,..., A m such tht ech triple hs sum Σ. Then the rectngles tht correspond to the elements of triple fit exctly into gp of re Σ (Figure 19). Therefore the DAGMAP prolem hs solution. Conversely, if the DAGMAP prolem hs solution then the 3m rectngles fill ll the gps. From the condition Σ 4 < α i < Σ 2 on the 3-PARTITION numers

JGAA, 13(3) 319 347 (2009) 343 nd therefore on the rectngle res, gp is filled y exctly three rectngles. Therefore the 3m rectngles re prtitioned into m triples ech of totl re Σ. This prtition is lso solution to the 3-PARTITION instnce. The reduction from the 3-PARTITION to DAGMAP uses polynomil numer of resources since the numers involved in 3-PARTITION re positive integers ounded y polynomil in m. Note tht one cn chieve the geometric construction using simple geometric opertions. Theorem 7 The DAGMAP recognition prolem remins NP-complete even if the input is two-lyer DAG. Proof: The reduction is similr to the one in Theorem 6. The differences re: 1. The enforcer nd the 3m DAGs of Theorem 6 now form single two-lyer DAG insted of forest of DAGs. 2. The α i vertices hve α i 1 exclusive out-neighors insted of α i. 3. Ech of vertices 1, 3,..., 2m + 1 hs Σ 1 exclusive out-neighors insted of Σ. Vertices 1, 3,..., 2m+1 hve Σ more re thn vertices 2, 4,..., 2m. In drwing, rectngle R δ is djcent to ech one of rectngles R 1, R 3,..., R 2m+1, since for i {1, 3,..., 2m + 1}, vertices δ nd i hve one common out-neighor (Figure 20). Their second common out-neighor exists for completing the drwing. Rectngles R αi, i {1, 2,..., 3m} hve re equl to α i nd re djcent to rectngle R δ, since ech vertex α i nd vertex δ hve common out-neighor. Their second common out-neighor is used for completing the drwing. Similrly, vertex δ hs nother (2m+1)(Σ 2)+1 exclusive out-neighors. Therefore the re of rectngle R δ is (2m + 1)(Σ 2) + 1 + 3m + (m + 1) = (2m + 1)Σ nd its horizontl nd verticl sides hve lengths 2m + 1 nd Σ respectively. The djcency reltions etween the second-lyer vertices 1, 2, 3,..., 2m+1, β nd δ leds to shpe hving m gps, ech one of re Σ (Figure 20). The drwing position of rectngles R αi, i {1, 2,..., 3m} is not fixed. The only constrint is tht they should e djcent to rectngle R δ. However, in order to hve rectngulr drwing, triples of rectngles R αi should fill the gps. Since rectngles R αi re djcent to rectngle R δ the only wy tht ech of them is drwn inside gp is with verticl side of length Σ nd horizontl side of length α i Σ. The first-lyer vertices tht re djcent to vertex δ nd to vertex α i hve drwing with verticl side of length 2Σ nd horizontl side of length 1 2Σ. If the 3-PARTITION prolem hs solution then triples of rectngles R αi, i {1, 2,..., 3m} fit exctly into the gps of the drwing nd therefore the DAG dmits DAGmp. Conversely, if the DAG dmits DAGmp then rectngles R αi, i {1, 2,..., 3m} fill ll the gps of the drwing. And since exctly three rectngles cn fill gp, the solution of the DAGMAP instnce provides prtitioning of integers α i into m triples, ech of size Σ.

344 Tsirs, Trintfilou, Tollis DAGmps 4.2 Minimiztion of Vertex Dupliction Prolem 6 (DUPLICATIONS IN DAGMAPS) INSTANCE: A DAG G 1 nd n integer K. QUESTION: Cn G 1 e trnsformed into DAG G 2 tht dmits DAGmp y duplicting t most K vertices. Comment: The prolem DUPLICATIONS IN DAGMAPS is NP-hrd since its restriction for K = 0 is the prolem DAGMAP, which is NP-complete. 5 Discussion In this pper we introduced the prolem of drwing DAG using spce filling techniques. We defined the recognition nd vertex dupliction minimiztion prolems nd we showed tht in the generl cse they re NP-complete nd NP-hrd respectively. We lso considered two specil cses y restricting the form of the DAG nd of the DAGmp respectively. We re currently investigting drwing heuristics sed on relxtions of the drwing constrints nd/or restrictions on the form of DAGs. The results of this reserch will e pulished in susequent pper concerning the ppliction of these techniques to hierrchiclly orgnized ontologies. Acknowledgments The uthors wish to thnk Dimitris Andreou for providing us his grph lirry nd the nonymous referees for severl useful suggestions tht improved the qulity of the pper.

JGAA, 13(3) 319 347 (2009) 345 β Vertices tht correspond to the elements of the multiset A 1 2 3 2m 2m+1 δ α 1 α 3m Σ-1 Σ-1 Σ-1 (2m+1). (Σ-2) α 1-1 3m -1 vertices vertices vertices + 1 vertices vertices vertices () Only the new connections re shown Lyer 2 vertices β 1 2 3 2m 2m+1 Lyer 1 vertices 1 2 3 γ 2m 2m+1 A gp Σ-1 rectngles A triple of Rα i fills gp Σ-3 rectngles δ Cn this triple fill this gp? (2m+1). (Σ-2)+1 Ech one of these rectngles rectngles correspond to vertices tht re djcent to δ nd to one of α i vertices () One possile drwing Figure 20: The enforcer of the reduction in Theorem 7.

346 Tsirs, Trintfilou, Tollis DAGmps References [1] M. Ashurner, C. A. Bll, J. A. Blke, D. Botstein, H. Butler, J. M. Cherry, A. P. Dvis, K. Dolinski, S. S. Dwight, J. T. Eppig, M. A. Hrris, D. P. Hill, L. Issel-Trver, A. Ksrskis, S. Lewis, J. C. Mtese, J. E. Richrdson, M. Ringwld, G. M. Ruin, nd G. Sherlock. Gene Ontology: tool for the unifiction of iology. The Gene Ontology Consortium. Nture Genetics, 25(1):25 29, 2000. [2] E. H. Behrecke, N. Dng, K. Bri, nd B. Shneidermn. Visuliztion nd nlysis of microrry nd gene ontology dt with treemps. BMC Bioinformtics, 5:84, 2004. [3] O. Beumont, V. Boudet, F. Rstello, nd Y. Roert. Prtitioning squre into rectngles: NP-completeness nd pproximtion lgorithms. Algorithmic, 34(3):217 239, 2002. [4] B. B. Bederson, B. Shneidermn, nd M. Wttenerg. Ordered nd quntum treemps: Mking effective use of 2D spce to disply hierrchies. ACM Trnsctions on Grphics, 21(4):833 854, 2002. [5] M. Bruls, K. Huizing, nd J. vn Wijk. Squrified treemps. In W. de Leeuw nd R. vn Liere, editors, Dt Visuliztion 2000, Proceedings of the Second Joint Eurogrphics nd IEEE TCVG Symposium on Visuliztion, pges 33 42, 2000. [6] G. Di Bttist, P. Edes, R. Tmssi, nd I. G. Tollis. Grph Drwing: Algorithms for the Visuliztion of Grphs. Prentice Hll, Upper Sddle River, NJ, 1998. [7] P. Edes nd S. Whitesides. Drwing grphs in two lyers. Theoreticl Computer Science, 131(2):361 374, 1994. [8] M. R. Grey nd D. S. Johnson. Complexity results for multiprocessor scheduling under resource constrints. SIAM Journl on Computing, 4(4):397 411, 1975. [9] D. Holten. Hierrchicl edge undles: Visuliztion of djcency reltions in hierrchicl dt. IEEE Trnsctions on Visuliztion nd Computer Grphics, 12(5):741 748, 2006. [10] B. Johnson nd B. Shneidermn. Tree-mps: spce-filling pproch to the visuliztion of hierrchicl informtion structures. In Proceedings of the IEEE Visuliztion 91, pges 284 291, 1991. [11] M. Jünger nd S. Leipert. Level plnr emedding in liner time. Journl of Grph Algorithms nd Applictions, 6(1):67 113, 2002. [12] S. Liu, N. Co, nd H. Lv. Interctive visul nlysis of the NSF funding informtion. In IEEE Pcific Visulistion Symposium 2008, pges 183 190, 2008.

JGAA, 13(3) 319 347 (2009) 347 [13] H. Lü nd J. Fogrty. Cscded treemps: exmining the visiility nd stility of structure in treemps. In ACM Proceedings of grphics interfce 2008, pges 259 266, 2008. [14] Z. C. Shen nd C. C. N. Chu. Bounds on the numer of slicing, mosic, nd generl floorplns. IEEE Trns. on CAD of Integrted Circuits nd Systems, 22(10):1354 1361, 2003. [15] B. Shneidermn. Tree visuliztion with tree-mps: 2-d spce-filling pproch. ACM Trnsctions on Grphics, 11(1):92 99, 1992. [16] A. Symeonidis, I. G. Tollis, nd M. Reczko. Visuliztion of functionl spects of microrna regultory networks using the gene ontology. In IS- BMDA, volume 4345 of LNCS, pges 13 24. Springer, 2006. [17] J. Vldes, R. E. Trjn, nd E. L. Lwler. The recognition of series prllel digrphs. SIAM Journl on Computing, 11(2):298 313, 1982. [18] J. J. vn Wijk nd H. vn de Wetering. Cushion treemps: Visuliztion of hierrchicl informtion. In INFOVIS 99: Proceedings of the 1999 IEEE Symposium on Informtion Visuliztion, pges 73 78, 1999.