Journal of Graph Algorithms and Applications http://www.cs.brown.edu/publications/jgaa/ vol. 6, no. 1, pp. 3–5 (2002)
Graph Drawing and Representations Special Issue on Selected Papers from the Seventh International Symposium on Graph Drawing, GD’99 Guest Editors’ Foreword Hubert de Fraysseix CNRS UMR 8557 — E.H.E.S.S. 54 Bd Raspail, 75006 Paris, France http://www.ehess.fr/centres/cams/person/hf
[email protected] Jan Kratochv´ıl Department of Applied Mathematics and Institute for Theoretical Computer Science Charles University Malostransk´e n´ am. 25, 188 00 Praha 1, Czech Republic http://www.ms.mff.cuni.cz/acad/kam/kratochvil
[email protected] GD’99 was supported in part by DIMATIA Charles University and Czech Research ˇ 201/99/0242. Editorial work on this volume was partially supported grant GACR by the Institute for Theoretical Copmputer Science of Charles University (project LN00A056 of the Ministry of Education of the Czech Republic).
H. de Fraysseix and J. Kratochv´ıl, Foreword , JGAA, 6(1) 3–5 (2002)
1
4
A few words about the conference
This special issues features contributions based on five of the papers and one of the invited talks presented at GD’99 at Stirin Castle in the vicinity of Prague, Czech Republic. The conference brought together researchers, practitioners, developers and users working on all aspects of graph visualization and representations. The issues considered in graph drawing range from geometry, topology, partially ordered sets and graph theory, through algorithms and complexity theory to practical systems and applications. The interaction between theoretical advances and implemented solutions has always been an important part of the graph drawing field and of the Graph Drawing Symposia. In a recently restored baroque castle 30 km out of Prague, the participants were less distracted by the numerous opportunities of day and nightlife attractions of the fabulous city. The English style gardens of the castle provided opportunities for walks and discussions, the artistic atmosphere of the castle was enhanced by the conference concert given by Jiˇr´ı Stiv´ın, a prominent Czech jazz musician, and by the invited talk “Art of drawing” by Jaroslav Neˇsetˇril, who is also a prominent Prague painter. It is our pleasure to include a paper based on this talk in our volume. In total 38 papers were accepted and presented during the conference. Five of these papers were invited for this special volume. All of them went through further rigorous refereeing process. Also because of this, but from other reasons as well, the papers in this volume differ substantially from their proceedings versions. Most of them are presented in more detail, and therefore became significantly longer. In one case, on the other hand, the new version became considerably shorter than the conference one. This is because a stronger and more general theorem was proven by the author in the meantime. We believe that both publishing new stronger results as well as including more details to other papers’ results and proofs will be welcome and appreciated and justifies the 2 year span between the conference and the appearance of this special volume. We would like to thank the authors for their patience and the referees for their hard work.
2
A few words about the papers
The first and last papers of the volume are devoted to geometrical representations of graphs or partially ordered sets. The question if every planar graph allows a representation as an intersection graph of straight line segments has now become a well known problem in the area, with names as Fellows, Pach, Pollack, Scheinerman and Erd¨ os attached to various partial results and variants of the problem. It is well known that planar bipartite graphs are even contact graphs of segments. The result stating that planar trianglefree graphs are intersection graphs of segments in three directions in the plane proved in Trianglefree planar graphs and segment intersection graphs by de Castro, Cobos, Dana, Marquez and Noy is still today, 2 years after the GD’99 conference,
H. de Fraysseix and J. Kratochv´ıl, Foreword , JGAA, 6(1) 3–5 (2002)
5
the strongest result in the area. The paper Planar Graphs with Topological Constraints by Dornheim considers the question of drawing graphs under certain topological constraints, namely of the form that a vertex is inside or outside a particular cycle in the graph. This novel approach is treated very thoroughly and a number of NPcompleteness results and polynomial time algorithms are presented. J¨ unger and Leipert in their paper Level Planar Embedding in Linear Time provide a second step towards automatic drawing of level planar graphs. At GD’98, J¨ unger, Leipert and Mutzel presented a linear time algorithm for recognizing level planar graphs. The step from recognition to actual construction of an embedding, which is definitely not straightforwardly linear time, is presented in this paper. Drawing planar graphs on a prescribed locations of vertices is an important question, both from theoretical and practical points of view. The paper Embedding Vertices at Points: Few Bends suffice for Planar Graphs by Kaufmann and Wiese show (among other results) that every 4connected planar graph can be embedded on any given point set with at most one bend per edge, while this question is NPcomplete for general planar graphs. The invited talk of Jarik Neˇsetˇril about “Art of drawing” was very well accepted by the participants of GD’99. It is true that the speaker talked slightly more about art and drawings than about graphs, but the audience learned a lot from this talk about the meaning and significance of drawings. After the recent development in the area, namely the talk of the author at the symposium Graph Drawing 2001 in Vienna (coauthored by J. Adamec), we have asked Neˇsetˇril to prepare a paper stemming from his earlier presentation which would, however, reflect and comment on the new notion of fractal length or combinatorial entropy of drawings. We appreciate very much that he was willing to prepare this contribution in such a short time, so that it is possible to include it in the present volume. The last paper of the volume, Realization of Posets by Ossona de Mendez is another paper on geometric representations. It presents a very general result on representations of partially ordered sets which, among others, generalizes a famous result of Schnyder about incidence posets of planar graphs.
Journal of Graph Algorithms and Applications http://www.cs.brown.edu/publications/jgaa/ vol. 6, no. 1, pp. 7–26 (2002)
TriangleFree Planar Graphs as Segment Intersection Graphs Natalia de Castro
Francisco Javier Cobos Alberto M´ arquez
Juan Carlos Dana
Departamento de Matem´ atica Aplicada I Universidad de Sevilla http://www.ma1.us.es/ {natalia, cobos, dana, almar}@us.es
Marc Noy ∗ Departamento de Matem´ atica Aplicada II Universitat Polit`ecnica de Catalunya http://www.upc.es/
[email protected] Abstract We prove that every trianglefree planar graph is the intersection graph of a set of segments in the plane. Moreover, the segments can be chosen in only three directions (horizontal, vertical and oblique) and in such a way that no two segments cross, i.e., intersect in a common interior point. This particular class of intersection graphs is also known as contact graphs.
Communicated by H. de Fraysseix and and J. Kratochv´ıl: submitted October 1999; revised February 2001 and July 2001.
∗
Partially supported by projects SEUIPB980933 and CUR Gen. 1999SGR00356.
Cat.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
1
8
Introduction
Given a set S of segments in the plane, its intersection graph has a vertex for every segment and two vertices are adjacent if the corresponding segments intersect. Intersection graphs of segments and other geometrical objects have been widely studied in the past. For instance, if the segments are contained in a straight line then we have the interval graphs [5], a wellknown family of perfect graphs. If the segments are chords of a circle then the intersection graph is called a circle graph, see for instance [8, 10]. An interesting result, due to de Fraysseix, Osona de Mendez and Pach [4], and independently to BenArroyo Hartman, Newman and Ziv [2], says that every planar bipartite graph is the contact graph (a particular case of intersection graph, where no two segments cross) of a set of horizontal and vertical segments and, in a different formulation, Tamassia and Tollis proved in [11] almost the same result. On the other hand, it is known that the recognition of such graphs is an NPcomplete problem (see [6], [7] and recently [3]). This result provides a partial answer to a question of Scheinerman [9]: Is every planar graph the intersection graph of a set of segments in the plane? The main result in this paper, which is a significant extension of [4], is that every trianglefree planar graph is the intersection graph of a family of segments. Moreover, the segments can be drawn in only three directions and in such a way that they do not cross, i.e. the segments do not have any interior point in common. This particular class of intersection graphs is also known as contact graphs. We call such a representation a segment representation of the graph.
v1
h1
o1
h1 o2
v2 v4
v3
v5
v1
v2
v3
v5
v4
o2
h2
h3
h5 h4
h3
h2
o3
h4
v7
o1
v6 h6
v6
o3 h5 v7
h6
Figure 1: A segment representation of a planar graph.
Our technique is similar in spirit to the one used in [2] for bipartite planar graphs with some transformations. A key point in our proof is Gr¨ otzsch’s Theorem [12], which guarantees that every planar trianglefree graph is 3colorable.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
9
The sketch of the proof is as follows. Fixing an embedding of a given trianglefree planar graph G, adding new vertices and (induced) paths between the vertices of the graph we can obtain a new trianglefree graph embedded in the plane which is a subdivision of a 3connected graph. Starting with a 3coloring, a segment representation in three directions is obtained for this new graph using several technical lemmas. Finally, removing the dummy vertices and paths, we obtain a segment representation of the graph G. The three directions considered are horizontal, vertical and oblique (parallel to the bisector of the second quadrant of the plane).
2
Pseudoconvex faces with three directions
In this section we present some preliminaries and we indicate the basic techniques that are used. Let G be a planar graph, and consider a fixed embedding of G in the plane. The embedding divides the plane into a number of regions that we call faces of the graph. Let IG be a segment representation of G. We assume throughout the paper that no segment continues beyond its last intersection with a segment in another direction. The segment representation also partitions the plane into regions which we call faces of the representation, whose are simple npolygons (if n ≥ 4, there is no pair of nonconsecutive edges sharing a point). The proof of our main result is based on adapting the concept of “convex polygon” for segments in three directions. A segment path of length n is a sequence of horizontal, vertical and oblique segments P = {s1 , . . . , sn } such that segment si intersects si−1 and si+1 , for 1 < i < n. A segment path P = {s1 , . . . , sn } is said to be monotone with respect to a straight line l if any line orthogonal to l intersects P in exactly one point. We consider monotone paths of the segment representation with respect to the following two lines: the bisector of the second quadrant of the plane (l1 = {x + y = 0}) and the line (l2 = {x − 2y = 0}). Since we can draw a monotone path rightward or leftward, we distinguish four different kinds of monotone paths: • A path P is an increasing monotone path to the right (IMPR) if its horizontal segments are drawn rightward, its vertical segments are drawn upward, and its oblique segments are drawn rightward and downward. • A path P is a decreasing monotone path to the right (DMPR) if its horizontal segments are drawn rightward, its vertical segments are drawn downward, and its oblique segments are drawn rightward and downward. • A path P is a decreasing monotone path to the left (DMPL) if its horizontal segments are drawn leftward, its vertical segments are drawn downward, and its oblique segments are drawn leftward and upward.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
10
• A path P is an increasing monotone path to the left (IMPL) if its horizontal segments are drawn leftward, its vertical segments are drawn upward, and its oblique segments are drawn leftward and upward.
s1
DMPL sn IMPL
DMPR
sn
IMPR s1
Figure 2: Monotone paths. Let IG be a segment representation of a plane trianglefree graph G. Recall that the face boundaries of the representation correspond to closed walks in G. A face F of a segment representation is pseudoconvex if its boundary can be divided into an IMPR, a DMPR, a DMPL and an IMPL (clockwise). It can be seen that the partition of a pseudoconvex face into monotone paths is not unique, but there are only a few possibilities and this does not modify the proofs of the theorems. From now on, we consider the boundary of a pseudoconvex face clockwise.
IMPR DMPR
F
IMPL
DMPL
Pseudoconvex Face
Non Pseudoconvex Face
Figure 3: The four paths of a pseudoconvex face.
Given a pseudoconvex face, we define the upper subpath as the union of its IMPR and its DMPR and, the lower subpath as the union of its DMPL and IMPL subpath. Analogously, we define the right subpath as the union of the DMPR and DMPL, and the left subpath as the union of the IMPL and IMPR. In this way the boundary of a pseudoconvex face can be considered as the
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
11
union of the upper and lower subpaths, and also as the union of the right and left subpaths. We say that the upper and lower subpaths are opposite subpaths to each other (analogously with the right and the left subpaths).
Left subpath Right subpath
Upper subpath
F Lower subpath
Figure 4: The upper, lower, right and left subpaths of a pseudoconvex face. Note that if F is a pseudoconvex face, and P is a monotone path inside F connecting two segments in its boundary, then P partitions F into two new pseudoconvex faces. Moreover, if two segments on the boundary of F can be extended inside F until they cross, those extended segments also would split F into two new pseudoconvex faces. In order to build a segment representation of a plane graph G, we proceed by representing the boundary of the outerface of G by contact segments, using a pseudoconvex representation. If two vertices of the outerface are joined in G by a path, we represent this path as a monotone segment path inside the representation of the outerface, obtaining two pseudoconvex faces. Recursively we represent monotone paths of G until the representation of the graph is completed. We see then that in order to represent a graph by contact segments it is necessary to join segments by segment paths inside the faces of the representation. We need to extend segments of the boundary of the faces inside them to contact the segments. However it is not always possible to extend segments inside a pseudoconvex face. A segment of a pseudoconvex is extensible along one of its ends if and only if its angle inside the face is concave. Thus, a segment of a pseudoconvex face is extensible by one of its ends, or by both or by none, depending on the adjacent segments (see Figure 5).
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
12
Nonextensible Extensible by one Extensible end by both ends
Figure 5: Extensible segments.
It is obvious that in order to join two segments inside a pseudoconvex face, one of them must be extended, but this is not sufficient in general as we can see in Figure 6: segment r2 can be extended inside F , but we can not join it with r1 because r2 intersects other segments of the face. The segment r3 can be also extended inside the face, but we cannot join r1 with r3 because they never contact.
r1
r2 r3
Figure 6: Extension of segments.
According to the above remark, we have two different problems when we try to join segments inside a pseudoconvex face; when the segments can be extended inside the face, but they find some “obstacle” before the intersection (other segments of the face), and on the other hand when the segments cannot be extended or they never contact. To solve these problems we define two basic operations in the segment representation. The first operation is enlarging a segment of the representation, and the second one is changing the sense of drawing of some segments. Although we are interested in some specific segments, these operations will transform other segments of the representation.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
13
Enlarging a segment means to increase its length, and obviously we also need to increase the length of other segments of the representation and make a translation of other segments without modifying their length. With this operation we can keep away the obstacles and to overlap parallel segments, if we want to join them by a segment path. The other operation allows us to extend a segment by one of its ends, if it was not possible before. It changes the sense of drawing of its adjacent segment and the other segments of its monotone path, to preserve the pseudoconvexity of the face.
Figure 7: Transforming the segment representation. The following technical lemmas allow us to construct a topological equivalent representation where we modify some segments, allowing to join the segments by a path of any length. Lemma 1 Let IG be a segment representation of a subdivision of a 3connected plane graph G such that all its faces are pseudoconvex, let k be a positive real number and let s be a segment on the boundary of a face F of IG . Then IG can be transformed into another segment representation IG satisfying: 1. IG is topologically equivalent to IG (that is, the faces of IG and IG have the same facial walks), and the faces of IG are pseudoconvex; 2. it is possible to enlarge s (and at most two segments on the opposite subpath of F ), such that the length of s in IG is k + l.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
14
Proof: The proof is by induction on the number of faces of the graph G. Firstly, we suppose that F is just the boundary of IG , and let s be the segment of F that we want to enlarge. We can distinguish three cases depending on the direction of s. Case 1 Let s be a horizontal segment. If s is a horizontal segment in the upper subpath of F (analogously if s is in the lower subpath) we look for a horizontal segment s0 in the lower subpath of F . If there exists such segment we enlarge s and s0 by the same amount and we make a translation of all the segments between s and s0 , transforming F into another pseudoconvex face (see Figure 8 (a)). If there does not exist a horizontal segment s0 in the lower subpath of F , there must exist a vertical segment s0 and an oblique segment s00 which are adjacent in the lower subpath of F , because the boundary of F is a closed path. In this case, we increase the length of s, s0 and s00 and we make a translation of the rest of the segments (see Figure 8 (b)).
s
s
(a)
s'
s
s'
s
s' s''
s' (b)
s''
Figure 8: How to enlarge a segment of a pseudoconvex face by any amount, using parallel segments (a), using three segments (b).
Case 2 If s is a vertical segment, the proof is as Case 1, considering the boundary of F as the union of the right and left subpaths. Case 3 If s is an oblique segment, the proof is similar to the other cases, considering the boundary of F as the union of the upper and lower subpaths.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
15
Suppose that G has two bounded faces and let us denote by u1 , . . . , un the vertices of G which are in both faces. Let {s1 , . . . , sn } be the segments of IG corresponding to u1 , . . . , un , respectively, and let us denote by F1 and F2 the boundary of the bounded faces in IG .
s1 s
F2 s2
F1
s3 s4 s'
Figure 9: The adjacent segments are s1 , . . . , s4 . Let s be the segment of F1 we want to enlarge. By considerations given above, this transformation will enlarge other segments of F1 , but if none of these segments belong to F2 , we can reduce to Case 1 because the transformations does not modify F2 . If we have selected two (or three) segments in F1 to enlarge them, they will modify F2 if and only if F1 and F2 share more than one point of those segments. Thus, we can suppose that F1 ∩ F2 ∩ s1 is not just one point, and neither is F1 ∩ F2 ∩ sn . Otherwise, we do not consider the segments s1 and sn in the subpath {s1 , . . . , sn }. According to that, the path {s1 , . . . , sn } is monotone because the faces of IG are pseudoconvex. Suppose that s is in F1 . As in the case where G had only one bounded face, in the opposite subpath of F1 we look for a parallel segment or two contiguous segments nonparallel to s. If these segments are not in F2 we only modify F1 according to the first case. Let us suppose that s belongs to F1 and we have found a parallel segment s0 in the opposite part of F1 . Since F1 ∩ F2 is a monotone path and the segments are in opposite parts of F1 , just one of them belongs to F2 . Now, the task is to find a parallel segment in the opposite part of F2 , and we are sure that this new segment does not belongs to F1 , so enlarging all selected segments, a new representation IG0 equivalent to IG is obtained. The same proof remains valid if we choose two contiguous segments s0 and 00 s in F1 and they belong also to F2 . Suppose now that IG has n bounded pseudoconvex faces with boundaries F1 , . . . , Fn , and let s be a segment in the boundary of a face F . Since G is a subdivision of a 3connected graph, there exists a face (for example Fn ) adjacent
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
16
to the unbounded face (i.e., the boundary of the face in G corresponding to Fn has an edge in the unbounded face H of G) and such that s is not in Fn ∩ H. Thus, if we construct the graph G1 as the graph obtained from G by deleting all the edges of the face of G corresponding to Fn which are contained in the outerface, then we can assure that s belongs to G1 .
v1 v2 Fn v
3
v
4
v5 G
G1
s1 s
2
s
3
s s
4
5
IG
IG
1
Figure 10: Induction. Let v1 , . . . , vk be the vertices of G, corresponding to the segments s1 , . . . , sk of Fn , which are also on the outerface, where v2 , . . . , vk−1 are of degree two. By removing the segments of IG corresponding to the vertices v2 , . . . , vk−1 , we obtain a segment representation IG1 of G1 . Since IG1 has n − 1 faces, enlarging in any amount some of the segments, we can transform its segment representation into another one which has the same convex faces. To obtain this new representation, we have to enlarge other segments in IG1 besides s, but we have preserved the structure of the segments in the representation. So, we are able to represent again the segments corresponding to v2 , . . . , vk−1 enlarging the length of one (or two) of them, if it is necessary, to obtain a segment representation of G. 2 We can see, using Lemma 1, that by enlarging some segments, a segment representation with pseudoconvex faces can be transformed into another one preserving the topology of the embedding. But this is not sufficient to join segments inside a face, so we need another kind of transformation.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
17
Changing the sense of drawing of the segments of a monotone path of a pseudoconvex face F (for instance, the segments which were drawn to the left are drawn to the right) it is possible to draw a new pseudoconvex face F where these segments belong now to another monotone path. The remaining paths of F only change in the length of some of the segments (see Figure 11).
F
F s3
s2
s2 s1
s1
s4
s3
s4
Figure 11: How to restructure a face through a path. In the segment representation, the change of the face F to F produces some changes in the faces adjacent to F along the monotone path, and we obtain another segment representation with pseudoconvex faces as in the proof of Lemma 1 (see Figure 12). When we change the drawing in the manner described above, we say that the face F is restructured through the monotone path. Lemma 2 Let IG be a segment representation of a subdivision of a 3connected plane graph G such that all its faces are pseudoconvex. Let F be a face of IG . Then, IG can be transformed into another segment representation IG satisfying: 1. IG is topologically equivalent to IG (that is to say, the faces of IG and IG have the same facial walks), and the faces of IG are pseudoconvex; 2. the face F corresponding to F has been restructured through a monotone path. Proof: We first suppose that F is just the boundary of IG . It is easily seen that we can change the drawing of the segments so that they belong to the previous or the following monotone path. Suppose now that IG has n bounded pseudoconvex faces. Let F be the face that we want to restructure through the monotone path s1 , . . . , sn . It is necessary to change the sense of drawing of all the segments of the restructured path, thus the other faces that contain in their boundaries the segments s1 , . . . , sn will be also restructured, but they will preserve their pseudoconvexity. The main idea is that no other face of the representation will be modified, except for the length of some segments, but by Lemma 1 it is possible to increase the length of the segments of the representation preserving the pseudoconvexity.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
18
In fact, we can consider the faces adjacent to F . The union of these faces determines a region of the plane, R, whose boundary is also a pseudoconvex face. Since restructuring F only modifies the segments in the interior of R but never in its boundary, the faces of the representation that are not adjacent to F will keep their structure. For instance, in Figure 12, we have restructured the face F and this transformation forces restructuring the shaded face. Other faces of the segment representation have been transformed in the length of some segments of their boundaries, but by Lemma 1 they preserve their pseudoconvexity.
F F
Figure 12: How to restructure the faces adjacent to the restructured face F . 2
3
Trianglefree graphs
We need the following result proved by Barnette [1]: Theorem 1 If G is a subdivision of a 3connected graph, there exists a family Q1 , . . . , Qn−1 of paths in G such that the family of subgraphs defined as G1 = G, G2 = G1 − Q1 , . . . , Gn = Gn−1 − Qn−1 satisfies the properties 1. Each Gk is a subdivision of a 3connected graph. 2. Gn is a subdivision of K4 . Moreover, if we fix a subgraph of G which is a subdivision of K4 , G can be reduced, by deleting edges and paths, to this subgraph. An easy consequence is that every planar trianglefree graph which is a subdivision of a 3connected graph can be reduced, by deleting edges and paths with internal vertices of degree two, to a subdivision of a fixed complete subgraph K4 in such a way that in each step we have a subdivision of a 3connected graph.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
19
This result will allow us to build a segment representation in three directions of subdivisions of 3connected graphs as follows. Firstly we build a segment representation of a subdivision of K4 and then insert, in reverse order, the edges and paths that were removed to obtain from G the subdivision of K4 . In order to do this, we need two basic operations: (1) insert a segment path between two segments of the same face and (2) join two segments of the same face. The second operation is, at least, as difficult as the first one, so we will concentrate only in the second operation. As we see in Figure 6, we can find some problems in the segment representation to join two segments inside a face. Most of the cases can be solved by changing the drawing of the segments of the representation with the basic operations “enlarge segments” and “restructure faces”, but there are four rare cases that need an special operation. We need at this point some new definitions. Given a 3colored plane graph G with colors {h, o, v}, a path P = {u1 , . . . , un } of G is rare if it verifies one of the following conditions: Case 1. u1 is colored as h, u2 as o, and un as v. Case 2. u1 is colored as v, un−1 as h, and un as o. Case 3. u1 is colored as h, u2 as o, un−1 as h, and un as o. Case 4. u1 is colored as o, u2 as v, un−1 as v, and un as h.
sn
v1
s
1
vn1
s2
vn
rn r2 r1
w2
wn
w1 wn1
Figure 13: Rare face (four rare paths). A face of a graph is called rare if there exists a monotone path containing a rare subpath (see Figure 13). We say that a rare face is repaired if we subdivide its rare path with a new vertex colored as v between u1 and u2 in the first and the third case, and between un−1 and un in the second case, or a new vertex colored as h between u1 and u2 in the fourth case.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
20
In the following lemma, when we say that two segments s and t can be joined by a segment path of length k, we mean a path {s, s1 , s2 , . . . , sk , t}. Lemma 3 Let IG be a segment representation of a plane graph G and let s1 and s2 be two distinct non adjacent segments in a pseudoconvex nonrare face F . Then IG can be transformed into another segment representation IG satisfying 1. IG and IG have the same faces and face boundaries as G, and the faces of IG are pseudoconvex; 2. s1 can be joined to s2 by a segment path of length k, for all k > 0, or directly if s1 and s2 have not the same direction inside the pseudoconvex face F , corresponding to F . Proof: The proof falls naturally into two cases: the segments have the same direction, or they do not.
s1
s2
s1
(a)
s2
s1
(b)
(c) s2
s2
s1
s1 s2
Figure 14: Joining segments Case 1: s1 and s2 do not have the same direction. Suppose the segments cannot be joined inside F directly. The lines containing
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
21
s1 and s2 indicate us which end has to be extended for the segments to intersect. Let us mark these ends. 1. At least one of the segments is extensible by the marked end but it intersects other segments of F (Figure 14 (b)). Then we can enlarge some segments of F using Lemma 1 and save the obstacle. 2. No segment is extensible by the marked end (Figure 14 (c)). Then we have to restructure the face through the path containing s1 (or s2 ) to make it extensible. Note that there exists exactly four configurations where the segments are not extensible and restructuring the face does not solve the problem, but these are the rare paths which are excluded.
S1 S2
Non pseudoconvex face
Non pseudoconvex face
Figure 15: Segments s1 and s2 cannot be adjacent. We need that s1 and s2 are non adjacent segments because we cannot join them by a segment path inside F if their angle inside F is concave. Note that in this case F will split into two faces, but one of them will not be pseudoconvex (see Figure 15). Case 2: s1 and s2 have the same direction. In this case, it suffices to join the segments by a segment path of length one, because this path can be substituted by any path of length greater than one. Again there are two subcases: 1. If the segments belong to opposite subpaths (they are drawn in opposite sense). By Lemma 1, we can enlarge s1 and s2 until there exists a perpendicular line that crosses both segments, and a segment path of any length can be drawn inside the face.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
s
22
s1
1
s2
s2
(a) s1
s1
s2
s
2
(b)
Figure 16: Joining segments.
2. If the segments are drawn in the same sense and they cannot be extended, we have to restructure the face through the path containing s1 (or s2 ) to make it extensible. 2 The interest of these Lemmas is that they allow us to proof the following. Lemma 4 Any trianglefree plane graph which is a subdivision of a 3connected graph can be represented by segments in three directions. Proof: As G is a trianglefree plane graph, in virtue of Gr¨otzsch’s Theorem [12], G admits a 3coloring with the colors h, v and o (horizontal, vertical and oblique, respectively). Since G is a subdivision of a 3connected graph, we can find a vertex, not in the outerface of G, connected by three disjoint paths to three vertices in the outerface. These paths and the outerface determine a graph K, which is a subdivision of K4 . Using Theorem 1 [1] it is possible to build a sequence of graphs G1 , . . . , Gn and a sequence of paths Q1 , . . . , Qn−1 such that G1 = G, Gi is a subdivision of a 3connected plane graph, Gi is obtained from Gi−1 by deleting the path Qi−1 , and the graph obtained from Gn−1 deleting Qn−1 is K. When the path Qi is deleted, a new face F appears in Gi+1 as the union of two faces in Gi . The boundary of F can be divided into two paths; on the one hand the path beginning in the first vertex of Qi and ending in the last one and, on the other hand, the rest of the boundary. If one of them is rare, we must
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
23
repair F by subdividing an edge with a new vertex (that we label as a repaired vertex), to make the face F nonrare. So, we can construct another sequence G01 , . . . , G0n where G0i is Gi with a new repaired vertex, if necessary.
sn s1
v1 v
s
n1
2
rn r2 r1
vn
u
u
w2 wn
w1
u u
wn1 Rare face (four rare paths)
Repaired face
Figure 17: Repairing rare paths. It is easy to give a segment representation of K 0 with all its faces pseudoconvex. It suffices to represent pseudoconvexly the outerface of K 0 and proceed according to the above remark. Using Lemma 3 it is possible to add the path Qi to the segment representation of G0i+1 to obtain a pseudoconvex face representation of G0i . Since every subgraph is a subdivision of a 3connected graph, the path Qi cannot join adjacent vertices and so we can apply Lemma 3. In order to obtain a segment representation of the graph G, we must remove the repaired vertices. These segments cannot be removed directly, because we must change the drawing of one of the segments adjacent to the repaired vertex, so it is necessary to modify the representation. Since this is the last operation of the representation, and the repaired vertex is not adjacent to any other segment, it is possible to remove it, as illustrated in Figure 18. Notice that we could not remove the repaired vertices if the rare path would have exactly three segments u1 , u2 and u3 , but this case is not possible because joining u1 with u3 it will be form a triangle, and G was a trianglefree graph. 2 We can now formulate our main result as follows. Theorem 2 Every trianglefree planar graph is the contact graph of a set of segments in three directions. Proof: Let G be a trianglefree plane graph. Since G has no triangles, we can obtain a 3coloring of G using Gr¨otzsch’s Theorem [12]. The colors will be labeled as h, v and o (horizontal, vertical and oblique, respectively). We can build a new trianglefree plane graph G1 , subdivision of a 3connected graph, which contains G as a subgraph, by adding new vertices and edges joining the
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
F'
F'
F'
F
F
F'
F
F'
F'
u F
F
F
F'
u F
F'
F
F'
u F
u
F'
F
F'
u
F
F'
F'
u
u F
24
F
u F
F'
F'
F'
F
F
Figure 18: How to remove the repaired vertex u in the four cases.
blocks of G. If this is the case, these vertices are labeled as dummy vertices. When an added edge produces a triangle, we subdivide it, and when a new edge joins two vertices with the same color, we subdivide it too. We call these new vertices and edges virtual. All the new vertices (dummy and virtual) can be colored so that the 3coloring is preserved. By Lemma 4, G1 admits a segment representation. Out of this segment representation we must remove all the vertices and edges added. A virtual edge (or a path built with virtual edges and vertices) in the segment representation of G1 is an adjacency between two segments (or a virtual path joining two segments). It suffices to break this adjacency and to shorten these segments (note that the segments do not cross, they only contact). The dummy vertices are removed as the repaired vertices in Lemma 4 (see Figure 18). 2
4
Concluding remarks
The hypothesis that the graph has no triangles can be relaxed in some cases. No doubt there exist planar graphs with triangles that admit segment rep
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
25
resentations (see Figure 1). The problem lies in the fact that we have followed a constructive proof to obtain a segment representation using the pseudoconvex faces representation of a subdivision of a 3connected graph. This construction would not be possible in general if the graph contains triangles, because if we fix the three directions of the segments we can observe that the graph in Figure 19 cannot be represented by noncrossing segments.
v1
o1
v2 h1
v1 o2
h1
o1 o2
h2
h2
v2
Figure 19: Two segments must cross. In this example we see the intersection graph of a family of segments, but this representation by segments of the graph contains regions that do not correspond to faces of the embedding of the graph. So, the topology of the embedding of the plane graph cannot be preserved and inductive arguments are no longer possible. This problem admits a partial solution as follows. A 3coloring of a plane graph G with colors {h, v, o} is good if all the triangles of G are colored (clockwise), as h − v − o. The proof of Theorem 2 can be adapted yielding the following result: Theorem 3 Let G be a 3colored plane graph. The coloring is good if and only if there exists a segment representation IG verifying that the faces of G correspond to faces of IG , and the boundaries of the faces are preserved.
N. de Castro et al., Segment Intersection Graphs, JGAA, 6(1) 7–26 (2002)
26
References [1] D.W. Barnette. On Steinitz’s theorem concerning convex 3polytopes and on some properties of planar graphs In The many facets of graph theory. Lectures Notes in Mathematics Springer, Berlin, 110:27–39, 1969. [2] I. BenArroyo Hartman, I. Newman and R. Ziv. On grid intersection graphs. In Discrete Math., 87:41–52, 1991. [3] P. Hlineny. Contact graphs of line segments are NPcomplete. In Discrete Math., 235:95–106, 2001. [4] H. de Fraysseix, P. Osona de Mendez and J. Pach. Representation of planar graphs by segments. In Colloquia Mathematica Societatis J´ anos Bolyai, Intuitive Geometry, Szeged (Hungary), 1991. [5] M.C. Golumbic. Algorithmic Graph Theory and Perfect Graphs. Academic Press, 1980. [6] J. Kratochv´ıl. A special planar satisfiability problem and a consequence of its NPcompleteness. In Discrete Applied Math., 52:233–252, 1994. [7] J. Kratochv´ıl and J. Matouˇsek. Intersection graphs of segments. In J. of Comb. Theory, Serie B, 62:289–315, 1994. [8] W. Naji. Reconnaisance des graphes de cordes. In Discrete Math., 54:329– 337, 1985. [9] E.R. Scheinerman. Intersection classes and multiple intersection parameters of graphs. Ph D. thesis,, Princeton University, 1984. [10] J. Spinrad. Recognition of circle graphs. In J. of Algorithms, 16:264–282, 1994. [11] R. Tamassia and I.G. Tollis. A unified approach to visibility representation of planar graphs. In Discrete and Computational Geometry, 1:321–341, 1986. [12] C. Thomassen. Gr¨ otzsch’s 3colour theorem and its counterparts for the torus and the projective plane. In J. Comb. Theory B, 62:268–279, 1994.
Journal of Graph Algorithms and Applications http://www.cs.brown.edu/publications/jgaa/ vol. 6, no. 1, pp. 27–66 (2002)
Planar Graphs with Topological Constraints Christoph Dornheim Institut f¨ ur Informatik AlbertLudwigsUniversit¨ at D79110 Freiburg, Germany http://www.informatik.unifreiburg.de/~dornheim
[email protected] Abstract We address in this paper the problem of constructing embeddings of planar graphs satisfying declarative, userdefined topological constraints. The constraints consist each of a cycle of the given graph and a set of its edges to be embedded inside this cycle and a set of its edges to be embedded outside this cycle. Their practical importance in graph visualization applications is due to the capability of supporting the semantics of graphs. Additionally, embedding algorithms for planar graphs with topological constraints can be combined with planar graph drawing algorithms that transform a given embedding into a topology preserving drawing according to particular drawing conventions and aesthetic criteria. We obtain the following main results on the planarity problem with topological constraints. Since it turns out to be NPcomplete, we develop a polynomial time algorithm for reducing the problem for arbitrary planar graphs to a planarity problem with constraints for biconnected graphs. This allows focussing on biconnected graphs when searching for heuristics or polynomial time subproblems. We then define a particular subproblem by restricting the maximum number of vertices that any two distinct cycles involved in the constraints can have in common. Whereas the problem remains NPcomplete if this number exceeds 1, it can otherwise be solved in polynomial time. The embedding algorithm we develop for this purpose is based on the reduction method.
Communicated by H. de Fraysseix and and J. Kratochv´ıl: submitted May 2000; revised March 2001.
This research was supported by the Deutsche Forschungsgemeinschaft (DFG) as part of the graduate school on Human and Machine Intelligence.
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
1
28
Introduction
Most research in the graph drawing field has focussed so far on developing algorithms that produce drawings of graphs according to particular drawing conventions and aesthetic criteria (see [5], [6], [11] and [23]). Common drawing conventions require, for instance, the vertices to have integer coordinates, the edges to be polylines or straight lines or to be composed of straight line segments parallel to one of the coordinate axes. Aesthetic criteria are in general optimization goals such as minimizing the number of edge crossings, maximizing the minimum distance between vertices or, in case of polyline drawings, minimizing the number of bends. Both drawing conventions and aesthetic criteria are intended to ensure readability of the drawings. They can be seen as geometric constraints implicit to the drawing algorithms. Many applications, however, need a visualization of graphs satisfying userdefined constraints to emphasize certain semantical aspects. Visual languages [27], for instance, may require some subgraphs to be drawn with a predefined shape to support their semantics. And in VLSI design [14] it is often necessary to have a graph layout where certain vertices are arranged in a group or cluster [21]. Although “the study of constraints is a strategic research direction for the graph drawing field” [22], there are only few graph drawing approaches allowing the user to define constraints. A survey of these approaches and those drawing algorithms that can be modified to support some sort of constraints is given in [22]. Again, the resulting constraints are primarily geometric and most of them are covered by the approach of [15] which supports the specification of arithmetic linear equality and inequality constraints on the coordinates of the vertices. These approaches to constrained graph drawing have often the disadvantage of not drawing a planar graph without crossings, i.e. as a planar embedding. For graph planarity without constraints there are many testing and embedding algorithms developed so far: from conceptually simple procedures such as [4] (also briefly described in [1]) to more involved linear time procedures such as the path addition embedding algorithm presented by Mehlhorn and Mutzel [18] based on the planarity testing procedure of Hopcroft and Tarjan [16] or the vertex addition embedding algorithm presented by Chiba et al. [3] based on the planarity testing procedure of Booth and Lueker [2]. However, the problem of constructing a planar embedding according to explicit constraints has obtained only little attention so far, despite its impact to planar graph theory and practice. An interesting approach to constrained graph embedding presented in [19] is the problem of finding a planar embedding such that the user’s preferences for facial cycles are satisfied. The preferences, or constraints, are specified by a cost function on the cycles of the graph. In an embedding that satisfies these constraints the overall costs of its facial cycles are minimized. Another approach is the construction of planar embeddings for clustered graphs [12]. A clustered graph is a graph with a userdefined hierarchical structure over the vertices such that each level decomposes the graph into disjoint clusters. In a planar drawing of a clustered graph a cluster is represented by a simple region
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
29
containing exactly the vertices that belong to this cluster. Additionally, edges are allowed to intersect the boundaries of the regions only once; in particular, edges connecting vertices of the same cluster must be inside the corresponding region. The embedding algorithm developed in [12] requires the vertices of each cluster to induce a connected graph. As shown in [9] and [10], these embeddings can be further transformed into drawings according to specific drawing conventions while preserving their cluster structure. Since many drawing procedures for planar graphs need a particular embedding (more precisely, a combinatorial representation of an embedding) as input and produce drawings of the same topology, the construction of embeddings satisfying given constraints can be used as a preprocessing step for a wide range of planar graph drawing algorithms. This paper is devoted to planar graph embedding with topological constraints; it considerably extends the previous work in [8]. We define a topological constraint for a graph to consist of some of its cycle and a set of its edges to be embedded inside this cycle and a set of its edges to be embedded outside this cycle. These constraints are clearly topological since topological transformations of the plane preserve their validity. Note that we build constraints by sets of edges instead of sets of vertices. If some vertex is to be embedded inside or outside a given cycle, the corresponding topological constraint can be defined by using an edge incident to this vertex (if the vertex is isolated, it must be replaced by some new edge for the time of the embedding process). To see that in some situations vertex sets would be insufficient, think of, e.g., Hamilton cycles: the diagonals of a Hamilton cycle can be embedded inside or outside, but there is no vertex left to constitute a topological constraint. The topological constraints are useful in graph embedding whenever the inner and outer regions of cycles have an intrinsic or userdefined semantics. Graphs whose vertices and edges represent spatial entities such as road maps or subway maps often induce some natural meaning to the faces and regions of their embeddings as well. In this case, topological constraints can be defined to ensure that the embedded graph preserves some important topological relationships. Generally, these constraints can be used to impose some structure on the embedding to be constructed. Consider in Fig. 1 the transition diagram of a finite automaton accepting the language (a(cde)∗ bz + f(hij)∗ gz)∗ . The main components of this expression are a(cde)∗ bz and f(hij)∗ gz, each representing a cyclic walk starting and ending in q0 . Moreover, each component contains a subcomponent (cde)∗ and (hij)∗ representing cyclic walks starting and ending in q1 and q6 , respectively. To reflect this structure in the diagram, it makes sense to draw the cycles q0 , q1 , q7 and q0 , q6 , q7 representing the main components into disjoint regions, but to draw the cycles q1 , q3 , q2 and q6 , q5 , q4 representing the corresponding subcomponents inside q0 , q1 , q7 and q0 , q6 , q7 , respectively. These requirements can be expressed exactly by topological constraints. Last but not least, a topological constraint allows one to specify a cycle to be an inner or outer facial cycle just by postulating the former or latter set, respectively, to consist of all edges not belonging to that cycle. The outline of the paper is as follows. Recalling in Sect. 2 the required defi
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
30
q1 a
b
q4
c d q 3 z i q5
j
h
g
e
q2
q0 f
q7
q6 Figure 1: A transition diagram of a finite automaton with the language (a(cde)∗ bz + f(hij)∗ gz)∗ . The structure of this expression is reflected in the drawing by the topological relationships of the cycles. nitions and results of planar graph theory, we show in Sect. 3 NPcompleteness of the problem of deciding whether a graph has an embedding satisfying a given set of topological constraints. In contrast, we present a linear time embedding algorithm for triconnected graphs. Section 4 is concerned with developing a polynomial time procedure for reducing the embedding problem with topological constraints to biconnected graphs. This can be particularly useful in searching for tractable subproblems. We introduce in Sect. 5 a particular subproblem defined by the maximum number of vertices two distinct cycles involved in the constraints have in common. Whereas this problem remains NPcomplete if this number exceeds 1, we develop a polynomial time algorithm for generating a required embedding if this number is 0 or 1. Finally, we conclude with Sect. 6.
2
Preliminaries
Assuming familiarity with basic graph terminology (see [1] and [7]), we recall in this section the required fundamentals on planar graphs. For a thorough presentation of planar graph theory we refer the reader to [24], [7] and [20]. Unless otherwise stated, all graphs are finite, simple and undirected. The set of vertices and edges of a graph G are denoted V (G) and E(G), respectively. Paths and cycles in a graph are always simple, i.e. their inner vertices are pairwise distinct. A cycle C in G is induced if any edge of G joining two vertices of C is already an edge in C. Moreover, C is nonseparating if the number of components of G does not increase when deleting C from G. A block means a maximal connected subgraph without a cutvertex, i.e. a maximal 2connected subgraph or a bridge or an isolated vertex. If A denotes the set of cutvertices of G and B denotes the set of its blocks, then the block graph of G is defined on A ∪ B by the edges aB with a ∈ B for a ∈ A and B ∈ B. Note that the block graph of a connected graph is always a tree. A plane graph (V, E) consists of a finite set V ⊆ R2 and a finite set E of Jordan curves connecting two points of V such that any two points are connected
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
31
by at most one curve and the interior of a curve contains no point of V and no point of any other curve. These points and curves are again called vertices and edges, respectively, since all graph notions can also be applied to plane graphs. e we If there is an isomorphism between an abstract graph G and a plane graph G, e an embedding of G in the plane. A graph is planar if it has an embedding call G e always denotes an embedding of the graph G and in the plane. In the sequel, G e to H simply by H. e for subgraphs H ⊂ G we often denote the restriction of G Every plane graph G divides R2 \ G into disjoint open arcwise connected regions called faces of G; the unbounded one is the outer face and the bounded ones are the inner faces. If a cycle C of G is the boundary of some face, we call C a facial cycle; depending on whether C is the boundary of an inner or outer face, we call C an inner or outer facial cycle, respectively. Any cycle C divides R2 \ C into two open arcwise connected regions; the bounded one is the interior of C, denoted by int C, and the unbounded one is the exterior of C, denoted by ext C. The closure of int C and ext C is denoted by Int C and Ext C, respectively. Given a graph G = (V, E) the edge space E(G) of G is the vector space over the 2element field F2 = {0, 1} formed by the set of all subsets of E and the sum A ⊕ B = (A \ B) ∪ (B \ A) for A, B ⊆ E. The cycle space C(G) is the subspace of E(G) generated by the cycles of G – more precisely, by their edge sets. The elements of C(G) are unions of edgedisjoint cycles of G. Suppose e is an embedding of a 2connected planar graph G and F 0 is the set of all G e Then, as follows from MacLane’s planarity criterion [17], facial cycles of G. F = F 0 \ {F } forms a basis of C(G) for any F ∈ F 0 and F is the sum of all cycles in F . There is always an embedding of G where F is the set of inner facial cycles and F the outer facial cycle. We often make use of the fact that the edges e contained in Int C e for some cycle C ⊂ G are exactly the edges of those of G e whose sum is C. Moreover, any two embeddings of G are inner facial cycles of G topologically equivalent if they coincide in their outer facial cycle and their set of inner facial cycles (see [7]). We can thus represent a particular 2connected embedding up to topological equivalence just by its outer facial cycle and the set of its inner facial cycles. If in addition G is 3connected, the facial cycles of e can be identified combinatorially as the induced nonseparating cycles in G, G as proved by Tutte [26]. This allows representing any embedding of G just by its outer facial cycle because all these embeddings have the same facial cycles. Finally, we introduce a notion that plays a fundamental role in graph embedding algorithms following the principle of path addition. Suppose H is a subgraph of G. Then an Hcomponent of G is either an edge (together with its ends) in E(G) \ E(H) joining two vertices of H or it is a connected component of G− H together with all edges (and their ends) of G joining this component to H.1 The vertices of an Hcomponent in H are its vertices of attachment. Suppose C is a cycle in G. Vertices of attachment of a Ccomponent, provided that there are at least two, divide C into edgedisjoint paths, called segments. We say 1 This definition follows [24]. One can find elsewhere in the literature various notions for Hcomponents, e.g. bridges in [1].
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
32
that two Ccomponents avoid each other if either one of them has fewer than two vertices of attachment or all vertices of attachment of one Ccomponent lie in a single segment of the other Ccomponent; otherwise they overlap. The overlap graph GC of C in G is defined as the graph whose vertices are the Ccomponents of G such that two vertices are adjacent iff the corresponding Ccomponents overlap. Overlap graphs can be used even for characterizing planar graphs: by Tutte’s theorem [25] a graph is planar iff the overlap graph of each of its cycle is bipartite.
3
Topological Constraints
In this section we introduce topological constraints and present a criterion for graphs having an embedding that satisfies such constraints. We also show some basic properties of the computational problem of finding these embeddings: whereas this problem is in general NPcomplete, it can be solved in linear time for 3connected graphs. Definition 1 Let G be a graph and T be a set of triples Ti = hCi , Ini , Outi i such that Ci is a cycle in G, Ini , Outi ⊂ E(G) \ E(Ci ), Ini ∪ Outi 6= ∅ and Ini ∩ Outi = ∅. These triples are called topological constraints for G. e of G satisfies T if for each constraint Ti ∈ T all edges of An embedding G fi and all edges of Outi are contained in ext C fi ; such Ini are contained in int C an embedding is called a T embedding. Moreover, G is T planar if G has a T embedding. Obviously, T planar graphs are necessarily planar; thus we only consider planar graphs. Given a planar graph G and a set T of topological constraints for G, n always denotes the number of vertices of G, m denotes the number of edges where m ≤ 3n−6 and t denotes the number of constraints in T . Note that t can be exponential in n. The relevant parameters of the problem of finding a T embedding of G are therefore n and t. Since each constraint Ti consists of at most m edges, the input length of any instance can be assumed to be O(nt). For convenience, if C is a cycle Ci occurring in some constraint, we often write InC and OutC instead of Ini and Outi , respectively. Due to the additional requirements on embeddings, one cannot hope for a simple Kuratowskilike criterion for T planarity. In contrast to classical planarity, T planarity of a graph cannot be simply reduced to its components or blocks either; even the required topological relationships between its components can get complex as we will see in the next section. To characterize T planarity in Theorem 1, we make use of some properties of 3connected planar graphs given in Sect. 2. This theorem is illustrated in Fig. 2. Theorem 1 Let G be a graph and T be a set of topological constraints. Then, G is T planar iff there is a 3connected planar graph G0 with G ⊆ G0 and V (G) = V (G0 ) and a basis F of C(G0 ) consisting of induced nonseparating cycles of G0 such that for any hC, InC , OutC i ∈ T and FC ⊆ F defined by
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
33
S S L C = F ∈FC F it holds that x ∈ F ∈FC F for any x ∈ InC and y 6∈ F ∈FC F for any y ∈ OutC . e is a T embedding of G. Triangulating G e in the plane Proof: (⇒) Suppose G 0 f leads to an embedding G of a maximal planar and thus 3connected graph G0 . f0 are induced nonseparating cycles and form a basis The inner facial cycles of G 0 F of C(G ). Let be hC, InC , OutC i ∈ T and FC be the set of cycles in F whose e of G, e and thus of G f0 , it sum is C. Since any edge of InC is contained in Int C belongs to some cycle in FC . Analogously, any edge of OutC is contained in e of G f0 and therefore does not belong to some cycle of FC . Ext C (⇐) Let G0 be the supergraph of G satisfying the required properties. Then f0 of G0 with L there is an embedding G F ∈F F as the outer facial cycle and all F ∈ F as inner facial cycles. For any hC, InC , OutC i ∈ T we have that all edges e in G f0 and all edges of OutC are contained in Ext C e of InC are contained in Int C 0 0 e f f 2 in G . Thus, we get a T embedding G by restricting G to G. G
G0
C x1
F3
y x2
F2
F1 F4
F6
F5
F7
F8 T = hC, {x1 , x2 }, {y}i
(a)
F = {F1 , . . . , F8 } FC = {F1 , F2 , F4 , F5 , F6 , F8 } (b)
Figure 2: Illustration of Theorem 1: (a) Graph G with constraint T . (b) Supergraph G0 of G with basis F of C(G) and set FC of those cycles in F whose sum is C. In case of 3connected graphs, this criterion leads directly to an algorithm for finding a T embedding. To ensure linear time complexity, we use dual graphs to represent the relationships between facial cycles (see [7]). Suppose G is a 3connected planar graph and F the unique set of facial cycles of some embedding of G. Any two facial cycles have at most one edge in common and each edge belongs to exactly two facial cycles. We define the dual graph G∗ on F such that two facial cycles are adjacent iff they share an edge. Since edges of G are in a onetoone correspondence to edges of G∗ , let C ∗ denote the set of edges in G∗ that correspond to the edges of C ⊆ E(G). G∗ has the interesting property that C ⊆ E(G) is a cycle in G iff C ∗ is a minimal cut in G∗ , i.e. removing C ∗ from G∗ separates G∗ intoLtwo components U ∗ , W ∗ ⊂ G∗ . These components L satisfy C = F ∈U ∗ F = F ∈W ∗ F . Thus, in any embedding of G U ∗ is the
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
34
set of facial cycles inside C and W ∗ is the set of facial cycles outside C, or vice versa. Figure 3 illustrates the relationship between G and G∗ . G∗
G F1
F2
F3
F4
C
F5
F1 F2 F3 F4
F6 F5
F6 (a)
(b)
Figure 3: (a) A 3connected planar graph G with a cycle C and unique (b) The dual Graph G∗ of G with minimal cut faces F1 , . . . , F6 . ∗ C = {F1 F6 , F2 F5 , F4 F5 , F3 F6 } corresponding to C and the sets U ∗ = {F1 , F2 , F3 , F4 }, W ∗ = {F5 , F6 }. To find a T embedding, we only have to decide for each C whether U ∗ or W ∗ is the set of facial cycles outside C and to search for a facial cycle F0 belonging to each of these sets. Then F0 can be chosen as the outer facial cycle. We describe the algorithm in Fig. 4 and prove its correctness in Theorem 2. Algorithm embed triconnected graph Input : G, T Output : outer facial cycle F0 of some T embedding 1. 2. 3.
4.
Find the set F of facial cycles of some embedding of G. Construct the dual graph G∗ . ∗ ∗ ∗ ∗ For each hC, In SC , OutC i ∈ T find the S components UC , WC of G − C . Let be UC = F ∈U ∗ F and WC = F ∈W ∗ F . C C ∗ = WC∗ ; If InC ⊂ UC and OutC ⊂ WC , define ZC ∗ = UC∗ ; else stop. else if InC ⊂ WC and OutC ⊂ UC , define ZC ∗ , return F0 . If there is some cycle F0 ∈ F belonging to each ZC Figure 4: Embedding algorithm for 3connected graphs
Theorem 2 Given a 3connected graph G and a set T of topological constraints for G, algorithm embed triconnected graph generates a T embedding represented by its outer facial cycle iff G is T planar. Moreover, it has time complexity O(nt). Proof: (⇒) Suppose the algorithm returns some F0 . There is some embedding e of G with inner facial cycles F 0 = F \ {F0 } and outer facial cycle F0 . By G ∗ ∗ , we have for any hC, InC , OutC i ∈ T and FC := F \ZC ⊆ F0 definition of the ZC
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
35
S that F ∈FC F contains all edges of InC but no edge of OutC . Thus, by Theorem e is a T embedding. 1, G e with the set F 0 of inner (⇐) Conversely, assume G to have a T embedding G 0 facial cycles and outer facial cycle F0 . We have to show that the algorithm always generates a cycle F0 as required. Let for any hC, InC , OutC i ∈ T FC denote the sum of those cycles in F 0 that sum up to C. FC and (F 0 ∪SF00 ) \ FC are exactly the components UC∗ , WC∗ of G∗ − C ∗ and, by Theorem 1, F ∈FC F ∗ contains all edges of InC but no edge of OutC . Thus, the algorithm defines ZC 0 0 0 ∗ to be (F ∪ F0 ) \ FC . At least T F0∗ belongs to each ZC such that the algorithm . can return some cycle F0 ∈ C ZC Finally, this algorithm can be implemented as an O(nt) procedure: generating the facial cycles of G by embedding G takes O(n) time as well as the construction of the dual graph G∗ . Since finding the components UC∗ and WC∗ of G∗ − C ∗ and testing the required conditions can both be done in O(n) time, step 3 takes all in all O(nt) time. The last step also needs only O(nt) time. 2 Basically, this polynomial time T planarity algorithm depends on the simple topological properties of 3connected planar graphs. The next theorem shows that in the general case we cannot hope for such a polynomial time solution. This also holds for some natural restrictions of the problem. Theorem 3 The problem of T planarity is NPcomplete. Proof: Membership in NP follows immediately from Theorem 2: we only have to guess a 3connected planar supergraph G0 of G and verify in polynomial time G0 to be T planar. Next we show the problem to be NPhard by transformation from the NPcomplete problem BETWEENNESS (see [13]) defined as: given a finite set A and a set S of ordered triples of distinct elements from A, is there a onetoone function f : A −→ {1, . . . , A} such that for each (a, b, c) ∈ S either f (a) < f (b) < f (c) or f (c) < f (b) < f (a) holds? Let A = {a1 , . . . , an } and S be an arbitrary instance of BETWEENNESS. We associate with A the graph GA defined by V (GA ) = {x, y, a1 , . . . , an } and E(GA ) = {xai , ai y  i ∈ {1, . . . , n}}. For any i, j with 1 ≤ i < j ≤ n let Ci,j denote the cycle (x, ai , y, aj , x) illustrated in Fig. 5. Then, S is encoded by a set TS of topological constraints for GA : let InCi,j be the set {xak  (ai , ak , aj ) ∈ S or (aj , ak , ai ) ∈ S} and TS be the set of triples hCi,j , InCi,j , ∅i with nonempty InCi,j . We show that GA is TS planar iff there is some function f satisfying the fA is a TS embedding of GA where a0 requirements given above. Suppose G fA . and a00 are the two vertices of GA belonging to the outer facial cycle of G We define a linear order f on A by f (a0 ) = 1, f (a00 ) = n and inductively fA where the f (a) = i if a 6= a00 and a belongs to the outer facial cycle of G −1 −1 vertices f (1), . . . , f (i − 1) are removed. It follows immediately that for each (a, b, c) ∈ S f (b) is between f (a) and f (c). Conversely, suppose f has the required property. Then GA can be embedded while preserving the order of f , i.e. f −1 (i) and f −1 (i + 1) belong to the same
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
36
x
a1
ai
Ci,j
aj
an
y Figure 5: Graph GA defined in the proof of Theorem 3 inner facial cycle and f −1 (1) and f −1 (n) belong to the outer facial cycle. Thus, 2 all edges of InCi,j are inside Ci,j . According to the special properties of GA and TS defined in the proof, we can draw some further conclusions. Since GA is 2connected and has treewidth 2, T planarity remains NPcomplete for the class of graphs having these properties. Thus, unlike many other graph problems, a bounded treewidth does not result in a polynomial time solution in case of T planarity. With respect to the connectivity number κ of graphs, we get the exact boundary between P and NP: the problem is NPcomplete for κ ≤ 2 while allowing a polynomial time solution for κ ≥ 3. T planarity remains also NPcomplete for Eulerian graphs since GA is Eulerian (if A is odd, we have to add the edge xy to E(GA )). Interestingly, NPcompleteness holds for topological constraints of the form hC, InC , ∅i. Since in the proof any xak ∈ InCi,j can be expressed equivalently by xai ∈ OutCk,j and xaj ∈ OutCi,k , this is also valid for constraints of the form hC, ∅, OutC i.
4
Reduction to Biconnected Graphs
As far as classical planarity is concerned, the planarity problem of a graph can be simply reduced to its blocks. Correspondingly, many graph embedding algorithms, e.g. [3] and [18], require the input graph to be 2connected. The embedded blocks can be easily merged to an embedding of the whole graph. A corresponding reduction for T planarity, however, must involve all the topological constraints between the components and blocks. In this section we develop a polynomial time algorithm providing such a reduction in two steps: first, T planarity for a graph is reduced to its components and second, connected graphs with constraints are reduced to their blocks. Thus, it is sufficient to focus on 2connected graphs when searching for polynomial time subproblems or heuristics to cope with the general NPcomplete problem.
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
4.1
37
Reducing a Graph to Its Components
Topological constraints for an arbitrary planar graph can considerably differ from those for a 2connected graph: this is due to the fact that topological constraints between its components or blocks imply yet another sort of constraints not subsumed by Definition 1. Suppose we have two components H and H 0 of a graph G and three constraints meaning that x ∈ E(H 0 ) must be embedded inside cycles C1 and C2 , but outside cycle C3 of H. To find an embedding of e of H with an G satisfying these constraints, we have to find an embedding H f f f inner face inside C1 and C2 , but outside C3 in which we can embed H 0 . Thus, we get a new constraint between cycles of the same component that cannot be equivalently expressed by topological constraints. Although again topological by nature, we call constraints of this sort overlap constraints. More formally: Definition 2 Let G be a graph and L be a set of pairs Li = hCIni , COuti i such that CIni and COuti are sets of cycles of G. These pairs are called overlap constraints for G. e of G satisfies L if for each constraint Li ∈ L there is a face An embedding G e in the interior of all cycles of CIni and in the exterior of all cycles of of G COuti ; such an embedding is called an Lembedding. Moreover, G is Lplanar if G has an Lembedding. We only consider overlap constraints that are induced by topological constraints though they might be of general interest. If a graph has an embedding satisfying both topological constraints T and overlap constraints L, we call it T Lplanar and its embedding T Lembedding for short. If H is a subgraph of G, we denote with T H the set of topological constraints which T induces on H, i.e. hCi , Ini ∩ E(H), Outi ∩ E(H)i if Ci is a cycle in H and hCi , Ini , Outi i ∈ T . Suppose G is a planar graph, T is a set of topological constraints for G and H is the set of components of G to which we want to reduce T planarity. To represent the induced constraints between distinct components H, H 0 ∈ H, we define the following sets: CInH,H 0 COutH,H 0
= {C ⊂ H  hC, InC , OutC i ∈ T with InC ∩ E(H 0 ) 6= ∅}, = {C ⊂ H  hC, InC , OutC i ∈ T with OutC ∩ E(H 0 ) 6= ∅}.
The sets CInH,H 0 define moreover a relation ≺ on H by H 0 ≺ H iff CInH,H 0 6= ∅. This relation means that we have to find an embedding of H that has a face inside all cycles of CInH,H 0 and outside all cycles of COutH,H 0 , thus satisfying the overlap constraint hCInH,H 0 , COutH,H 0 i. However, there are much more overlap constraints for H. Consider the set H0 of all successors of H, i.e. {H 0  H 0 ≺ H}, and let K be a component of (the undirected graph of) ≺ restricted to H0 . of H. The stronger Then all H 0 ∈ K must lie in the same S S face of an embedding overlap constraints for H are thus h H 0 ∈K CInH,H 0 , H 0 ∈K COutH,H 0 i for all such K. e of G and the induced ordering < on H by Now consider an embedding G e H 0 is in some inner face of G e H . It can be easily seen, that < is H 0 < H iff G
C. Dornheim, Planar Graphs with Constraints, JGAA, 6(1) 27–66 (2002)
38
a strict partial order with the additional property that H 0 < H and H 0 < H 00 imply either H < H 00 or H = H 00 or H 00 < H due to planarity. In other words, e is a < is the transitive closure of a disjoint union of rooted trees. If moreover G T embedding, the relation ≺ defined above is a subrelation of 1, with u1 ∈ RXλ ∪ R2 . Sk u1 , u ˜2 , . . . , u˜ι = u˜), ι > 1, 2. There exists a vertex u ˜ ∈ i=φ(w) V i and a directed path P˜ = (˜ u) ≥ φ(u) and the paths P and P˜ are vertex disjoint except with u ˜1 ∈ RXλ ∪ R2 , such that φ(˜ for possibly u and u ˜. The vertex set D(RXλ ∪ R2 ) is called the dependent set of RXλ ∪ R2 . Figure 17 illustrates different kinds of dependent sets D(RXλ ∪R2 ). The dependent set D(RXλ ∪ R2 ) is drawn shaded in all four cases. The vertex v in all four subfigures denotes the connective cut vertex of Xλ in Gφ(w) that permits reversing the subgraph RXλ ∪ R2 with respect to RX . For simplicity, we make the overall assumption for the rest of this section that no vertex u ∈ D(RXλ ∪ R2 ) is involved in a merge operation. This matter is discussed in the next section, handling concatenations of merge operations. However, subsequent merge operations to any other vertex not contained in D(RXλ ∪ R2 ) are allowed after wmerging R2 into R1 . Figure 17(a) illustrates the case, where v is not only a cut vertex in Gφ(w) but also a cut vertex in the graph G. Consequently, RXλ ∪ R2 ∪ D(RXλ ∪ R2 ) will be embedded within an interior face or the outer face with the option to chose its embedding unaffected from the embedding of the rest of the graph. Hence R2 may be embedded on an arbitrary side of RXλ with respect to RX . Figure 17(b) illustrates the case, where v is not a cut vertex in the graph G but there exists a vertex u ∈ D(RXλ ∪ R2 ) such that u and v form a split pair and φ(˜ u) < φ(u) if u ˜ ∈ D(RXλ ∪ R2 ) − {u} . Thus RXλ ∪ R2 ∪ D(RXλ ∪ R2 ) forms a split component and its embedding may be chosen freely. Hence R2 may be embedded on an arbitrary side of RXλ with respect to RX . Figure 17(c) illustrates a more delicate situation involving a split pair v and u1 . According to the definition of the dependent set, the vertex u2 is contained in D(RXλ ∪ R2 ) since there exists a vertex u4 with φ(u2 ) = φ(u4 ) and two directed paths P and P˜ , with (i) P connecting a vertex of RXλ ∪ R2 and u2 , (ii) P˜ connecting a vertex of RXλ ∪ R2 and u4 , and (ii) P and P˜ being disjoint. Although u2 ∈ D(RXλ ∪ R2 ), the vertex u2 is not contained in the split component of v and u1 . The vertex u3 , however, does not belong to the dependent set D(RXλ ∪ R2 ) since any directed S path connecting a vertex of RXλ ∪ R2 and a vertex in ki=φ(u3 ) V i must contain the vertex u1 . Hence, the paths are not disjoint and u3 ∈ / D(RXλ ∪ R2 ). Figure 17(c) shows a (not necessarily ˆ directed) path P connecting v and u3 via v˜, such that Pˆ and RXλ ∪ R2 ∪ D(RXλ ∪ R2 ) are disjoint. This leads to the interesting situation that u3 and therefore u2 are fixed in their embedding to the
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
88
side where v˜ is, while we are still able to flip the split component of u1 and v around, choosing an arbitrary side where to embed R2 next to RXλ with respect to RX . However, the existence of a split component does not guarantee a free choice of the embedding. In case that a (not necessarily directed) path P˜ exists, connecting the vertices v and u2 via v˜ such that the path P˜ and RXλ ∪ R2 ∪ D(RXλ ∪ R2 ) are disjoint, and the path P˜ uses only vertices in Sφ(u2 ) i i=1 V , we cannot flip the split component of v and u1 anymore. While Figure 17(a),(b),(c) describe examples of dependent sets such that an embedding of R2 can be chosen freely, Figure 17(d) gives an example of a dependent set that has to be embedded such that R2 is forced to be embedded on exactly one side of RXλ with respect to RX . Consider a vertex u1 ∈ V − (RXλ ∪ R2 ∪ D(RXλ ∪ R2 )) and a vertex u2 ∈ D(RXλ ∪ R2 ) such that there exists path Pˆ disjoint to RXλ ∪ R2 ∪ D(RXλ ∪ R2 ), connecting v and u2 via u1 , and the path Pˆ uses only Sφ(u ) vertices in i=12 V i . If there exists a vertex u3 ∈ D(RXλ ∪ R2 ), u3 6= u2 , with φ(u3 ) ≥ φ(u2 ), the path Pˆ forces R2 to be embedded on one side of RXλ with respect to RX . Figure 17 implicitly assumes that the Qnode X remains a node with at least two nonignored children, one being the Qnode Y (the node that has been introduced when merging T (R1 ) and T (R2 )). The example of Figure 18 shows a subgraph corresponding to the subtree rooted at X, where X has become a Qnode with only one nonignored child that is the node Y . Thus, there exists a split pair v and v˜ in G with v˜ being the connective cut vertex of RX that allows reversing the ~ X −(RX ∪R2 ∪D(RX ∪R2 )). This implies that R2 may be embedded split component containing R λ λ on either side of RXλ with respect to RX . We note that a path P = (v = u1 , u2 , . . . , uµ = u), µ ≥ 2, may exist, connecting v and a vertex u ∈ D(RXλ ∪ R2 ) such that P is disjoint to D(RXλ ∪ R2 ), Sφ(u) and the path P uses only vertices in i=1 V i . Such a path has no effect on the embedding of R2 next to RXλ with respect to RX since P must traverse the connective cut vertex v˜ of RX . Figure 18 shows the path P as a dotted line. ~ X − (RX ∪ R2 ∪ D(RX ∪ R2 )) such that for every vertex However, if there exists a vertex u ˜∈R λ λ u) holds, the embedding of R2 is fixed next to RXλ with respect ui ∈ P the inequality φ(ui ) ≤ φ(˜ to RX . Our discussion leads to the following observations. Observation 7.2. Let v be the connective cut vertex of RXλ and let v˜ be the connective cut vertex of RX if X has a parent. The subgraph R2 is not fixed to any side of RXλ with respect to RX if and only if for every vertex u in the dependent set D(RXλ ∪ R2 ) and every undirected path Sφ(u) P = (v = u1 , u2 , . . . , uµ = u), µ ≥ 2, with ui ∈ i=1 V i for all i = 1, 2, . . . , µ, one of the following conditions holds. (i) uµ−1 ∈ RXλ ∪ R2 ∪ D(RXλ ∪ R2 ). ~ X − (RX ∪ R2 ∪ D(RX ∪ R2 )) the inequality φ(v 0 ) < φ(u) holds. (ii) v˜ ∈ P and for all v 0 ∈ R λ λ (iii) v and u form a split pair in G and for all v 0 ∈ D(RXλ ∪ R2 ) − {u} the inequality φ(v 0 ) < φ(u) holds. Observation 7.3. Let v be the connective cut vertex of RXλ and let v˜ be the connective cut vertex of RX if X has a parent. The subgraph R2 is fixed to a side of RXλ with respect to RX if and only if there exists a vertex u in the dependent set D(RXλ ∪ R2 ) and an undirected path Sφ(u) P = (v = u1 , u2 , . . . , uµ = u), µ ≥ 2, with ui ∈ i=1 V i for all i = 1, 2, . . . , µ, and all of the following three conditions hold.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
89
/ RXλ ∪ R2 ∪ D(RXλ ∪ R2 ). (i) uµ−1 ∈ (ii) (a) v˜ ∈ / P , or ~ X − (RX ∪ R2 ∪ D(RX ∪ R2 )) such that φ(v 0 ) ≥ φ(u). (b) v˜ ∈ P and there exists a v 0 ∈ R λ λ (iii) There exists a vertex v 0 ∈ D(RXλ ∪ R2 ) − {u} such that the inequality φ(v 0 ) ≥ φ(u) holds. The path P connecting the vertex v and a vertex u ∈ D(RXλ ∪ R2 ) uses only leveli vertices with i ≤ φ(u). This implies that the last edge (uµ−1 , u) on the path P must be an incoming edge of u. We use this fact to determine to which side of RXλ the form R2 is fixed with respect to RX . During the reduction of the leaves corresponding to the vertex u we analyze the incoming edges of u, determining for each edge if it is the last edge of a path that is treated in one of the Observations 7.2 and 7.3. The following two lemmas help us to perform the case distinction in a very efficient way. We note that the parent of Y (Y is the Qnode that has been inserted by the merge operation) does not need to be the node X throughout the algorithm, e.g., it may have been removed from the P Qtree when applying a reduction using one of the templates Q2 and Q3. Lemma 7.4. The subgraph R2 has to be fixed in its embedding at one side of RXλ with respect to RX if and only if the Qnode Y is removed from the tree T during the application of the template matching algorithm using template Q2 or template Q3, and the parent of Y did not become a node with Y as the only nonignored child. Proof: Let R2 be fixed to a side of RXλ with respect to RX . According to Observation 7.3, there exists a vertex u in the dependent set D(RXλ ∪ R2 ) and an undirected path P = (v = Sφ(u) u1 , u2 , . . . , uµ = u), µ ≥ 2, with ui ∈ i=1 V i for all i = 1, 2, . . . , µ. The last edge e = (uµ−1 , u) / RXλ ∪ R2 ∪ D(RXλ ∪ R2 ). Since u is in on P is therefore an incoming edge of u, and uµ−1 ∈ ˜ ∈ D(RXλ ∪ R2 ), it must have a second incoming edge e˜, with e˜ being incident to a vertex u Sφ(u)−1 i ˜l in T corresponding to e˜ it follows that V ∩ (R ∪ R ∪ D(R ∪ R )). Thus for the leaf X 2 X 2 λ λ i=1 ˜l ∈ frontier (Y ). Furthermore, the condition 7.3(i) guarantees that for the leaf l in T corresponding to e we have l ∈ / frontier (Y ). Let Z be the smallest common ancestor of l and ˜l in the P Qtree. Obviously, the Qnode Y is a descendant of Z and we have Y 6= Z. ˜ be the parent of Y . If condition 7.3(ii)(a) holds, then l ∈ frontier (X), ˜ and v˜ (the Let X connective cut vertex of RX ) and v (the connective cut vertex of RXλ ) do not form a split pair in G. Thus the parent of Y did not become a node with Y as its only nonignored child. ˜ but there exists at least If on the other hand condition 7.3(ii)(b) holds, then l ∈ / frontier (X), ~ X − (RX ∪ ˜ one empty child of X containing a leaf in its frontier corresponding to a vertex v 0 ∈ R λ R2 ∪ D(RXλ ∪ R2 )). Thus again, the parent of Y did not become a node with Y as the only nonignored child. The node Y was a child of the Qnode X when it was introduced into the P Qtree. Since the parent of Y did not become a node with Y as the only nonignored child, according to Lemma 2.2 Y remains a child of a Qnode throughout the applications of the template matching algorithm. Due to the overall assumption that no vertex in D(RXλ ∪ R2 ) is involved in another merge operation, Y remains a child of a Qnode throughout every merge operation. Due to condition 7.3(iii) there exists an empty leaf in the frontier of the node Y . Thus Y is a ˜ are traversed during the reduction with respect to the vertex partial node, and Y and its parent X
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
90
˜ is a Qnode that is contained in the pertinent subtree with respect to u, either template u. Since X ˜ removing Y from the P Qtree. Q2 or template Q3 is applied to Y and X, Now let Y be removed from the tree during the reduction with respect to some vertex u by applying template Q2 or Q3 and and let the parent of Y never become a node with Y being its only nonignored child. Since the parent of Y always has at least two children, condition 7.3(ii)(a) or (ii)(b) must hold. Furthermore, the application of template Q2 or Q3 implies that the template matching algorithm has traversed Y and its parent, which is a Qnode as well. Hence the root of the pertinent subtree must be a proper ancestor of Y . Thus there exists a pertinent leaf l not in the subtree of Y , and Sφ(u) a path P = (v = u1 , u2 , . . . , uµ = u), µ ≥ 2, with ui ∈ i=1 V i for all i = 1, 2, . . . , µ, such that / RXλ ∪ R2 ∪ D(RXλ ∪ R2 ). Since one of the templates Q2 and Q3 has been applied in order uµ−1 ∈ to remove Y from the tree, Y itself must have been partial, and therefore must have had at least one empty leaf in its frontier. Thus condition 7.3(iii) holds. It follows that R2 is fixed on one side 2 of RXλ with respect to RX . Lemma 7.5. The subgraph R2 is not fixed to any side of RXλ with respect to RX if and only if one of the following cases occurs during the application of the template matching algorithm. (i) The Qnode Y gets ignored. (ii) The Qnode Y is a nonignored node of the final P Qtree. (iii) The Qnode Y has only one nonignored child. (iv) The parent of Y has only Y as a nonignored child. Proof: Let R2 be a subgraph not fixed to any side of RXλ . According to Observation 7.2 the cases 7.2(i), 7.2(ii), or 7.2(iii) apply. If there exists a path P and a vertex u ∈ D(RXλ ∪ R2 ) in G that satisfy condition 7.2(ii), it follows that the Qnode X was transformed into a node with only one nonignored child and possibly some ignored children. Then the case (iv) follows immediately. If there exists a vertex u ∈ D(RXλ ∪R2 ) that satisfies 7.2(iii) then there exists a level l, φ(w) < l ≤ k, Tk (w being the vertex involved in merging RXλ and R2 ) such that D(RXλ ∪ R2 ) ∩ i=l V i = ∅ and D(RXλ ∪ R2 ) ∩ V l−1  = 1. Thus after completing the level planarity test for Gl−1 the node Y is a Qnode with just one nonignored child. Now assume that 7.2(i) holds for all paths in G connecting v and a vertex u ∈ D(RXλ ∪ R2 ) and no path matches condition 7.2(ii) and 7.2(iii). It follows from 7.2(i) that 7.3(i) does not hold for any vertex u ∈ D(RXλ ∪ R2 ). According to Lemma 7.4, the Qnode Y is not removed from the tree using one of the templates Q2 and Q3, and one of the following two cases must hold. Tk 1. There exists a level l, φ(w) < l ≤ k, such that D(RXλ ∪ R2 ) ∩ i=l V i = ∅ and D(RXλ ∪ R2 ) ∩ V l−1  ≥ 1. Thus after completing the level planarity test for Gl−1 the node Y is a Qnode with nonignored children. Two subcases occur (a) Every leaf in the frontier of the nonignored children of Y is replaced by a sink indicator before testing Gl for level planarity. It follows that case (i) applies. (b) All leaves in the frontier of Y except for the leaves in the frontier of one child of Y become ignored. Thus case (iii) applies 2. The node Y is found in the final P Qtree.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
91
Conversely, if one of the four cases applies to the Qnode Y , by Observation 7.2 any embedding may be chosen. 2 Lemmas 7.4 and 7.5 reveal a solution for solving the problem of deciding whether R2 is fixed to one side of RXλ with respect to RX . A strategy is developed for detecting on which side of RXλ the subgraph R2 has to be embedded. One endmost child of Y clearly can be identified with the side where the root of T2 has been placed, while the other endmost child of Y can be identified with the side were Xλ is. Every reversal of the Qnode Y corresponds to changing the side were R2 has to be embedded and all we need to do is to detect the side of Y that belongs to R2 , when finally removing Y from the tree applying one of the templates Q2 or Q3. The strategy is to mark the end of Y belonging to R2 with a special ignored node. Such a special ignored node is called a contact of R2 and denoted by c(R2 ). It is placed as the endmost child of Y during the merge operation B or C next to the root of T2 . Thus the Qnode Y has now three children instead of two. See Figure 19 for an illustration. Since the contact c(R2 ) is related to a wmerge operation, the vertex w is called related vertex of c(R2 ) and denoted by ω(c(R2 )). The corresponding wmerge operation is said to be associated with c(R2 ). Before gathering some observations about contacts, it is necessary to show that the involved ignored nodes remain in the relative position of Y within the Qnode, and are therefore not moved or removed. Lemma 7.6. The ignored nodes of rseq(R2 )left and rseq(R2 )right stay siblings of Y until one of the templates Q2 or Q3 is applied to Y and its parent. Proof: The ignored nodes of rseq(R2 )left and rseq(R2 )right are children of a Qnode, and therefore remain children of a Qnode keeping their order throughout the application of the template matching algorithm, unless either rseq(R2 )left or rseq(R2 )right are found to be within a pertinent sequence. However, this can only happen if the node Y becomes pertinent, provided that the node Y does not become ignored itself. 2 A contact has some special attributes that are immediately clear and very useful for our approach. In the following observations we again assume that Y and its parent have not been an object of another merge operation B or C. Concatenation of contacts is discussed in the next section. Observation 7.7. Since the contact is an endmost child of a Qnode Y , it will remain an endmost child of the same Qnode Y , unless the node Y is eliminated applying one of the templates Q2 or Q3. Observation 7.8. If the node Y is eliminated applying the templates Q2 or Q3, the contact c(R2 ) determines the side were R2 has to be embedded next to RXλ with respect to RX . The contact is then a direct sibling to rseq(R2 )i , for some i ∈ {left , right } and ref (R2 )i has to be considered for edge augmentation. Besides placing c(R2 ) as endmost child next to the root of T2 , c(R2 ) is equipped with a set of four pointers, denoting the beginning and the end of both the left and the right reference sequence of R2 . This is necessary, since direct nonignored siblings of Y may become ignored throughout the application of the algorithm. Let rseq(R2 )left = {Iν , Iν+1 , . . . , Iµ } be the left reference sequence and let rseq(R2 )right = {J1 , J2 , . . . , Jσ } be the right reference sequence. After performing a reduction
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
92
applying template Q2 or Q3 to the node Y , the contact is either a direct sibling of Iµ or a direct sibling of J1 . In the first case, we scan the sequence of ignored siblings starting at Iµ until the ignored node Iν is detected. In the latter case, the sequence of ignored siblings is scanned by starting at J1 until the node Jσ is detected. Figure 20 illustrates this strategy for the latter case. Storing pointers of the ignored nodes Iν , Iµ , J1 , Jσ at c(R2 ), we are able to identify the reference set ref (R2 ). The nodes Iν , Iµ , J1 , Jσ are called the reference points of the contact c(R2 ). Analogously to the definition of a reference set of R2 , ref (R2 ) is said to be the reference set of c(R2 ) and denoted by ref (c(R2 )). The section closes with a summary of the results. Lemma 7.9. Let c(R2 ) be a contact related to a vertex w and let ref (R2 )left be the left reference set of c(R2 ) with reference points Iν , Iµ and let ref (R2 )right be the right reference set of c(R2 ) with reference points J1 , Jσ . Then the following statements are true. (i) If c(R2 ) is adjacent to Iµ , then augmenting Gst by an edge (u, w) for every si (u) ∈ ref (R2 )left does not destroy level planarity. (ii) If c(R2 ) is adjacent to J1 , then augmenting Gst by an edge (u, w) for every si (u) ∈ ref (R2 )right does not destroy level planarity. Proof: The lemma immediately follows from Lemmas 7.4 and 7.6.
8
2
Concatenation of Contacts
For clarity, the previous section omitted the concatenation of merge operations applied to the vertices of the dependent set corresponding to a merge operation B or C. This section deals with the subject of concatenating merge operations. Let R1 be a reduced extended form that has been w1 merged into a reduced extended form R by applying a merge operation B or C. Let T and T1 be the P Qtrees corresponding to R and R1 . Let X be the Qnode with children X1 , X2 , . . . , Xη , η ≥ 2, and let Xλ , λ ∈ {1, 2, . . . , η}, be the child that is replaced by a new Qnode having two children Xλ and the root of T1 . Let Ri , i = 2, 3, . . . , µ, be reduced extended forms where every Ri has to be wi merged into R, and Ri is wi merged into R before Ri+1 is wi+1 merged into R, for all i = 2, 3, . . . , µ − 1. S Definition 8.1. Let D(RXλ ∪R1 ) ⊂ kν=φ(w1 ) V ν be the dependent set of RXλ ∪R1 . The dependent set of RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri , i ∈ {2, 3, . . . , µ}, is denoted by D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri ) ⊂ Sk Sk ν ν such that the ν=φ(w1 ) V , and is recursively defined to be the set of all vertices u ∈ ν=φ(w1 ) V following conditions hold. 1. wi ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri−1 ). 2. There exists a directed path P = (u1 , u2 , . . . , uξ = u), ξ > 1, with u1 ∈ RXλ ∪R1 ∪R2 ∪· · ·∪Ri . S u1 , u ˜2 , . . . , u ˜ι = u˜), ι > 1, 3. There exists a vertex u ˜ ∈ kν=φ(w1 ) V ν and a directed path P˜ = (˜ u) ≥ φ(u) and the paths P and P˜ are vertex with u ˜1 ∈ RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri , such that φ(˜ disjoint except possibly for u and u˜.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
93
Definition 8.2. A sequence of wi merge operations, i = 1, 2, . . . µ, of reduced extended forms Ri into a reduced extended form R is said to be a concatenation of merge operations if the following three conditions hold. (i) R1 is w1 merged using a merge operation B or C. (ii) For all wi merge operations we have wi ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri−1 ). (iii) R1 has not been fixed to one side of RXλ with respect to RX and it is unknown if its embedding can be chosen freely. Interestingly, a concatenation of merge operations does not really affect the results of Observations 7.2 and 7.3 and the Lemmas 7.4 and 7.5. This is immediately clear for the observations that we now give for the concatenated case. Observation 8.3. Let v be the connective cut vertex of RXλ and let v˜ be the connective cut vertex of RX if X has a parent. Let Ri , i = 1, 2, . . . , µ, be a sequence of partially reduced extended forms that are wi merged into R and where their merge operations are concatenations. The subgraph R1 is not fixed to any side of RXλ with respect to RX if and only if for every vertex u in the dependent set D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ) and every undirected path P = (v = u1 , u2 , . . . , uξ = u), ξ ≥ 2, Sφ(u) with ui ∈ ν=1 V ν for all i = 1, 2, . . . , ξ, one of the following conditions holds. (i) uξ−1 ∈ RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ∪ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ). ~ X − (RX ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ∪ D(RX ∪ R1 ∪ R2 ∪ · · · ∪ Rµ )) the (ii) v˜ ∈ P and for all v 0 ∈ R λ λ 0 inequality φ(v ) < φ(u) holds. (iii) v and u form a split pair in G and for all v 0 ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ) − {u} the inequality φ(v 0 ) < φ(u) holds. Observation 8.4. Let v be the connective cut vertex of RXλ and let v˜ be the connective cut vertex of RX if X has a parent. Let Ri , i = 1, 2, . . . , µ, be a sequence of partially reduced extended forms that are wi merged into R and where their merge operations are concatenations. The subgraph R1 is fixed to a side of RXλ with respect to RX if and only if there exists a vertex u in the dependent set D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ) and an undirected path P = (v = u1 , u2 , . . . , uξ = u), ξ ≥ 2, with Sφ(u) ui ∈ ν=1 V ν for all i = 1, 2, . . . , ξ, and all three of the following conditions hold. / RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ∪ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ). (i) uξ−1 ∈ (ii) (a) v˜ ∈ / P , or ~ X −(RX ∪R1 ∪R2 ∪· · ·∪Rµ ∪D(RX ∪R1 ∪R2 ∪· · ·∪Rµ )) (b) v˜ ∈ P and there exists a v 0 ∈ R λ λ 0 such that φ(v ) ≥ φ(u). (iii) There exists a vertex v 0 ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Rµ ) − {u} such that the inequality φ(v 0 ) ≥ φ(u) holds. In order to see that the results of Lemmas 7.4 and 7.5 (up to minor differences) still hold, we show that the “local structure” of the P Qtree at the Qnode Y and its parent X either does not change or, if it changes, the embedding of R1 is fixed on one side of RXλ with respect to RX . With an “unchanged local structure” we express (informally) that throughout concatenated merge
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
94
operations the node Y (or any node that replaces Y ), and X (or any node that replaces X) stay Qnodes with Y (or its replacing node) remaining unchanged in the position of its siblings. The following lemma formally describes how the Qnode Y is changed during subsequent concatenated merge operations. The results of the lemma then immediately lead to results similar to the ones in Lemmas 7.4 and 7.5. Lemma 8.5. Let Y be a Qnode that has been introduced by w1 merging the P Qtree T1 into T using a merge operation B or C, replacing a child Xλ of a Qnode X. Let Ti , i = 2, 3, . . . , µ, µ ≥ 2, be a sequence of P Qtrees that are wi merged into T such that the wi merge operations are concatenations. Let Y 0 be the node that occupies the position of Y in the P Qtree after the wµ merge operation is complete. Then Y 0 and its parent are Qnodes. Proof: Let Ri , i = 1, 2, . . . , µ, be the forms corresponding to the P Qtrees Ti . We prove the lemma by induction. According to the definition of a concatenation, R1 has not been embedded at one side of RXλ with respect to RX and it is unknown if its embedding can be chosen freely. Lemma 7.5 therefore implies that the parent of Y did not become a node with Y as the only nonignored child, and according to Corollary 2.2 the parent of Y must be a Qnode. Furthermore, Lemma 7.5 implies that Y must have at least two leaves in its frontier both corresponding to different vertices in G. When applying a w2 merge operation to a vertex w2 ∈ D(RXλ ∪ R1 ) three cases are possible. (i) Only descendants of Y are affected by the merge operation. (ii) The node Y and its parent are affected by the merge operation. (iii) Proper ancestors of Y are affected by the merge operation. Consider the first case. If only proper descendants of Y are involved, neither Y nor its parent are affected. If Y and a child of Y are affected, the merge operations B, C or D are applied to the child of Y . Thus Y remains a Qnode with unchanged position in the P Qtree. Consider the second case. Since the parent of Y is a Qnode, the only allowed merge operations are B, C, and D. The operations B and C insert a new Qnode Y 0 at the position of Y . Reducing the leaves labeled w2 after the merge operation does only affect the children of Y 0 , since Y 0 is the root of the pertinent subtree. Therefore, the Qnode Y 0 remains unchanged in its position. However, if the merge operation D is applied, the template matching algorithm performed directly after the merge operation removes Y from the tree by applying one of the templates Q2 or Q3. Hence, according to Lemma 7.4, R1 is embedded at one side of RXλ with respect to RX . Therefore, the w1 merge operation of T1 and the w2 merge operation of T2 are not a concatenation. If proper ancestors of Y are involved, the reduction of the P Qtree with respect to w2 removes Y from the P Qtree by applying one of the templates Q2 or Q3. Again, the w1 merge operation of T1 and the w2 merge operation of T2 are not concatenated. The lemma then follows by a simple inductive argument. 2 The following lemmas are almost identical to the Lemmas 7.4 and 7.5, taking into account that the subgraph induced by the subtree rooted at Y (or any Qnode that replaces Y due to a merge operation) may have grown by concatenated merge operations. Lemma 8.6. Let Y be the Qnode that was introduced by a w1 merge operation B or C of a P Qtree T1 into a tree T , replacing a node Xλ that was a child of a Qnode X in T . Let Y 0 be a Qnode
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
95
occupying the position of Y , and Y 0 has been introduced during a merge operation concatenating the w1 merge operation. The subgraph R1 corresponding to T1 has to be embedded at exactly one side of RXλ with respect to RX if and only if the Qnode Y 0 is removed from the tree T during the application of the template matching algorithm using template Q2 or template Q3, and the parent of Y did not become a node with Y as the only nonignored child. Proof: The lemma follows from Lemma 7.4 and Lemma 8.5.
2
Lemma 8.7. Let Y be the Qnode that was introduced by a w1 merge operation B or C of a P Qtree T1 into a tree T , replacing a node Xλ that was a child of a Qnode X in T . Let Y 0 be a Qnode occupying the position of Y , and Y 0 has been introduced during a merge operation concatenating the w1 merge operation. The subgraph R1 corresponding to T1 is not fixed to any side of RXλ if and only if one of the following cases occurs during the application of the template matching algorithm. (i) The Qnode Y 0 gets ignored. (ii) The Qnode Y 0 is a nonignored node of the final P Qtree. (iii) The Qnode Y 0 has only one nonignored child. (iv) The parent of Y 0 has only Y 0 as a nonignored child. Proof: The lemma follows from Lemma 7.5 and Lemma 8.5.
2
Let c be a contact that is a child of the Qnode Y . As long as concatenated merge operations only affect descendants of the Qnode Y , they have no effect on c and its reference sequence. However, if Y and its parent are subject to a merge operation B or C, there exists a coherence between the existing contact c and the new contact that is introduced by the merge operation. Obviously, the merge operations A, D, and E can be performed one after another without worrying about the correct treatment of involved sink indicators. However, the merge operations B and C may “affect” each other. Consider for instance the example shown in Figure 21, presenting three forms R1 , R2 , and R3 that have been successively merged into a form R at the vertices w1 , w2 , w3 . For every form Ri , the example also gives the set of edges that have to be added as incoming edges to wi , i ∈ {1, 2, 3}, in the given embedding. On the other hand, Figure 22 gives the same example only with a different embedding showing different sets of edges that have to be added as incoming edges to wi . In the rest of this section we discuss how to handle sequences of the merge operations B and C that affect each other. We say that two contacts c1 and c2 mutually influence each other if ref (c1 ) ∩ ref (c2 ) 6= ∅. Two merge operations B or C mutually influence each other if their corresponding contacts mutually influence each other. Consider a Qnode Y that has been introduced as a child of a Qnode X applying one of the operations B or C. In case of a wmerge operation B or C, we only need to check if the node Y that has to be replaced by a new Qnode does have a contact as an endmost child. However, the contact is then separated from its reference sequence since Y is not a child of the Qnode X anymore. This seems to destroy the strategy of handling the contact and its reference sequence correctly. However, the new Qnode is obviously the root of the pertinent subtree with respect to w. Since the two merge operations are concatenated, Lemma 7.5 does not apply to Y1 . (Otherwise, simply remove the contact and either the left or right reference set.) It follows that the node Y1 must be a partial Qnode. Therefore, template Q2 or Q3 is applied to Y1 and its parent Y2 , and Y1 is removed
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
96
from the tree, and the children of Y1 become children of Y2 . This ensures that after the reduction with respect to w, c1 is again a child of a Qnode Y2 , where Y2 is a child of X occupying the former position of Y1 . We consider the position of c1 within the sequence of children of Y2 . Let c2 be the contact associated with the merge operation that introduced Y2 . Two cases may occur during the reduction with respect to w. 1. The contact c1 was at the empty end of Y1 and since Y1 was an endmost child of Y2 , c1 is now an endmost child of Y2 . 2. The contact c1 was at the full end of Y1 , and appears within the sequence of full children of Y2 . After having finished the reduction with respect to w one of the following two rules is applied to the contact c1 . Rule I If c1 is an endmost child of Y2 , c1 remains in its position as an endmost child of Y2 . Rule II If c1 is found within the sequence of pertinent nodes, c1 is placed as a new endmost child of Y2 next to c2 . The rules are easily expanded to two or more contacts. Let Yi be the ith Qnode introduced by the ith concatenating merge operation. Rule I’ If a sequence of contacts c1 , c2 , . . . , cξ , ξ ≤ i − 1, is endmost at Yi after the reduction is complete, the contacts c1 , c2 , . . . , cξ remain in their positions. Rule II’ If a sequence of contacts c1 , c2 , . . . , cξ , ξ ≤ i−1, is found within the sequence of pertinent nodes and c1 was the former endmost child of Yi−1 , the sequence c1 , c2 , . . . , cξ is placed next to ci that cξ and ci are directly siblings and c1 is a new endmost child of Yi . Lemma 8.8. Let Ri , i = 1, 2, . . . , µ, be a sequence of partially reduced extended forms that are wi merged into a partially reduced extended form R of a level planar graph G such that their merge operations are concatenations. Let T , T1 , T2 , . . . , Tµ be the P Qtrees corresponding to R, R1 , R2 , . . . , Rµ . Let X, Y1 , Y2 , . . . , Yµ be Qnodes and Xλ be a node such that (a) Xλ was a child of X in a P Qtree T before w1 merging T1 into T . (b) Xλ was replaced by Y1 when w1 merging T1 into T using the merge operation B or C. (c) Yi was replaced by Yi+1 when wi+1 merging Ti+1 into T using the merge operation B or C for all i = 1, 2, . . . , µ − 1. Let c(Ri ) be the contact that is associated with the introduction of Yi , i = 1, 2, . . . , µ. Let RXλ be the subgraph corresponding to Xλ , and assume that c(R1 ), c(R2 ), . . . , c(Ri−1 ) have been replaced by applying one of the Rules I’ or II’ when merging R1 , R2 , . . . , Ri into R, i ≥ 2. Then exactly one of the following statements holds. (i) The contacts c(R1 ) and c(Ri ) are both children at the same end of the Qnode Yi if and only if their corresponding forms have to be embedded on the same side of RXλ with respect to RX in every level planar embedding.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
97
(ii) The contacts c(R1 ) and c(Ri ) are both children on opposite sides of the Qnode Yi if and only if their corresponding forms have to be embedded on opposite sides of RXλ with respect to RX in every level planar embedding. Proof: Since the merge operations are concatenated, Lemma 7.5 does not apply to Yi , i = 1, 2, . . . , µ − 1. It follows that Yi is a partial Qnode for every i = 1, 2, . . . , µ − 1. Thus there exist at least two leaves, one corresponding to an incoming edge of wi+1 and one corresponding to an incoming edge of a vertex u ∈ V l , u 6= w2 , φ(wi+1 ) ≤ l ≤ k. Let Yi , i ∈ {2, 3, . . . , µ − 1}, be the partial Qnode that has to be replaced by a Qnode Yi+1 in a wi+1 merge operation. Then the set {R1 , R2 , . . . , Ri } partitions into two subsets: • {R11 , R21 , . . . , Rν1 }, 1 ≤ ν ≤ i, the set of forms that are embedded on the same side as R1 and 2 , R22 , . . . , Ri2 }, the set of forms that are embedded on the opposite side of R1 . • {Rν+1
Since Yi is a partial Qnode, there exists a level planar embedding of RYi and two paths P = (u1 , u2 , . . . , uσ ) u1 ∈ R11 ∪ R21 ∪ · · · ∪ Rν1 2 uj ∈ / RXλ ∪ Rν+1 ∪ R22 ∪ · · · ∪ Ri2 − {wi } φ(uj ) < φ(wi+1 ) φ(uσ ) ≥ φ(wi+1 )
σ≥2 j = 1, 2, . . . , σ j = 1, 2, . . . , σ − 1
and P 0 = (u01 , u02 , . . . , u0ξ ) 2 ∪ R22 ∪ · · · ∪ Ri2 u01 ∈ RXλ ∪ Rν+1 1 1 uj ∈ / R1 ∪ R2 ∪ · · · ∪ Rν1 φ(u0j ) < φ(wi+1 ) φ(u0ξ ) ≥ φ(wi+1 )
ξ≥2 j = 1, 2, . . . , ξ j = 1, 2, . . . , ξ − 1
such that (a) P and P 0 are disjoint, (b) both P and P 0 are on the boundary of the outer face of the embedding of RYi , and (c) either uσ = wi+1 or u0ξ = wi+1 , but not both. See Figure 23 where we have illustrated the case i = 1. First, case (i) is proven. Let Ri+1 and R1 be embedded on the same side of RXλ . It follows that wi+1 ∈ P , otherwise Ri+1 and P would cross each other. Let Z be the child of Yi that is an ancestor of the leaf labeled wi+1 . Since the path P is on the outer face of RYi on the side where R1 is embedded, Z must be an endmost nonignored child of Yi on the side where c(R1 ) is an endmost child. Since Yi is partial, c(R1 ) will appear within the pertinent sequence of leaves labeled wi+1 after the reduction with respect to wi+1 is complete. Therefore Rule II’ is applied and c(R1 ) and c(Ri+1 ) are both children at the same end of Yi+1 . Now let c(R1 ) and c(Ri+1 ) be children on the same side, and assume that R1 and Ri+1 have to be embedded on opposite sides of RXλ with respect to RX . It follows that wi+1 ∈ P 0 , otherwise Ri+1 and P 0 would cross each other. By construction, c(R1 ) was found within the pertinent sequence
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
98
with respect to the vertex wi+1 after Ri+1 was wi+1 merged into R. So there exists a path P 00 on the boundary of RYi , and P 00 connects a vertex u ∈ R11 ∪ R21 ∪ · · · ∪ Rν1 and wi+1 , not using any Sk vertices u0 ∈ l=φ(wi+1 ) V l . However, P 00 must cross P , a contradiction. The case (ii) is proven analogously to case (i). 2 If two contacts c1 and c2 influence each other, and therefore ref (c1 ) ∩ ref (c2 ) 6= ∅ holds, we need to redefine their reference sets such that no conflicts appear when sink indicators for edge augmentation are considered. A situation, where we can chose for a sink indicator to which reference set it belongs has to be avoided. Again let R, R1 , R2 , X, Xλ , Y1 , Y2 , c(R1 ), and c(R2 ) be defined as in Lemma 8.8. The idea is to leave the reference set of c(R1 ) (the contact associated to the “first” merge operation) unchanged, and adapt the reference set of c(R2 ) (the contact associated to the “second” merge operation). Let I1 , I2 , . . . , Iµ , µ ≥ 0, be the sequence of ignored nodes on the left side of Xλ with Xλ and Iµ being direct siblings, and let J1 , J2 , . . . , Jρ , ρ ≥ 0, be the sequence of ignored nodes on the right side of Xλ with Xλ and J1 , being direct siblings. Let ! ! µ σ1 [ [ frontier (Ii ) ∪ frontier (Ji ) ref (c(R1 )) = i=ν1
i=1
for 1 ≤ ν1 ≤ µ + 1, 0 ≤ σ1 ≤ ρ be the reference set of c(R1 ), where we assume without loss of generality that none of the two subsets is empty. The reference points of c(R1 ) are Iν1 , Iµ , J1 , Jσ1 . Assume further that ! ! µ σ2 [ [ frontier (Ii ) ∪ frontier (Ji ) ref (c(R2 )) = i=ν2
i=1
for 1 ≤ ν2 ≤ µ + 1, 0 ≤ σ2 ≤ ρ . After performing the second merge operation including the reduction of the leaves labeled w2 , the contacts c(R1 ) and c(R2 ) occupy two relative positions at their parent Y2 . (i) c(R1 ) and c(R2 ) are endmost children on different ends of Y2 . Due to Lemma 8.8, R1 and R2 are embedded on opposite sides of RXλ with respect to RX . Thus c(R1 ) and c(R2 ) do not interfere when finally determining the sets of sink indicators that are considered for edge augmentation. We determine the reference points Iν2 , Iµ , J1 , Jσ2 and store them at c(R2 ). (ii) c(R1 ) and c(R2 ) are at the same end of Y2 with c(R1 ) being (by construction) an endmost child. Due to Lemma 8.8, R1 and R2 are embedded at the same side of RXλ . Thus c(R1 ) and c(R2 ) interfere when we finally determine the sets of sink indicators that are considered for edge augmentation. The new reference set of c(R2 ) is determined as follows. Sν1 −1 left i=ν2 frontier (Ii ) = ref (c(R2 )) ∅ right
ref (c(R2 ))
Sσ2 =
∅
i=σ1 +1
frontier (Ji )
if ν2 < ν1 otherwise if σ2 > σ1 otherwise
(1)
(2)
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
99
Then the reference set of c(R2 ) is ref (c(R2 ))
= ref (c(R2 ))right ∪ ref (c(R2 ))left .
Hence, the ignored nodes Iν2 , Iν1 −1 , Jσ1 +1 , Jσ2 are stored as reference points at c(R2 ). The application to the more general case of three or more contacts is straightforward. Remark 8.9. In order to achieve linear running time, the reference sequence of a newly introduced contact c(Ri ) and its associated form Ri is never determined by scanning the sequence of ignored siblings. Instead we proceed as follows. At every consecutive sequence of contacts, we keep a pointer at the endmost contact cα towards the innermost contact cω . The contact cω is obviously the contact that has been introduced last in this sequence of contacts. When introducing a new contact, we only need to consider the contacts on the same side as the new contact. We check the reference sequence of the innermost contact cω and determine the MLvalues ML(Iνω−1 , Iνω ) and ML(Jσω , Jσω+1 ) between the reference sequence and their direct siblings. If ML(Iνω−1 , Iνω ) < LL(Ri ) or ML(Jσω , Jσω+1 ) < LL(Ri ), the left or right reference set of c(Ri ), respectively, is empty. If ML(Iνω−1 , Iνω ) ≥ LL(Ri ) or ML(Jσω , Jσω+1 ) ≥ LL(Ri ), the left or right reference sequence of c(Ri ), respectively, is determined in constant time using the pointers that we have installed as described in Remark 6.6. Consider the case were c(R1 ) and c(R2 ) are at the same end of Y2 . when removing the Qnode Y2 during the application of the template Q2 or Q3. The contact c(R1 ) is an endmost child of Y2 . Thus, after the application of the template Q2 or Q3 the contact c(R1 ) is a direct sibling of either Iµ or J1 . Therefore, the identification of sink indicators that have to be considered for edge augmentation joining the vertex w1 is a straightforward matter. After this identification is finished, the contact c(R1 ) and the set of ignored siblings that were considered for augmentation are removed from the P Qtree, leaving the contact c(R2 ) as a direct sibling of either Iν1 −1 or Jσ1 +1 . Again, the identification of the sink indicators that have to be considered for edge augmentation joining the vertex w2 is straightforward. Lemma 8.10. Let ci , i = 1, 2, . . . , µ, µ ≥ 1, be contacts that are endmost children of a Qnode Y1 in a P Qtree T . Let contact ci be related to vertex wi ∈ V , such that φ(wi ) ≤ φ(wi+1 ), i = 1, 2, . . . , µ − 1. In case that φ(wi ) = φ(wi+1 ) holds, let the P Qtree Ti corresponding to ci be wi merged into T before the tree Ti+1 corresponding to wi+1 is wi+1 merged into T . Let ref (ci )left be the left reference set of ci with reference points Iib , Iie and ref (ci )right be the right reference set of ci with reference points Jib , Jie . For every ci , the nodes Iib and Jib denote the first ignored node in the reference sequence rseq (ci )left and rseq(ci )right , respectively, and Iie and Jie denote the last ignored node in the reference sequence rseq(ci )left and rseq(ci )right , respectively. Then the following statements are true. (i) If ci is adjacent to Iib , then augmenting Gst by an edge (u, w) for every si (u) ∈ ref (ci )left does not destroy level planarity. (ii) If ci is adjacent to Jib , then augmenting Gst by an edge (u, w) for every si (u) ∈ ref (ci )right does not destroy level planarity. Proof: By construction, the sequence of children of Y1 is partitioned into the three sets: C1 , N and C2 where
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
100
• C1 = c11 , c21 , . . . , cν1 , 0 ≤ ν ≤ µ, is the sequence of contacts on one end of Y1 with c11 being an endmost child of Y1 . • N is a sequence of ignored and nonignored nodes. • C2 = c12 , c22 , . . . , cϕ2 , ϕ = µ − ν, is the sequence of contacts on the opposite side of C1 with c12 as an endmost child of Y1 . By construction, for Cξ , ξ = 1, 2, φ(ω(ciξ ))
≤
ξ φ(ω(ci+1 ))
i = 1, 2, . . . , Cξ  − 1
where ω(ciξ ) denotes the vertex related to ciξ . For any i ∈ {1, 2, . . . , Cξ  − 1} with φ(ω(ciξ )) = ξ )) the P Qtree corresponding to ciξ has been ω(ciξ )merged into T before the tree correφ(ω(ci+1 ξ ξ has been ω(ci+1 )merged. sponding to ci+1 1 It follows that either c1 = c1 or c12 = c1 and c11 and c12 do no interfere, since their corresponding forms are placed on opposite sides with respect to RXλ and RX . We may assume that c11 = c1 . Due to Observation 7.8, c11 is either adjacent to I1b or to J1b . Assume without loss of generality that c11 is adjacent to I1b . It follows from Lemma 7.9 that considering ref (c1 )left for edge augmentation does not destroy level planarity. Removing c11 and ref (c1 )left from the tree, the correctness of the lemma follows by a simple inductive argument. 2 The function AUGMENT now combines all the described strategies in the level planarity test of J¨ unger et al. (1999). It is almost identical to the function LEVELPLANARITYTEST, except that it does not call the function CHECKLEVEL but a function EMBEDLEVEL. However, the function EMBEDLEVEL is almost identical to the function CHECKLEVEL. We only need the following modifications. (i) If v is a sink in V j , 1 < j < k, replace the corresponding leaf by a sink indicator si (v) before processing Gj+1 . If this replacement constructs a node X having only sink indicators in its frontier, mark X as ignored and update the MLvalues as described in Section 6. (ii) When reducing a set of leaves with respect to a vertex w in a P Qtree, ignore all sink indicators and ignored nodes during the application of the template matching algorithm. After the reduction is complete, the pertinent subtree is removed from the tree and replaced by a single representative. During the removal of the pertinent subtree with respect to w, we check for sink indicators in the pertinent subtree. For every si (v) that is found in the pertinent subtree, we add an edge (v, w) to Gst , unless si(v) is affected by the existence of a contact c in the pertinent subtree. If the latter applies, add an edge (v, w0 ), with w0 being the vertex related to c. (iii) When wmerging a P Qtree T 0 into a P Qtree T , necessary adjustments as described above have to be applied to the merge operations B or C. If necessary, a contact is introduced as a third child of the new Qnode. Furthermore, if the new contact mutually influences existing ones, Rules I or II (see 8) have to be applied after reducing T with respect to w. (iv) After processing level k, an edge (v, t) is added for every vertex v ∈ V k . Furthermore we scan the final P Qtree T for remaining sink indicators, and add for every indicator si (v) an edge (v, t) to Gst , unless si (v) is affected by the existence of a contact c in the pertinent subtree. If the latter applies we add an edge (v, w0 ), with w0 being the vertex related to c.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
101
Theorem 8.11. The algorithm LEVELPLANAREMBED computes a level planar embedding of a level planar graph G = (V, E, φ) in O(n). Proof: From Lemmas 5.1, 5.2, 5.3 and 8.10 it follows that augmenting Gst to a hierarchy using the function AUGMENT does not destroy level planarity. Consequently, the augmentation of Gst to a single source, single sink graph does not destroy level planarity either. The vertices s and t are on the outer face of a level planar embedding of Gst . By the discussion of Section 4 we can compute a topological sorting of Gst that induces an stnumbering and applying the planar embedding algorithm of Chiba et al. (1985) to Gst a level planar embedding of G can be constructed. Since the number of edges added to G to construct Gst is bounded by n, the level planar embedding is computed in O(n) time. It remains to show that augmenting Gst to a hierarchy can be done in O(n) time. The function AUGMENT performs as the function LEVELPLANARITYTEST, with certain modifications. It is sufficient to show that the amount of extra work performed by these modifications consumes O(n) time. Clearly, the maintenance of the ignored nodes during all template reductions, and all merge operations A, D, and E is bounded by the number of ignored nodes in the P Qtrees. The number of ignored nodes is O(n), thus it remains to show that the number of operations needed to perform merge operations B and C is as well bounded by the number of ignored nodes. As described in Remark 8.9 the installation of a contact and the identification of its corresponding reference sequence is bounded by a constant number of operations. Clearly, the number of operations for deinstalling all contacts and their reference sequences is bounded by the number of ignored nodes. Hence, the amount of time needed to handle ignored nodes during the application of the merge operations is in O(n). 2
9
Remarks
Once a level graph has been level planar embedded, we want to visualize it by producing a level planar drawing. This is very simple for proper graphs. Assign the vertices of every level integer xcoordinates according to the permutation that has been computed by CONSTRUCTLEVELEMBED, and draw the edges as straight line segments. This produces a level planar drawing and after applying some readjustments such a drawing can be aesthetically pleasing. For level graphs that are not necessarily proper, this approach is not applicable. It would be necessary to expand the level graph in the horizontal direction for drawing the edges as straight line segments. If many long edges exist in the graph, the area that is needed will be rather large, and the drawings are not aesthetically pleasing. However, there is a nice and quick solution to this problem that uses some extra information that is computed by our level planar embedding algorithm. Instead of drawing the graph G, we draw the stgraph Gst , and remove afterwards all edges and the vertices s and t that are not contained in G. Drawing stgraphs has been extensively studied recently (see, e.g, Kant (1993), Luccio, Mazzone, and Wong (1987), Rosenstiehl and Tarjan (1986), Tamassia and Tollis (1986), and Tamassia and Tollis (1989)). Suitable approaches for drawing the stgraph Gst have been presented by Di Battista and Tamassia (1988) and Di Battista, Tamassia, and Tollis (1992). These algorithms construct a planar upward polyline drawing of a planar stgraph according to a topological numbering of the vertices. The vertices of the stgraph are assigned to grid coordinates and the edges are
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
102
drawn as polygonal chains. If we assign a topological numbering to the vertices according to their leveling, the algorithm presented by Di Battista and Tamassia (1988) produces in O(n) time a level planar polyline grid drawing of Gst such that the number of edge bends is at most 6n − 12 and every edge has at most two bends. This approach can be improved to produce in O(n) time a level planar polyline grid drawing of Gst such that the drawing of Gst has O(n2 ) area, the number of edge bends is at most (10n − 31)/3, and every edge has at most two bends. Thus once we have augmented G to the stgraph Gst , we can immediately produce a level planar drawing of G in O(n) time.
References Booth, K. and Lueker, G. (1976). Testing for the consecutive ones property, interval graphs, and graph planarity using PQtree algorithms. Journal of Computer and System Sciences, 13, 335–379. Chiba, N., Nishizeki, T., Abe, S., and Ozawa, T. (1985). A linear algorithm for embedding planar graphs using PQtrees. Journal of Computer and System Sciences, 30, 54–76. Di Battista, G. and Tamassia, R. (1988). Algorithms for plane representations of acyclic digraphs. Theoretical Computer Science, 61, 175–198. Di Battista, G., Tamassia, R., and Tollis, I. G. (1992). Constrained visibility representations of graphs. Information Processing Letters, 41, 1–7. Even, S. and Tarjan, R. E. (1976). Computing an stnumbering. Theoretical Computer Science, 2, 339–344. Fulkerson, D. R. and Gross, O. A. (1965). Incidence matrices and interval graphs. Pacific J. Mathematics, 15, 835–855. Heath, L. S. and Pemmaraju, S. V. (1995). Recognizing leveledplanar dags in linear time. In F. J. Brandenburg, editor, Proc. Graph Drawing ’95 , volume 1027 of Lecture Notes in Computer Science, pages 300–311. Springer Verlag. Heath, L. S. and Pemmaraju, S. V. (1996). Stack and queue layouts of directed acyclic graphs: Part II. Technical report, Department of Computer Science, Virginia Polytechnic Institute & State University. J¨ unger, M., Leipert, S., and Mutzel, P. (1998). Level planarity testing in linear time. In S. Whitesides, editor, Graph Drawing ’98 , volume 1547 of Lecture Notes in Computer Science, pages 224–237. Springer Verlag. J¨ unger, M., Leipert, S., and Mutzel, P. (1999). Level planarity testing in linear time (full version). Technical report, Institut f¨ ur Informatik, Universit¨at zu K¨ oln. Kant, G. (1993). A more compact visibillity representation. In J. van Leeuwen, editor, Proc. 19th International Workshop on GraphTheoretical Concepts in Computer Science , Lecture Notes in Computer Science. Springer Verlag.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
103
Leipert, S. (1998). Level Planarity Testing and Embedding in Linear Time. Ph.D. thesis, Universit¨ at zu K¨ oln. Luccio, F., Mazzone, S., and Wong, C. (1987). A note on visibility graphs. Discrete Mathematics, 64, 209–219. Rosenstiehl, P. and Tarjan, R. E. (1986). Rectilinear planar layouts and bipolar orientations of planar graphs. Discrete and Computational Geometry, 1, 343–353. Tamassia, R. and Tollis, I. G. (1986). A unified approach to visibillity representations of planar graphs. Discrete and Computational Geometry, 1, 321–341. Tamassia, R. and Tollis, I. G. (1989). Tessellation representations of planar graphs. In Proc. 27th Allerton Conf. Communication Control Computing , pages 48–57.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
10
104
Glossary
c(R) is the contact of a form R. The contact is an ignored node that is placed as an endmost child of a Qnodes Y next to the root of the P Qtree T (R) where Y was introduced by a merge operation B or C. D(RXλ ∪ R2 ) is the dependent set of RXλ ∪ R2 where RXλ is the subgraph of a form R1 and corresponds to the subtree rooted at Xλ before merging the forms R1 and RS 2 using a merge operation B or C. The dependent set D(RXλ ∪ R2 ) is the set of vertices u ∈ ki=φ(w) V i such that there exists a directed path P = (u1 , u2 , . . . , uξ = u), ξ > 1, with u1 ∈ RXλ ∪ R2 , and Sk u1 , u ˜2 , . . . , u ˜ι = u ˜), ι > 1, there exists a vertex u ˜ ∈ i=φ(w) V i and a directed path P˜ = (˜ ˜ u) ≥ φ(u) and the paths P and P are vertex disjoint except with u ˜1 ∈ RXλ ∪ R2 , such that φ(˜ for possibly u and u ˜. D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri ) is the dependent set of RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri and is recursively Sk defined to be the set of all vertices u ∈ ν=φ(w1 ) V ν such that (i) Ri is wi merged into R and wi ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri−1 ), (ii) there exists a directed path P = (u1 , u2 , . . . , uξ = u), S ξ > 1, with u1 ∈ RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri , and (iii) there exists a vertex u˜ ∈ kν=φ(w1 ) V ν and a directed path P˜ = (˜ u1 , u ˜2 , . . . , u ˜ι = u ˜), ι > 1, with u ˜1 ∈ RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri , such that φ(˜ u) ≥ φ(u) and the paths P and P˜ are vertex disjoint except possibly for u and u˜. Fij denotes a component of Gj , where i = 1, 2, . . . , mj . G = (V, E, φ) is called a level graph and is a directed acyclic graph with a mapping φ : V → {1, 2, . . . , k}, k ≥ 1, that partitions the vertex set V as V = V 1 ∪ V 2 ∪ · · · ∪ V k , V j = φ−1 (j), V i ∩ V j = ∅ for i 6= j, such that φ(v) ≥ φ(u) + 1 for each edge (u, v) ∈ E. Gj denotes the subgraph of G induced by V 1 ∪ V 2 ∪ · · · ∪ V j . Hij is the graph arising from Fij by introducing for each edge e = (u, v), where u is a vertex in Fij and v ∈ V l , l ≥ j + 1, a virtual vertex with label v and a virtual edge that connects u and this virtual vertex. LL(Fij ) is the low indexed level of Fij , the smallest d such that Fij contains a vertex in V d . ML(S) For any subset S of the set of vertices in V j+1 ∪ V j+2 ∪ · · · ∪ V k that belongs to a form Hij or Rij , ML(S) is the greatest d ≤ j such that V d , V d+1 , . . . , V j induces a subgraph in which all nodes of S occur in the same connected component. The level ML(S) is said to be the meet level of S. mj denotes the number of components of Gj . φ is a mapping φ : V → {1, 2, . . . , k}, k ≥ 1, of a directed acyclic graph G = (V, E) that partitions the vertex set V as V = V 1 ∪ V 2 ∪ · · · ∪ V k , V j = φ−1 (j), V i ∩ V j = ∅ for i 6= j, such that φ(v) ≥ φ(u) + 1 for each edge (u, v) ∈ E. RX is the subgraph corresponding to the subtree rooted at a node X of a P Qtree.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
105
~ X is the set of all vertices u ∈ V such that there exists a vertex v ∈ RX and a (not necessarily R directed) path P connecting u and v not using the connective cut vertex of X. Rij is the reduced extended form that is created from an extended form Hij by identifying all virtual vertices with the same label to a single vertex. If Rij has been subject to a merge operation, it is a partially reduced extended form. Rij ∪v Rlj is the graph arising from the identification of two virtual vertices vi and vl (labeled v) of two reduced extended forms Rij and Rlj . rseq(R) is the reference sequence of a form R. It is the sequence of ignored nodes Iν , Iν+1 , . . . , Iµ left of a node Xλ and J1 , J2 , . . . , Jσ right of a node Xλ , where Xλ is subject to a merge operation B or C. The reference sequence describes the two sets of sink indicators of which exactly one set has to be considered for edge augmentation in combination with the merge operation and is associated with the ”smaller” form R that has been merged into the larger form. rseq(R)right denotes the right sequence of ignored nodes of rseq(R). rseq(R)left denotes the left sequence of ignored nodes of rseq(R). ref (R) is the reference set of a form R. It is the union of the frontiers of all elements of the reference sequence rseq(R). ref (R)left is the left reference set of a form R. ref (R)right is the right reference set of a form R. ref (c(R2 )) is the reference set of a contact c(R2 ). si (v) is the sink indicator of a sink v. The sink indicator is a leaf for keeping the position of the sink v in a P Qtree. Siv is the set of virtual vertices of Hij or Rij that are labeled v ∈ V j+1 . vi is the vertex with label v of Rij , i.e., the vertex that arose from identifying all virtual vertices of Siv . ω(c(R)) is the related vertex w of a contact c(R) where the contact c(R) was introduced by a wmerge operation. Concatenation of merge operations is a sequence of wi merge operations, i = 1, 2, . . . µ, of reduced extended forms Ri into a reduced extended form R such that (i) R1 is w1 merged using a merge operation B or C, (ii) for all wi merge operations we have wi ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri−1 ), and (iii) R1 has not been fixed to one side of RXλ with respect to RX and it is unknown if its embedding can be chosen freely. Connective cut vertex Let X be a Qnode in T corresponding to a subgraph B of Gj , 1 ≤ j ≤ k. The children of X each correspond to a cut vertex on the border of the outer face of B. If X is not the root, then there exists an extra cut vertex on the border of the outer face of B that separates the subgraph G0 induced by the subtree rooted at X from Gj − G0 . This cut vertex is called the connective cut vertex of B.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
106
Contact of a form R is an ignored node that is placed as the endmost child of a Qnode Y next to the root of the P Qtree T corresponding to R where Y was introduced by a merge operation B or C. S Dependent set of RXλ ∪ R2 is the set D(RXλ ∪ R2 ) of vertices u ∈ ki=φ(w) V i such that there exists a directed path P = (u1 , u2 , . . . , uξ = u), ξ > 1, with u1 ∈ RXλ ∪ R2 , and there S u1 , u ˜2 , . . . , u ˜ι = u˜), ι > 1, with exists a vertex u ˜ ∈ ki=φ(w) V i and a directed path P˜ = (˜ ˜ u) ≥ φ(u) and the paths P and P are vertex disjoint except for u˜1 ∈ RXλ ∪ R2 , such that φ(˜ possibly u and u ˜. Dependent set of RXλ ∪R1 ∪R2 ∪· · ·∪Ri is denoted by D(RXλ ∪R1 ∪R2 ∪· · ·∪Ri ) and is recursively Sk defined to be the set of all vertices u ∈ ν=φ(w1 ) V ν such that (i)Ri is wi merged into R and wi ∈ D(RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri−1 ), (ii) there exists a directed path P = (u1 , u2 , . . . , uξ = u), Sk ξ > 1, with u1 ∈ RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri , and (iii) there exists a vertex u˜ ∈ ν=φ(w1 ) V ν and a directed path P˜ = (˜ u1 , u ˜2 , . . . , u ˜ι = u ˜), ι > 1, with u ˜1 ∈ RXλ ∪ R1 ∪ R2 ∪ · · · ∪ Ri , such that φ(˜ u) ≥ φ(u) and the paths P and P˜ are vertex disjoint except possibly for u and u˜. Extended form Hij of Fij is the graph arising from Fij by introducing for each edge e = (u, v), where u is a vertex in Fij and v ∈ V l , l ≥ j + 1, a virtual vertex with label v and a virtual edge that connects u and this virtual vertex. Ignored node is a node of a P Qtree such that its frontier contains only sink indicators. Level graph is a directed acyclic graph G = (V, E, φ) with a mapping φ : V → {1, 2, . . . , k}, k ≥ 1, that partitions the vertex set V as V = V 1 ∪ V 2 ∪ · · · ∪ V k , V j = φ−1 (j), V i ∩ V j = ∅ for i 6= j, such that φ(v) ≥ φ(u) + 1 for each edge (u, v) ∈ E. Merged reduced form is the graph arising from the identification of two virtual vertices vi and vl (labeled v) of two reduced extended forms. Mutual influence of two contacts c1 and c2 appears if ref (c1 ) ∩ ref (c2 ) 6= ∅. Mutual influence of two merge operations B or C is at hand if the corresponding contacts mutually influence each other. Partially reduced extended form is an improper merged reduced form possibly having several virtual vertices with the same label. This form is the result of algorithmic design for achieving linear running time. Primary A reduced extended form Rij that is vunconnected for all v ∈ V j+1 is called primary. Reduced extended form Rij is the graph that is created from an extended form Hij by identifying all virtual vertices with the same label to a single vertex. Reference points of the contact c(R2 ) are the nodes Iν , Iµ , J1 , Jσ of a reference sequence of the associated merge operation.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
107
Reference sequence is the sequence of ignored nodes Iν , Iν+1 , . . . , Iµ left of a node Xλ and J1 , J2 , . . . , Jσ right of a node Xλ , where Xλ is subject to a merge operation B or C. The reference sequence describes the two sets of sink indicators of which exactly one set has to be considered for edge augmentation in combination with the merge operation and is associated with the ”smaller” form that has been merged into the larger form. Reference sequence, left is the sequence of ignored nodes Iν , Iν+1 , . . . , Iµ left of a node Xλ where Xλ is subject to a merge operation B or C. Reference sequence, right is the sequence of ignored nodes J1 , J2 , . . . , Jσ right of a node Xλ , where Xλ is subject to a merge operation B or C. Sσ Sµ Reference set is the union i=ν frontier (Ii ) ∪ i=1 frontier (Ji ) of a reference sequence Iν , Iν+1 , . . . , Iµ and J1 , J2 , . . . , Jσ . Related vertex ω(c(R)) of a contact c(R) is the vertex w related to the wmerge operation that introduced contact c(R). Secondary A reduced extended form Rij that is vconnected for at least one v ∈ V j+1 is called secondary. Sink indicator is a leaf denoted by si (v) for keeping the position of a sink v in a P Qtree. Virtual edge is an edge of a form Hij connecting a vertex of the component Fij that corresponds to Hij and a vertex on a level l ≥ j + 1. Virtual vertex is a vertex of a form Hij on a level l ≥ j + 1. vconnected A form Rij is called vconnected , if any reduced extended form has been vmerged into Rij , vmerged If Rij and Rlj are merged at a vertex v and LL(Rij ) ≤ LL(Rlj ) we say Rlj is vmerged into Rij . The form that is created by vmerging Rlj into Rij and identifying all virtual vertices with the same label w 6= v is again a reduced extended form and denoted by Rij (thus renaming Rij ∪v Rlj with the name of the “higher” form). vunconnected A form Rij is called vunconnected if no reduced extended form has been vmerged into Rij .
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
R1 v R2
R1
RXλ
v
1111111111 0000000000 w 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111
R2
RXλ
1111111111 0000000000 w 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 u
(a) Cut vertex v allows a free embedding of RXλ ∪ R2 ∪ D(RXλ ∪ R2 ).
(b) Split pair u, v allows a free embedding of RXλ ∪ R2 ∪ D(RXλ ∪ R2 ).
R1 v R2
v˜
RXλ
1111111111 0000000000 0000000000 1111111111 w 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 u1 000000000 111111111 0000000000 1111111111 000000000 111111111 0000000000 1111111111 000000000 111111111 0000000000 1111111111 000000000 111111111 0000000000 1111111111 000000000u2 u4 111111111
R1
Pˆ Pˆ
u3 (c) Split pair u, v allows a free embedding of R2 .
v
u1 R2
RXλ
111111111111111111111111111 000000000000000000000000000 w 000000000000000000000000000 111111111111111111111111111 u2 000000000000000000000000000 111111111111111111111111111 000000000000000000000000000 111111111111111111111111111 000000000000000000000000000 111111111111111111111111111 (d) Fixed embedding of RXλ ∪ R2 ∪ D(RXλ ∪ R2 ).
Figure 17: The figure illustrates different dependent sets D(RXλ ∪R2 ). The dependent sets are drawn shaded and path Pˆ is drawn grey.
108
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
v˜
RX
P
v R2
RXλ
111111111111111111111111111 000000000000000000000000000 w 000000000000000000000000000 111111111111111111111111111 000000000000000000000000000 111111111111111111111111111 000000000000000000000000000 111111111111111111111111111 000000000000000000000000000 111111111111111111111111111
u
Figure 18: A graph corresponding to the situation where X became a Qnode with one nonignored child. The embedding of RXλ ∪ R2 ∪ D(RXλ ∪ R2 ) with respect to RX may be chosen freely.
109
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
110
T1
Xλ Xλ−1 I1
Iν−1 Iν
Iµ
111 000 000 111
J1
Jσ Jσ+1
Jρ Xλ+1
w
T2 1111 0000 0000 1111 0000 1111 0000 1111 0000 1111 01 w
(a) ML(Xλ−1 , Xλ ) < LL(T2 ) and ML(Xλ , Xλ+1 ) < LL(T2 ).
T1
Y
I1
Iν−1 Iν
Iµ
Xλ
111 000 T2 111 000 0000 c(R2 ) 111 000 1111 0000 1111 0000 1111 w 1111 0000 1010
J1
Jσ Jσ+1
w
(b) Contact c(R2 ) is added as a child to Y next to the root of T2 .
Figure 19: Adding a contact during the merge operation C.
Jρ
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
111
T1
Y
I1
Iν−1 Iν
Iµ
J1
Jσ Jσ+1
Jρ
c(R2 )
(a) The node Y with the contact c(R2 ) before the application of a template Q2 or Q3.
T1
I1
Iν−1 Iν
Iµ
c(R2 )
J1
Jσ Jσ+1
Jρ
(b) The contact c(R2 ) is adjacent to the ignored node J1 . We chose ref (R2 )right for augmentation.
Figure 20: The identification of the reference set that has to be chosen for augmentation. The dotted lines denote the pointers of c(R2 ) to its reference points.
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
v 1111111 0000000 0000000 1111111 0000000 1111111 R1 0000000 1111111 0000000 1111111 w1
R3
112
1111111111111 0000000000000 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 R2 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 0000000000000 1111111111111 w2
w3
Edges added to w1 forced by R1 Edges added to w2 forced by R2 Edges added to w3 forced by R3 Figure 21: A concatenation of merge operations. First possible embedding of the forms R1 , R2 , and R3 next to RXλ with respect to RX .
11111111111111111 00000000000000000 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 v 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 R2 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 00000000000000000 11111111111111111 w2
1111111 0000000 0000000 1111111 0000000 1111111 R1 0000000 1111111 0000000 1111111
R3
w1
w3
Edges added to w1 forced by R1 Edges added to w2 forced by R2 Edges added to w3 forced by R3 Figure 22: A concatenation of merge operations. Second possible embedding for the forms R1 , R2 , and R3 next to RXλ with respect to RX .
M. J¨ unger, S. Leipert, Level Planar Embedding, JGAA, 6(1) 67–113 (2002)
u1
v 1111111 0000000 0000000 1111111 0000000 1111111 R1 0000000 1111111 0000000 RX 1111111
λ
u01
w1
P0
P uµ
u0ν
Figure 23: Illustration of the proof of Lemma 8.8.
113
Journal of Graph Algorithms and Applications http://www.cs.brown.edu/publications/jgaa/ vol. 6, no. 1, pp. 115–129 (2002)
Embedding Vertices at Points: Few Bends suffice for Planar Graphs Michael Kaufmann
Roland Wiese
WilhelmSchickardInstitut f¨ur Informatik Universit¨at T¨ ubingen Sand 13, 72026 T¨ ubingen, Germany
[email protected] [email protected] Abstract The existing literature gives efficient algorithms for mapping trees or less restrictively outerplanar graphs on a given set of points in a plane, so that the edges are drawn planar and as straight lines. We relax the latter requirement and allow very few bends on each edge while considering general plane graphs. Our results show two algorithms for mapping fourconnected plane graphs with at most one bend per edge and for mapping general plane graphs with at most two bends per edge. Furthermore we give a point set, where for arbitrary plane graphs it is NPcomplete to decide whether there is an mapping such that each edge has at most one bend.
Communicated by H. de Fraysseix and and J. Kratochv´ıl: submitted February 2000; revised May 2001.
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
1
116
Introduction
The problem of mapping the vertices of a graph to points in the plane has been considered in the past under various objectives depending on the specific applications. This ranges from the band width minimization problem [17, 8] where the points are at unit distance on a line and the objective is to minimize the distance of the points between adjacent vertices to embedding problem of a guest graph onto a host graph [14] under some objectives like dilation, congestion, load, etc. Here we consider a more geometric version of the problem: Originally, the problem was how to map a given tree T of n vertices at a given set of points S in the plane such that the edges can be drawn straightline and without any crossings. Variants of this problem have been explored, either with or without keeping the position of one specific node fixed [16, 12, 2]. Generalizing the graph class, but still using the required straightline planar drawing, Gritzmann et al. [11] gave an elegant divide and conquer scheme to partition the point set and the set of vertices simultaneously. They showed that using this mapping outerplanar graphs can be drawn without any bends. In the consequent papers [3] and [1], efficient implementations have been developed. The latest result in [1] is an O(n · log3 n) time algorithm to find a straightline drawing for such a graph. Astonishingly enough, the case for more general planar graphs has not been considered systematically. It is at exactly this point that we start. Another similar scenario has been recently considered by Pach and Wenger [15]. They assume that the mapping of the vertices to the points is already fixed. The authors prove that O(n) bends per edge are sufficient and that we can not expect to significantly improve the worst case bound for the maximum number of bends per edge. We consider just the first scenario where the mapping of the vertices to the points is not yet fixed. On the other hand, we preserve the given planar embedding of the graph. In the next section, a simple scheme is presented, that provides drawings with at most one bend per edge for a large class of graphs. Next we generalize the technique so that it will work for any planar graph and produces drawings with at most two bends per edge. In section 4, we give a class of graphs and a set of points, where we can prove that there is at least one edge with two bends. Finally, we extend the techniques
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
117
developed so far to a simple proof to the expected NPcompleteness result, namely to decide whether a drawing can be found where each edge has at most one bend. Throughout this paper, we deal with triangulated embedded (plane) graphs, only in the last section do we discuss a more general case. Of course, we always require the drawings to be planar, even if it is not explicitly stated.
2
A basic technique
In this section, we present the basic technique for the mapping and consider the following restriction on the graph. Let G = (V, E) be any plane graph with a hamiltonian cycle C, such that C has at least one edge, say e, on the outer face of G. We call such a property ’external hamiltonicity’ and a corresponding cycle ’external hamiltonian’. We assume the vertices of V to be ordered from v1 to vn as being prescribed by the hamiltonian cycle C. The vertex with the smallest index is chosen such that the edge e is incident to vn and v1 . Let S be any set of points p1 , p2 , ..., pn with pi = (xi , yi ). Assume the plane is rotated in such a way to make the xcoordinates of the points pairwise different. Furthermore assume that the points are ordered with increasing xcoordinates. Now we map the hamiltonian cycle C = (v1 , v2 , . . . , vn , v1 ) to the points p1 , ..., pn , so that the edge e = (vn , v1 ), is assigned in such a way that vn = pn and v1 = p1 . All edges on C with the exception of e can be drawn as a straight line so that they extend monotonically in xdirection. The edge e is drawn from the rightmost point pn to the leftmost point p1 with one bend b located at a place existing very high above all the other points. The idea is to choose the segments of e such that their slopes are the same and they are coneshaped, c.f. figure 1. The slopes of e is determined by the maximal slope of the straightline edges on the hamiltonian path C − e. This also determines the place where the bend of e is located. More precisely, the slope for a possible straightline segment is computed by σ 0 = maxi yi+1 − yi /(xi+1 − xi ). To ensure that the segments of e do not interfere with other segments or points, we have to increase the value σ 0 slightly. In fact, we assign the value σ = 2 · σ 0 as the slope of a line through
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
118
p1 and −σ should be the slope of another line through pn . The intersection of the two lines gives the position of bend b. The remaining edges are drawn each with exactly one bend such that all the left segments of the edges have the same slope σ and the right segments will have the slope −σ. They will run in parallel. This is more because of aesthetic reasons and to simplify the arguments about avoiding some possible crossings. The edges inside of C are drawn above the polygonal chain C − e, and the edges outside are drawn below. The following case checking proves the planarity of the drawing: Edges inside and outside of C do not cross since they are separated by the polygonal path C − e. We explain the case of two edges e1 and e2 inside of C in more detail. Let e1 = (vi , vl ) and e2 = (vj , vk ). Clearly i ≤ j < k ≤ l holds because of planarity. Now, since the left segments run in parallel and the right segments as well and the four end points occur in that order on the xmonotone polygonal line C − e, there are no crossing segments. The same holds for the edges outside. The slopes for the segments of the edges not in C have been chosen large enough such that edges in C cannot interfere with edges not in C. Note that by this technique, some of the segments adjacent to the same vertex might overlap (cf. the second segments of (p2 , p8 ) and (p3, p8) in Fig. 1). We devise a perturbation scheme that resolves those overlappings: Let be the minimum distance between any two nonoverlapping parallel segments, let L be the maximum length of a segment and maxdeg the maximum degree. For each vertex v, we sort the pairwise overlapping adjacent segments according to their length in decreasing order. For each segment s being the ith overlapping segment adjacent to v, we rotate s by i · L·maxdeg downwards. The new intersection points for the segments give new positions for the bends. This way we ensure that the previously overlapping segments are spread out, and new intersections are avoided since the rotation angles are kept small enough. Theorem 2.1 Let S be an arbitrary set of n points and G be any plane graph with an external hamiltonian cycle and n vertices. Then G can be drawn planar with a mapping of the vertices to the points such that each edge has at most one bend.
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
6
119
7
4
5
8
9
p7 3 1
p4 p2 2
p5
p1
p8
p9
p6 p3
Figure 1: The basic construction Remarks on the area. Note that the area may be much larger than the area R occupied by the point set. More precisely, let us assume that the minimal enclosing rectangle R is a square of width W and δ is the minimal distance in xdirection between any two points. Clearly, the absolute value of the slope σ of the segments of edge (vn , v1 ) is at most 2 · W/δ. Hence the resulting height is at most 2 · W · W/δ while the width remains the same. This means that if we assume integercoordinates (δ = 1), we achieve an area of O(W 3) for the drawing. Note that if we would allow 2 bends per edge, we could easily draw the edges in an orthogonal way and keep the area proportional to the area of the convex hull of the point set. In this case, the perturbation scheme does not work anymore and we might have to enlarge the size of the vertices and assign offsets to the adjacent segments. The details are left to the reader.
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
120
δ
Figure 2: Wasting and saving some area by spending another bend per edge.
3
The general case
In order to apply the technique above we need to find an external hamiltonian cycle, namely a hamiltonian cycle including an edge on the outer face. Testing all possible edges e = (v, w) on the outer face, we could request a hamiltonian path, which is a wellknown NPcomplete problem even on planar triangulated graphs [6]. On the other hand, we know of a lineartime algorithm to find external hamiltonian cycles by Chiba and Nishizeki [5], if the graph is fourconnected. Since the graphs we consider are triangulated, the problematic cases appear if there are separating triangles, namely cycles of length 3 which do not circumscribe single faces. Only such graphs may not contain external hamiltonian cycles. First of all, we give a reduction to the fourconnected case which will finally lead to drawings with at most two bends per edge. Then, in the following section we present a small plane graph with only 12 vertices without any external hamiltonian cycle and a point set, and we prove that any planar drawing of this graph on this point set must have at least one edge with 2 bends. This indicates that our simple technique is reasonably good and it will not normally be beaten by other algorithms with respect to the maximal number of bends per edge. Assume G is a plane triangulated graph which is not fourconnected. Let e = (v, w) be an edge of any particular separating triangle which clearly
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
121
exists. Edge e lies adjacent to two triangular faces (v, w, s) and (v, w, t). We destroy those triangles by inserting a dummy vertex z on e, deleting e and connecting z by four new edges to the vertices v, w, s and t. Note that by each single operation, the number of separating triangles decreases and no such triangles are created anew. The dummy vertices z do not appear in any separating triangle. We perform this operation until all separating triangles are destroyed. The separating triangles can be efficiently found by the algorithm of Chiba and Nishizeki [4]. Then the new graph G0 is fourconnected and triangulated. We now apply the basic technique described in the previous section to G0 . The only modification is the handling of the dummy vertices z. Figure 3 gives an example. 1
3
4
5
7 2
1
2 3
4
5
6
7 z1
8
9
10 z2 11 12
1
2 3
4
5
6
7 z1
8
9
10 z2 11 12
6
z1
8 9 10
11 z2
12
Figure 3: An example for the construction of graphs without external hamiltonian cycle. Vertices z1 and z2 are dummies. They arise when destroying the separating triangles. The figures to the right indicate the solutions with three and two bends respectively. Let C 0 be the external hamiltonian cycle as found by the algorithm of Chiba and Nishizeki. Clearly, C 0 visits z, and immediately before and afterwards, it visits two vertices a, b ∈ {v, w, s, t}. We place a new dummy point pz exactly between the points assigned to a and b. Then the graph can be drawn as described above. Finally, we remove the edges (s, z) and (t, z) and join the (at most) two segments of (v, z) and
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
122
(z, w). This immediately gives a drawing with at most 3 bends per edge, since there is at most one dummy vertex on each edge. Lemma 3.1 Given an arbitrary plane graph with n vertices and a set of n points in the plane. In time O(n log n), we can find a mapping of the vertices to the points, so that the edges can be drawn planar and with at most 3 bends each. Markus Eiglsperger suggested a way of saving one bend (out of three) by drawing some of the segments of the edges vertically. In the third part of Figure 3, we indicate the idea. Lemma 3.2 Given a solution with at most three bends for each edge constructed by the algorithms above, we can modify the drawing so that it remains planar and the maximal number of bends is two. The used area might grow exponentially. Proof: Let P be the designated hamiltonian path along the points p1 , . . . pn such that the edges (pi , pi+1 ) are drawn as a straight line. P induces a partition of the drawing plane into an upper and a lower part. Note that for each edge e with two or three bends there is a dummy vertex de placed on an edge (pi , pi+1 ) where the edge e crosses path P . Following the construction above, it is clear that each edge crosses P once at most, hence the two segments of e incident to the dummy vertex de may be able to be drawn vertically. We discuss now the implications of such operations: We consider just the section in the upper part of the drawing, the lower part is handled analogously. Let e be the edge under consideration with segments s1 and s2 where s2 ends at dummy vertex de . Let α1 and α2 be the angles indicating the slopes of the segments as shown in figure 4. Stretching s1 such that α1 remains the same, the angle α2 increases to 90 and the segment s2 becomes vertical. We will call it s02 now. Planarity is eventually violated if there are some segments s with angle β crossing the cone between s2 and s02 . We can correct this easily by rotating the segment s such that β also increases. This process is iterated if necessary. Obviously it ends after at most m steps since we only proceed from left to right and never backtrack. The proper nesting of the edges (halfedges) in the upper o
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
s
s02
s2
β
123
s1 α1
α2
de
Figure 4: The configuration before and after rotating segment s2 in vertical position. part of the drawing ensures that for each edge only m rotations are necessary, implying a quadratic running time. Combined with a corresponding process for the lower part we end when the segments incident to any dummy vertices are vertical and the corresponding bend is saved. In the second part of the proof we sketch a situation where the area grows exponentially. The next figure shows two nested edges with corresponding dummy vertices on different sides (left and right). We assume that the slopes are at 45o to start with and the points and bends lie on integer coordinates. When we perform the modifications described above, so that the segments incident to the dummy vertices become vertical, the drawing grows by more than a factor of two. Now assume that we have n/2 of such pairs nested, as indicated in the next figure. Consider the ith pair from the inside. The drawing of Gi−1 includes an axisparallel rectangle Ri determined by the length of the vertical segments of the edges from the i − 1th pair. Next, we see that the two edges from pair i have to circle around this rectangle using only two bends and one vertical segment in the middle. It follows quite easily that the lengths of these segments must be quite large compared to the height of the rectangle Ri−1 and that a new rectangle Ri of height at least twice as large as the height of Ri−1 results. Hence, we can conclude that the height of the drawing grows
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
124
exponentially, at the very least.
el Gi−1 er ith pair
Figure 5: The recursive definition of the graph with exponential height. We conclude with a note regarding the runtime. Clearly the first part of the construction works in linear time, since we can use the linear time algorithm of Chiba/Nishizeki [4] to determine the separating triangles. Then the saving of the third bends by rotating some of the segments might cause a quadratic number of steps. Theorem 3.3 Any plane graph can be mapped on any given point set in the plane and can be drawn with at most three bends per edge in linear time and with at most two bends per edge in quadratic time.
4
The lower bound
Next, we show that this bound is optimal in the worst case. Consider the following triangulated graph discussed in the example from figure 3. Although there is a hamiltonian path in G, there is no external hamiltonian path. We try to map G on a set of 12 points with the same ycoordinate Y . This point set has the property that each edge with only one bend must lie completely above or completely below the Y line. Any edge segment that crosses the Y line must belong to an atleasttwo bend edge. Let x1 , . . . , x12 be the xcoordinates of the points in increasing order. Since the outer face of G is a triangle with vertices a, b, c it is clear that in any one bend drawing {x1 , x12 } ⊂ {xa , xb , xc } (With xa , we mean the xcoordinate vertex a is mapped to). We examine the case where x1 = xc , x12 =
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
125
a
g
e f h d
b
c
Figure 6: The candidate for the lower bound proof.
c
d
b
h
g
f
e
a
Figure 7: Edge (b, f ) needs two bends in this drawing. xa . Both of the other cases are similar or symmetric. Next we want to draw the outer face. For that we map b to xb , (x1 < xb < x12 ) and draw the outer face edges such that (a, c) bends above the Y line and (a, b), (b, c) bend below. Next we draw the edges of the triangles b, d, a and b, c, d. W.l.o.g., we map vertex d to xd , (xa < xd < xb ) and draw (a, d), (d, c) with a bend above the Y line. We draw the edge (d, b) with a bend above the Y line and show that one edge within triangle {b, d, a} cannot be drawn with only one bend (since {b, c, d} and {b, d, a} are symmetric, we could show the same for {b, c, d} if we would draw edge (d, b) with no bend or a bend below the Y line). Now we want to draw the edges from d to e, f and h. Since we do not
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
126
want to change the embedding and edge (d, b) bends above the Y line, these edges must also bend above the Y line and the xcoordinates of their end points must obey the order xb < xh < xf < xe < xc . Next we draw the edges from a to e, f and g. Since (d, e) bends above the Y line the edges (a, f ) and (a, g) must bend below the Y line. The order of the coordinates is nearly fixed by now: xd < xb < xg , xh < xf < xe < xa . Now we are at a point where we cannot draw edge (b, f ) without letting it cross the Y line, since (d, h) and (a, g) have their bends in opposite directions. See Figure 7. Theorem 4.1 There is a plane triangulated graph with only 12 vertices such that for every placement of the vertices on a straight line at least one edge must bend at least twice in the resulting drawing.
5
The NPcompleteness result
In this section we prove Theorem 5.1 Given any plane graph G with n vertices and n points on a line. The mapping problem of the vertices at the points so that the edges are drawn planar and with at most one bend each is NPcomplete. Proof: To show that the 1bend drawability problem is NPcomplete, we reduce it to the hamiltonian cycle problem for plane graphs. First, note that the externalhamiltoniancycle problem for plane graphs is NPcomplete since it can be used to solve the hamiltoniancycle problem for plane graphs by an iteration over all faces of the embedding. We call a plane graph G = (V, E) (external) hamiltonianextensible if some edges E 0 can be inserted without destroying the previous planar embedding enabling G0 = (V, E ∪ E 0 ) to become (external) hamiltonian. The problem as to whether a given planar graph G can be made (external) hamiltonian by inserting at most k ≥ 0 edges is clearly NPcomplete since its variant with k = 0 is equivalent to the (external) hamiltoniancycle problem for planar graphs. Let G = (V, E) be a given plane graph. The following argument shows that solutions for the problem to make G (external) hamiltonianextensible
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
127
can be converted in polynomial time into a 1bend drawing for G with a set of points on a straight line and vice versa. If G is externalhamiltonian extensible, we take the corresponding external hamiltonian cycle C and apply our basic technique from section 2 to achieve 1bend drawings. On the other hand, if G has a mapping M : V → P on the points of the horizontal line L such that a 1bend drawing D(G) exists, there is clearly no edge which crosses line L. Otherwise, it would bend twice. Let w.l.o.g. M be the mapping such that M(vi ) = pi for i = 1, . . . , n. Hence we can easily extend the embedding of G by edges between any vertex vi and vi+1 for i = 1, . . . , i−1 if necessary. such that this extension completes a hamiltonian path. The last (external) edge between vn and v1 completing the hamiltonian cycle can also be inserted if it does not already exist. This proves the NPhardness of the drawing problem. From the ‘equivalence’ of the problem to make G (external) hamiltonian and the 1bend drawability problem for G with a set of points on a straight line we derive that the latter problem is in NP since like the hamiltoneancycle problem, the extensibility problem is in NP.
6
Discussion
One might argue that we are cheating regarding the lower bound example since all points with the same ycoordinate contradict the commonly used assumption of a general position of the points. On the other hand, the scenario seems quite realistic. If the objects (vertices) are required to be arranged in linear order horizontally or vertically, we get exactly the given set of points which we have already proved to be hard. Open problems: 1. Improve the area bounds, especially for the general case. 2. Extend the lower bound proof and the NPcompleteness result to a set of points in general position. 3. Note that the complexity of the nobend variant is still open, although NPcompleteness is also conjectured [1].
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002)
128
References [1] Bose, P., On Embedding an OuterPlanar Graph in a Point Set, in: G. DiBattista (ed.), Proc. 5th Intern. Symposium on Graph Drawing (GD’97), LNCS 1353, Springer 1998, pp. 2536. [2] Bose, P., M. McAllister, and J. Snoeyink. Optimal algorithms to embed trees in a point set. Journal of Graph Algorithms and Applications 1998. [3] Castaneda, N. and J. Urrutia., Straight line embeddings of planar graphs on point sets. Proc. 8th Canadian conf. on Comp. Geom., pp. 312318, 1996. [4] Chiba, N., and T. Nishizeki, Arboricity and subgraph listing algorithms, SIAM J. Comput. 14 (1985), pp. 210–223. [5] Chiba, N., and T. Nishizeki, The hamiltonian cycle problem is lineartime solvable for 4connected planar graphs, J. Algorithms 10 (1989), pp. 189211. [6] Chvatal, V., The traveling salesman problem, J. Wiley and Sons, 1985, pp. 426. [7] Di Battista, G., Eades, P., Tamassia R. and I.G. Tollis, Algorithms for Automatic Graph Drawing: An Annotated Bibliography, Brown Univ., Tech. Rep., 1993. [8] Feige, U., Approximation the bandwidth via volume respecting embeddings. Proc. 30th Annual ACM Symp. on Theory of Computing, 1998, pp. 9099. [9] Garey, M.R., D.S. Johnson, The Rectilinear Steiner Tree Problem is NPcomplete, SIAM J. Appl. Math. 32 (1977), pp. 826834. [10] Garey, M.R., D.S. Johnson and L. Stockmeyer, Some simplified NPcomplete graph problems, Theoret. Comp. Science 1 (1976), pp. 237–267. [11] Gritzmann, P., Mohar, B., Pach, J. and Pollack, R. Embedding a planar triangulation with vertices at specified points. in: American Mathematical Monthly 98 (1991), pp. 165166. (Solution to problem E3341). [12] Ikebe Y., M. Perles, A. Tamura and S. Tokunaga, The rooted tree embedding problem into points in the plane, Discr. and Comp. Geometry 11 (1994), pp. 51–63. [13] Lengauer, Th., Combinatorial Algorithms for Integrated Circuit Layout, Wiley, 1990.
M. Kaufmann and R. Wiese, Few Bends, JGAA, 6(1) 115–129 (2002) [14] Leighton, F.T., Parallel Algorithms and Architectures: Hypercubes, Morgan Kaufmann, 1992.
129
ArraysTrees
[15] Pach J. and R. Wenger, Embedding Planar Graphs at Fixed Vertex Locations, in: Sue Whitesides (ed.), Proc. 6th Intern. Symposium on Graph Drawing (GD’98), LNCS 1547, Springer 1999, pp. 263274. [16] Pach J. and J. T¨ or¨ ocsik, Layout of rooted trees, in: W.T. Trotter (ed.), Planar Graphs, vol. 9 of DIMACS Series, pages 131137, 1993. [17] Papadimitriou, Ch., The NPcompleteness of the bandwidth minimization problem, Computing, 16(3), 1976, pp. 263–270.
Journal of Graph Algorithms and Applications http://www.cs.brown.edu/publications/jgaa/ vol. 6, no. 2, pp. 131–147 (2002)
Art of Graph Drawing and Art Jaroslav Neˇsetˇril Department of Applied Mathematics and Institute for Theoretical Computer sciences (ITI) Charles University Malostransk´en´ am. 25, 11800 Praha, Czech Republic
[email protected] Communicated by H. de Fraysseix and and J. Kratochv´ıl: submitted October 2001; revised November 2001.
The Institute for Theoretical Computer sciences (ITI) is supported by Grant LN00A56 from the Czech Ministry of Education.
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
1
132
Introduction
Art and Science .... These seems to be key words of many contemporary writings. And scientists certainly are only happy to stress aesthetic qualities of their activity and artists like to justify their endeavor by science and technology. But these connections are very often superficial and often lead only to impatience how superficially without a deeper understanding and insight these connections are treated [7]. Here we want to illustrate some conceptual, or rather spiritual and methodological similarities of doing mathematics and art. We stress the word ‘doing’. ‘Doing’ in the true sense of informed and complex pursuit of actual questions and problems of contemporary art and science. (By ”Science” we mean here Mathematics in general, but also Computer Science and. of course, Graph Drawing; this is a volume devoted to the Drawing of Graphs.) Although both these areas are manifold and extremely diverse, we believe that they share some common qualities and profound similarities. These similarities are best traced by considering together the development and the methods of modern mathematics and modern art. Rather than considering the final products (works of art or theorems) we wish to stress similarities in the modus operandi of artists and mathematicians. We wish to stress that some of these similarities can be traced to all levels and moments of the production of both art and mathematics. And we are convinced that these similarities stem mainly from the idealistic character of both pursuits. But one has to search deep and one has to try to avoid superficial similarities and differences. We would like to rephrase the words Kandinsky used when comparing art and music [18]: In our opinion the similarities of art and mathematics are evident but they lie very deep. In fact, in the realm of true activity guided by inspiration and inspiring awareness there seem to be common features in most human activities. We put this forward as a creative thesis [29] and we return to this at the end of this article. But this article is for Graph Drawing and also there is more here than meets the eye. The prime problem of Graph Drawing is to visualize properly and as accurately as possible the information which is given to us in a confusing, sometimes pictorial and sometimes mathematical, or “technical”, way. This intended visualization should help us to understand, should attract and should explain. It is interesting to note that on such abstract gnoseological level these are the same aspects and problems which are facing an artist when he/she is trying to convey his/her message. Visualization, representation, the reality and its model are the code words. Clearly this is complemented by further aspects which make the whole picture more complicated and stresses the differences of these areas but still the abstract core is similar if not the same. (At this place it is only proper to stress the following: one has to be careful with analogies and parallels. We try to stress only those points which one can see and prove beyond doubts. Otherwise we can easily slip to the level of an essay and unjustified speculations.) This text is based on the article Art of Drawing [28] which in turn is based on an invited talk delivered by the author at GD’99. That lecture was conceived as
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
133
a multimedia show with slides, transparencies and CD projection (which operated fluently thanks to Hubert de Fraysseix). These three parts of the lecture, projected on three different screens, were called Samples, Stories and Souveniers. Since then some progress has been made and this lecture has been given in another context. Most notably in March 2001 in the Institute for Art History of the Academy of Sciences of the Czech Republic (thanks to an invitation of Mahulena Neˇslehov´ a) and at E.H.E.S.S., Paris, (thanks to an invitation of Pierre Rosenstiehl). Also on the scientific level a progress (a bit surprisingly) has been made. Recently this author devised an invariant, Combinatorial Entropy, which could serve as a measure of an aesthetic quality of a scheme and this, after several discussions with Michel Mend`es France, was thoroughly tested together with Jan Adamec on a large number of examples from both Art and Graph Drawing. A research article appeared in [2] and led to an article (of a more philosophical contents) in [30]. This text then complements both of these texts and it contains some new complementary material. I thank to the editors H. de Fraysseix and J. Kratochv´ıl for suggestion to include this paper in their volume and for several constructive remarks.
2
Three easy problems
We begin our story by recalling a situation which happens often at IQ (or similar) tests: The person being tested is asked to perform a routine task, task which may be a bit time consuming and which basically tests whether he or she understands a certain notion (i.e., understands under certain mentaltime stress). Such a question may read: 1. Draw a curve! 2. Divide a square in two rectangles and two squares! 3. Divide a rectangle into two triangles and two pentagons! Of course the authors (of such tests, if they exist at all) are seeking an easy answer. But sometimes in their own naivete they perhaps do not know that a dog is hidden under carpet. The expected answer to Question 1. is of course some ”easy” picture of a curve. And as the authors of these tests believe, the easier answer mirrors a deeper understanding. But the complicated history of curves and their theory tells us something else. It is hard to tell what a curve is. It is hard to postulate it once for all by means of a selfcontained definition (not involving pictures and hand waving) which would nevertheless cover all the variety of shapes of all possible curves. As often happens  a thing which is intuitively clear becomes less clear the more we think about it: A curve may have no derivative (e.g. a sharp peak) at any of its points (Bolzano and Weierstrass), a curve may have an infinite length and yet it may enclose a finite area (Koch and others), a curve may fill the whole plane (Peano and others). Even the notion like the length of a curve is a complicated phenomenon and this question was in fact one of the initial questions which
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
134
started the Theory of Fractals [20] and led to the notion of the fractal dimension. If we generalize Euclidean plane and space to ndimension we always have n an integer (as it depicts the number of coordinates). However measuring curves in a fractal way we arrive at dimensions which are not necessarily integers. So some curves may have, say, dimension 4/3. The concept of fractal dimension goes back to the beginning of this century (Hausdorff and Besicovitch). Much later it recently played key role in theory which became truly part of popular science. With all its beautiful and easily generated pictures (and perhaps, because of this, so often quoted misleadingly in an arthistorical context; see e.g. [19]). The fractal theory got mathematics seemingly as close to visual mathematics and even art as possible. As a result of this, the results were popularized, misunderstood and even misused at both ends of the spectrum. On one side these mathematically involved theories with all its interesting visual output are too tempting to the scientific audience and as a result of this they substitute modern art for many. On the other side, the interesting ‘mystical’ vocabulary is too tempting to art historians and critics alike. There is much evidence that this is done freely, too freely, like a new poetic enchanting word machine. (There is a newly emerging new candidate for this: the complexity theory). But the fractal theory is a natural counterpart of our theory and of our definition of Combinatorial Entropy below. Returning to our main theme: so just to define a curve is a highly nontrivial matter and thus an answer to question 1. could be certainly less selfconfident. An informed individual would have the right to ask ‘A curve in which sense?’ Admittedly we cannot use this strategy at questions 2. and 3. Here the questions call for a solution (displaying that one knows the meaning of the concepts). And the answer to 3. comes without any effort at the very moment when one gives up (try a flat rectangle and indicate that you give up by crossing it twice!). But both these questions involve the construction of a special pavement or tiling and that is in general both an important and complicated question. A question which can be traced from prehistoric times, through mysticism of the Middle Ages until today. And in its combinatorial refinement this area took several surprising twists. We cannot resist mentioning here the spectacular configuration (nonperiodic tiling of the plane using just two building blocks!) due to Penrose which had spectacular influence in as remote areas as algebra, crystallography, molecular chemistry and other areas which had nothing to do with the original intentions. Now, here is one of the pearls of the tiling theory: In 1903 the German mathematician Max Dehn asked a simple, seemingly innocent question: Can one divide a square into a finite number of squares of different sizes? Unlike in the usual picture (a possible answer to the Question 2) where we divide a square into 4 squares all of which are of the same size. Such a partition of the square is called perfect square. Does a perfect square exist? Does a perfect square exist at all? Yes or no? This is one of the beautiful aspects of mathematics, yes or no, there is no other way around. Modern mathematics developed techniques for asking and answering imprecise questions, for relative answers (subject to
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
135
various models), for answering and (lying) with certain probability. Yet the categorical yes/no question is still one of the main (and proud) characteristics of the field. The Dehn’s problem appeared to be not so easily solvable and after few decades it was solved independently by A. Sprague(1940) and a group of Cambridge undergraduates: A. Brooks, C. Smith, A. H. Stone and W. Tutte (1940), all of whom later became well known researchers. The affirmative answer was not obtained by an elaborate (and primitive) search, but by a search involving the rudiment of a theory. A series of ingenious reductions and reformulations (involving areas such as flows and electrical networks) made the initial problem accessible. Without this the problem would be too difficult to handle. It is interesting to note that the smallest perfect square is uniquely determined. It presents a division of a square into 21 different squares. One cannot partition a square in less than 21 different squares and there is only one such partition into 21 squares (up to natural transformation such as rotations and flipping). This unique design was sought for several decades and Duijvestijn solution finally came in 1978 (partly with the help of a computer). The uniqueness of this configuration of 21 squares is quite astonishing! It is the conviction of this author that the concentration of hard work and ideas makes from this square tiling a similarly unique object as the sensitivity, experience and (yes) hard work of Mondrian. So perhaps these special qualities justify its inclusion here. Actually, Charles Payan (Grenoble) produced an artistic object based on the Duijvestijn pattern and his object shares similarities with some of the Mondrian’s painting, see [30].
3
Openings
The formal similarities between art and various aspects of mathematics (mostly geometry) are both classical and contemporary. The mysticism of the golden ratio, of the pentagon, of the regular polyhedra and of pythagorean numbers draws fascination of many and this is applied with a lot of effort to the analysis of anything from the principles of life to pyramids and Gothic cathedrals. And this is of course more true for complicated mathematical questions of perspective and vision in general. Particularly the Renaissance connection is usually quoted as the prime time of relevance of mathematics and art. There can be no doubts that mathematics at that time did some good service to art. (If only to help to upgrade artists from mere craftsmen to free artists in the same category as thinkers.) Maybe at this time of confusion and (what some call) art crisis, art intuitively seeks again a helping hand or solid base or whatever name you want to use for outwardly directed trends in recent art. But this is not so simple and traps are waiting on this road. All this will succeed only in the case when the mutual relationship (of mathematics and art) is freed from arbitrariness, superficial analogies and passing comments. Mathematics was always a source (yes, a generator; mathematics is also a logical machine) of complex (for outsiders, mystical) patterns. This is even more
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
136
true today than ever. With our understanding of randomness, of deterministic chaos and aided by graphical devices attached to computers, this ‘artistic potential’ of mathematics is growing. It is our conviction that this pattern generation displays mostly formal and superficial similarities to art. This is the case with fractals (mentioned above) and computer graphics in general, with patterns in chip design which resemble both minimalistic works and complex patterns of microbiology and underwater life. These tricks found one of their culminating forms in wonderful commercials and video clips. Complexity of these forms surpasses any expectation and the variety and combination of tools (and energy, and money) is simply amazing. Consider an example from another corner: the work of M.C. Escher displays a dizzying technique and explicitly touches and even anticipates some mathematical problems of tilings (tilings with special symmetries; similar to those we described above). But however intriguing all this may be, we feel that this has no bearing on the mainstream of art, better on the main problems and challenges which art and artists have been solving and are facing and solving today. And in a sense all these forms are based on combinatorially refined byproducts of mathematics and computer science as well.
4
Archaeology of Aesthetic
Consider the following two problems: I. When was the last time that you taught somebody (possibly your own child) how nice this world is and what marvels and beauties it contains? II. When was the last time that men and women were solving the problems how to make a painting, a drawing or a photograph which would depict accurately (and/or romantically, and/or critically, and/or harmoniously) the surrounding world? The answers to these questions seem to be very different. An answer to the first is reflecting (everyday) experience of parents and educators and on the abstract (theoretical) level it was treated in numerous books by various theories. These theories seem to be in (general) agreement with the concrete and mainstream educational praxis. The second question seems to be more complex (and it is also a more abstract problem). Somehow it seems (to many) that this is an old fashioned problem which is the subject of early modernism if not renaissance. Yet we believe that with computers this question gains a new momentum. In this paper we address this problem. Despite the implicit word computer in the title in this paper, we do not address the question of visualization, of picture processing of visual information in the sense of Computer Graphics. The information for us is already processed and typically is of a very simple type such as a drawing (however, not necessarily a technical drawing, it may be also a drawing of an artist). What we would like to decide is how to formalize the fact that a picture (drawing) is harmonious. We mean harmonious in the sense of being aesthetically pleasing. We prefer the word harmonious to aesthetical (which is probably more in common usage)
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
137
as an aesthetic feeling is probably highly individual and we cannot have an ambition to define it (or even approach it). The long tradition of art history is convincingly telling us this. We propose an approach which should capture some features of what makes a picture (drawing) harmonious by means of the notion of Combinatorial Entropy. This approach is based on the analysis of curves ([25]) which in turn goes back to Steinhaus and Poincar´e. The hereditary approach which we introduce below may be viewed as an approach dual to Piaget’s analysis of intelligence, see e.g. [33] and compare [30]. Combinatorial Entropy is an invariant with respect to scaling and rotations, and it is a very robust parameter. This is an important feature as a perception of harmony (and of aesthetic pleasure) is a robust feeling. Moreover Combinatorial Entropy can be computed for a large class of drawing and pictures. It is routine to apply it to scanned information and no analytic description is needed. Perhaps this parameter could aid in the hierarchical approach to graph visualization in selecting a particular model which suits the best a given specific context. And as it can be scanned routinely it can be applied to vast data of molecular biology, digital libraries and even museum collections (particularly graphics and drawings) as an easily available descriptor. After these introductory lines let us begin by describing our initial situation in greater detail.
5
On Invariants for Graph Drawing
What makes the following pictures similar and what makes them different? (The substance and the context are important artistic aspects. However we are interested here only in formal similarities of these pictures; one picture is a musical score  a sketch by Jan´ aˇcek [35], the other picture is one of the Moduli  a sketch by Naˇceradsk´ y and the author [31].)
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
138
And, very simply, can we distinguish or order in some systematic way the following three figures (graph drawings using a program due to [9])?
The modern version of these questions is not how to teach a gifted and collaborating child what is nice and beautiful. Instead we need to teach an individual which is not collaborating at all and who takes every our information deadly seriously and exploits it to the last bit  a computer. People usually do not react this way (and if so, then only in comedies like [13] or [14]; the fact that these great novels have a military setting is then not an accident). In order to “teach” a computer (and even without ambition for teaching, just dealing with it) we need a precision. And precision in the other words calls for some concrete measures of our phenomena, in the other words for invariants. The purpose of this note is to suggest such an invariant and to document some experiments which we performed. Consequently, the traditional principal problem of aesthetics (and art history)  to explain and to predict artistic and aesthetically pleasing  took recently an unexpected twist. We do not explain and deal with individual instances, we have to classify a vast amount of data and we have to design procedures with likely harmonious output. This problem in its manifold variety is interesting already when our objects are well defined compositions composed from simple building blocks such as lines, squares, sticks,.... This in fact is a familiar exercise and training ground of schools of design and architecture and (traditional) art academies. This illustrates difficulty and variety of solutions even of simple situations. This should be not surprising if we realize how many simple lines needed, say Rembrandt or Picasso, to produce full images (for example drawings; 50 lines or even less!). For our “simple composition from simple building blocks” we would like to create an invariant which would help us to categorize and order these compositions. It is difficult to say even on this simple level what it is an invariant, but we can certainly state which properties such an invariant should have: i. invariant should be an (easy) computable aspect of the structure; ii. invariant should be consistent (or invariant, meaning it should not change)
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
139
under chosen modification of structure; iii. invariant should be useful in that it can be used to catalogue, to order (which structure is “better”), to classify, to distinguish. We propose here an invariant  called hereditary combinatorial entropy  to measure an aesthetic quality of a visual data (drawing, scheme, painting, note score, molecular data output and others). This invariant is presented in the next section.
6
Hereditary Combinatorial Entropy of a Drawing
Before defining the invariant we want to specify the rules under which the invariant should remain unchanged. Such rules were specified several times and are folklore in the visualization of scientific results. For example the book [5] lists (in section “Aesthetics”) the following 11 graphic properties (called aesthetics) which are commonly adopted: Crossings, Area, Total Edge Length, Maximal Edge Length, Uniform Edge Length, Total Bends, Maximum Bends, Uniform Bends, Angular Resolution, Aspect Ration and Symmetry. The names of these criteria are selfexplanatory and together they form a very good paradigm for drawing of graphs. However most of them are specific for drawings of graphs (or similar structures) and they do not apply generally (for example to artistic drawings or sketches). Yet we believe that the aesthetic quality of visual algorithms should be tested on aesthetically charged objects. This is one of the underlying ideas of our approach. There is another drawback of the above paradigm. In all of these criteria (with exception of angular resolution, where we want to maximize, and symmetry which is a structural property) we are aiming for a minimization (for example we want to minimize the total length of our drawing). That of course means that we have to optimize these criteria (as they are sometimes mutually pointed against each other) and we have to add to our paradigm preferences among them. However as optimization problems these criteria are computationally hard (see [5]). Our approach is different and we believe it could add a new aspect to visualization and analysis of visual data. Let us first specify objects which are relevant to our method: A drawing D is a finite set of curves in Euclidean plane. (As our drawings are man made we assume that the set is finite.) A curve is a continuous image of unit interval in plane (we mean a “nice” image; this is not place for technicalities). A painting can be any image, including photographs. It typically consists of differently colored areas. An engraving is a very special kind of object, since it can be included in the previous two classes. However seeing it as a drawing gives a lot more information.
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
140
For an infinite line L and a drawing D denote by i(L, D) the number of intersections of the line L and the drawing D. We define the Combinatorial Entropy Hc (D) of a drawing D as the expected value of i(L, D) where expectation relates to the random selection of line L. Combinatorial Entropy is also called Fractional Length from reasons to be mentioned later, see [1, 2]. By virtue of this definition we note the following: i. The combinatorial entropy Hc (D) is easily evaluated by a random generation of lines; ii. Hc (D) is invariant under transposition and rotation; iii. Hc (D) is invariant under scaling (i.e. “blowing up”). The role of randomness in the art has been discussed e.g. in [25], [26]. These facts make it possible to evaluate (or very accurately to estimate) combinatorial entropy of many drawing schemata, drawings of artists (we systematically tested some of the early works of Picasso [32] and Kandinsky [18] as well some drawings from [31]). We also used the analytical description of tertiary structure of some of the proteins (provided by P. Panˇcoˇska, compare [17]). The software developed in [1] uses standard tools of digital image processing, see [3], [34] and allows to handle a very broad spectrum of examples. Most difficulties are with paintings, because they must be transformed into drawings in order to count number of intersections (several filters are applied on the picture to find its contours, the resulting picture is drawing as we defined it before). Let us state some specific examples: the above Jan´aˇcek score had combinatorial entropy 18.55 which is quite similar to the combinatorial entropy 17.87 of the above drawing of Naˇceradsk´ y and Neˇsetˇril taken from [31]. The three graph drawings depicted above have combinatorial entropy (from left to right) 5.70, 5.37, 6.96.
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
141
The method is flexible enough to handle complex drawings and pictures. For example classical prints from J. Verne novels when considered as a dense network of individual lines (no blurring). For example the following picture (due to Roux) [38] which serves as the front illustration of [22] has combinatorial entropy 136.6. As expected (both by the intuition and a few trials) the n × n grid has approximate combinatorial entropy n. (As lattices are given analytically we can perform this experiment for very large n). Many more examples are contained in [1, 2]. What do these numbers mean? What is a significance of the combinatorial entropy of a drawing? The definition of the combinatorial entropy is motivated
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
142
by the research done by prof. Michel Mendes France in a series of papers devoted to the analysis of curves, [25]. He defines the temperature T (D) of a curve D by the following formula T (D) = (log
E(i(L, D)) −1 ) E(i(L, D)) − 1
where expectation relates to the random selection of the line L. He related this parameter to entropy, dimension and other parameters which he defined in an analogy to fractal theory, statistical physics and geometric probability and integral geometry. These definitions rest on classical theorems due to Steinhaus [37] (which in turn goes to Poincar´e). One can show that the logHc (D) is a good approximation of the entropy of a curve. Thus the name Combinatorial Entropy for our invariant. By viewing a drawing as a set of curves and thinking of Eulerian trail [22](in each component of the drawing) as a new curve of double length (as we traverse every segment of a drawing twice) we can define the the temperature by the same formula for a more general class of pictures (drawings). For large number of intersections (of a drawing D with a line L) the temperature T (D) is approximately equal to the average value of i(D, L) − 1 = Hc (D) − 1 while the entropy H(D) (in the classical sense) is approximated by the logarithm of the combinatorial entropy Hc (D). It follows (and this is Steinhaus’ theorem) that the combinatorial entropy Hc (D) of a drawing D is approximated by the ratio 2`(D)/c(D) where `(D) denotes the total length of the drawing D and c(D) denotes the length of circumference of the (convex closure) of D. (This suggests the alternative name fractional length, see [30] for details.) Based on these interpretations Hc (D) measures the information content and the amount of work which the artist (explicitly) put into his drawing. On the other hand, by comparing various drawings of the same object (or theme) the lower Hc (D) indicates the elegance and simplicity of the output. However as such the combinatorial entropy captures only the global properties of the drawing (expressed by the total length of the drawing and the circumference). Still, via the average number of intersections it captures, implicitly, many properties of the drawing. In [30] we also proposed a technique (based on the algebraic structure cogroup ) to generate harmonious objects. In our setting this can be formulated as follows: Hereditary Combinatorial Entropy Thesis A harmonious (or aesthetically pleasing) drawing or design has combinatorial entropy in each of its (meaningful) parts proportional to the global combinatorial entropy. Here a meaningful part is a part which reflects the properties of D. For the following (author) drawing (of our institute in Prague)
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
143
we found the following distribution of combinatorial entropies (this is based on the regular partition of the square into smaller squares; the combinatorial entropy of the drawing restricted to a particular subsquare is listed in the middle of the subsquare):
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
7
144
Constructible World
The spiritual contents of art is growing. More and more an artistic object is an act, quoting Damisch, a move of the mind. A painter thinks and he/she does so through and in his/her painting, just in the same way as a mathematician thinks and he/she does so through his/her results: definitions, theorems, proofs. We do not have here in mind only conceptual art and the like, we think of art generally. And this is not a revolution. Only the dust of time, misinterpretations of history and the pride of contemporaries covered all the bold moves (how fitting a word in this context) of old masters. Let us summarize: Our intention in this short paper has been to draw some parallels between art and mathematics mainly from the creative point of view. We have tried to stress some similarities. [28, 29, 30] contains some more and perhaps more complete material. The interested reader probably knows many other examples of such similarities from his/her experience. Is the existence of such similarities just a coincidence? We do not know. Let us end this note in a highly speculative way: In mathematics there is a principle called ‘Church thesis’ which in essence claims that every (intuitive) algorithmic procedure takes a particular form, a form expressed by (any) universal computing machine. Maybe something like Church’s thesis holds in general for human activities. Let us try to formulate this thesis as follows:
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
145
Creative Thesis( [29]) All sufficiently deep human activities, all sufficiently deep understandings, have profound similarities. This is exhibited in the way the work (knowledge) is organized, in the way it is revealed and in the way it interacts with other activities. Admittedly this is too vague. But this one has to expect at such a level of generality. Perhaps one should interpret the thesis positively. How often are stressed only the conflicting features of artistic and scientific communities, say, along the lines of feelings and sensibilities as opposed to mind and brain activities. We feel that these views are often superficial and isolationist, and sometimes simply an overreaction. On the other hand there is a numerous supporting evidence and two such examples were considered in [29]: sketches or sketching and minimalistic trends. By the same token it is difficult to find a counterexample to the thesis. Mathematics, in particular, is a rich generator of complex patterns and as such it is often used (above we mentioned some examples). So it will be difficult to break the mathematical trap everything goes, everything is possible. There is no doubt that the new means of technology and guided by math and computerdevices will lead to new art form. But it is a conviction of this author that to break the trap of uniformity and unbelievable combinatorial variety of technology will require some profound and probably not yet discovered ideas. And this is probably the realm of scientists and artists, maybe for the first time since the Renaissance. We do not know yet. But we have to try...
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
146
References [1] J. Adamec. Kreslen´ı graf˚ u. Diploma thesis, Charles University, Prague (2001). [2] J. Adamec, and J. Neˇsetˇril. An Aesthetic Invariant for Graph Drawing. In: Proceedings of Graph Drawing 2001, LNCS, Springer Verlag 2001. [3] G. A. Baxes. Digital Image Processing. Principles and Applications, Wiley, 1994. [4] G. D. Birkhoff. Aesthetic Measure. Harvard University Press, Cambridge, Mass. 1933. [5] G. Di Battista, P. Eades, R. Tamassia, and I. G. Tollis. Graph Drawing. Algorithms for the Visualization of Graphs. Prentice Hall 1999. [6] T. J. Clark. Modernism–a farewell to an idea. Yale Univ. Press, 2000. [7] H. Damisch. The Origins of Perspective. MIT Press 1994, original French edition Flamarion 1987. [8] H. Damisch. Le travail de l’art: vers une topologie de la couleur? In: [31]. [9] H. de Fraysseix. Graph Drawing SW (personal communication). [10] T. de Duve. Kant after Duchamp. MIT Press 1998. [11] R. J. Gardner. Geometric Tomography. Notices AMS, 42, 4 (1995), 422– 429. [12] B. Gr¨ unbaum, and I. Steward. Tilings and patterns. W.H. Freeman, 1986. ˇ [13] J. Haˇsek. Osudy dobr´eho voj´ aka Svejka. 1920 (in English: The Good Soldier Schweik ). [14] J. Heller. Catch–22. 1961. [15] D. Hilbert. Grundlagen der Geometrie. Teubner 1934 [16] A. Edelman, and E. Kostlan. How many zeros of a random polynomial are real? Bull. Amer. Math. Soc. 32, 1 (1995), 1–37. [17] V. Janota, J. Neˇsetˇril, and P. Panˇcoˇska. Spectra Graphs and Proteins. Towards Understanding of Protein Folding. In: Contemporary Trends in Discrete Mathematics, AMS, DIMACS Series 49, 1999, pp. 237–255. [18] W. Kandinsky. Point and Line to Plane. Dover Publications 1979. [19] S. Kol´ıbal. Retrospektiva. N´ arodn´ı Galerie, Praha 1997 [20] B. Mandelbrot. Les Objects Fractals Flammarion 1975, 1984, 1989, 1995.
J. Neˇsetˇril, Art of Graph Drawing and Art , JGAA, 6(2) 131–147 (2002)
147
[21] J. Mandelbrojt, and P. Mounoud. On the Relevance of Piaget’s Theory to the Visual Arts. Leonardo 4 (1971), 155–158. [22] J. Matouˇsek, and J. Neˇsetˇril. Invitation to Discrete Mathematics. Oxford Univ. Press 1998. [23] K. Mehlhorn, and S. Naher. LEDA–A platform for combinatorial and geometric computing. Cambridge Univ. Press, 1999. [24] M. Mend`es France, and A. H´enaut. Art, Therefore Entropy. Leonardo, 27, 3 (1994), 219–221. [25] M. Mend`es France. The Planck Constant of a Curve. In: Fractal Geometry and Analysis (J. B´elair, S. Dubuc, eds.) Kluwer Acad. Publ. 1991, pp. 325– 366. [26] M. Mend`es France, and J. Neˇsetˇril. Fragments of a Dialogue. KAM Series 95–303, Charles University Prague (a Czech translation in Atelier 1997). [27] A. I. Miller. Insight of genius. Springer Verlag, 1966. [28] J. Neˇsetˇril. The Art of Drawing. In: Graph Drawing (ed. J. Kratochv´ıl), Springer Verlag,1999 [29] J. Neˇsetˇril. Mathematics and Art. From The Logical Point of View, 2, 2/93 (1994), 50–72. [30] J. Neˇsetˇril. Aesthetic for Computers or How to Measure a Harmony. To appear in Visual Mind (ed. M. Emmer), MIT Press. [31] J. Naˇceradsk´ y, and J. Neˇsetˇril. Antropogeometrie I, II (Czech and English). Rabas Gallery, Rakovn´ık, 1998 (ISBN 8085868253). [32] P. Picasso. Picasso–Der Zeichner 1893–1929. Diogenes, 1982. [33] J. Piaget. Logique et connaissance scientifique, Gallimard. Paris, 1967. [34] W. K. Pratt. Digital Image Processing. Wiley, 1978. ˇ edroˇ [35] M. Stˇ n. Leoˇs Jan´ aˇcek and Music of 20. Century. Nauma, Brno, 1998 (in Czech). [36] L. A. Santal´ o. Integral geometry and geometric probability. Addison Wesley 1976. [37] H. Steinhaus. Length, shape and area. Colloq. Math. 3 (1954), 1–13. [38] J. Verne. Sans Dessus Dessous. J. Het zel (Paris), 1889. [39] H. Weyl. Invariants. Duke Math. J. 5 (1939).
Journal of Graph Algorithms and Applications http://www.cs.brown.edu/publications/jgaa/ vol. 6, no. 1, pp. 149–153 (2002)
Realization of Posets Patrice Ossona de Mendez CNRS UMR 8557 E.H.E.S.S. 54 Bd Raspail, 75006 Paris, France http://www.ehess.fr/centres/cams/person/pom/index.html
[email protected] Abstract. We prove a very general representation theorem for posets and, as a corollary, deduce that any abstract simplicial complex has a geometric realization in the Euclidean space of dimension dim P (∆) − 1, where dim P (∆) is the DushnikMiller dimension of the face order of ∆.
Communicated by H. de Fraysseix and and J. Kratochv´ıl: submitted May 2000; revised July 2001.
P. Ossona de Mendez, Realization of Posets, JGAA, 6(1) 149–153 (2002)
1
150
Introduction
Schnyder proved in [3] that a graph is planar if and only if its incidence poset (that is: the poset where x < y iff x is a vertex, y is an edge and y is incident to x) has dimension at most 3. That an incidence poset has dimension at most 3 implies that the corresponding graph is planar has been extended to abstract simplicial complexes in [2]: if the face order of an abstract simplicial complex ∆ is bounded by d + 1, then ∆ has a geometric realization in Rd . We prove here a more general result on poset representation which implies this last result straightforwardly. We shall first recall some basic definitions from poset theory: A partially ordered set (or poset) P is a pair (X, P ) where X is a set and P a reflexive, antisymmetric, and transitive binary relation on X. A poset is P = (X, P ) is finite if its ground set X is finite. We shall write x ≤ y in P or x ≤P y if (x, y) ∈ P . Two elements x, y ∈ X such that x ≤ y in P or y ≤ x in P are said to be comparable;otherwise, they are said to be incomparable. If P and Q are partial orders on the same set X, Q is said to be an extension of P if x ≤ y in P implies x ≤ y in Q, for all x, y ∈ X. If Q is a linear order (that is: a partial order in which every pair of elements are comparable) then it is a linear extension of P . The dimension dim P of P = (X, P ) is the least positive integer t for which there T exists Tt a family R = (0 In this case, the number of vertices in the graph is equal to: i 2 + i ⋅ (3m1 − i ) + (3m1 )2 = 3(m1 + 3m12 ) = 3m2 , for some positive m2. In the case
of the regular triangulated graph, this is a necessary condition for it to have a 3coloring, because all elementary cycles are of length three (triangles) and no larger.
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
390
Color 1
2
Color 2
6
5
Color 3
10
9 8
7
6
2 6
9
8
9 8
3
2 7
6 10
10 7
2
3
5
6
7
1
0 4
10
8 4
5
3
9
8 9
1
7 10
7 10
2
3
3
8 9
6
Figure 10 The coloring of T i , j when i− j =3 m for T4,1 This particular type of graph has all corner vertices of its hexagonal tile representation (see the tilings of the triangular lattice) corresponding to vertices in the infinite triangular lattice. All other Ti , j graphs, as the one shown in Figure 5, have the hexagonal corner vertices falling in centers of triangles in the infinite lattice. The two vertices mentioned above are repeating in an interleaved fashion, such that each appears three times at the corners of the hexagonal tile. An example of this particular case, when (ij) mod 3 = 0, together with its unique 3coloring is given in Figure 10. The graph displayed is T4,1 with 21 vertices. Notice that the graph has a multipleofthree number of vertices. Also, the vertices 7 and –7 (i.e., ρ i, j /3 and − ρ i, j /3) are the vertices repeating on the corners of the hexagonal tile. The validity of the coloring can be checked by looking at the colors of the vertices with the same label, inside and outside the central hexagonal tile.
Case 2: i = 2 , j = 1 This case is an exceptional one for graph T2,1 and it is the only case when 7 colors are needed. Graph T2,1 is the clique on 7 vertices, K7, and thus has a chromatic number equal to the number of vertices: 2 2 ρ 2,1 = 2 + 2 ⋅ 1 + 1 = 7 .
Case 3: i > j > 0 , Case 2.
for all i,j with GCD(i,j)=1 not included in Case 1 and
In this case, no 3 or 4 coloring has been found. A reason why there is no 3coloring is because the graph is 6regular, the length of the smallest cycle is 3, and the number of vertices is not a multiple of 3. Moreover, since the
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
391
triangular lattice is uniquely 3colorable, the triangulated torus in this case cannot have a 3coloring. A scheme that depicts the compulsion to use 5 colors is shown in Figure 11. Here the first step involves the coloring of the vertices around the 6 corners of the hexagonal tile. There are several possible combinations but no matter what combination we pick, when coloring the rest of the graph as shown in the second step, a fourth, and then a fifth color is necessary. The dotted labels mean that there is a choice to interchange the labels, but the cases are symmetric. The labels A, B, and C suggest the order of picking the colors, and in parentheses are the colors picked for this particular case. All cases are just permutations of the one displayed and one will obtain the same coloring result, i.e. that 5 colors are needed and sufficient for the coloring of the Ti,j, for i and j not included in the previous two cases. The coloring of the Ti,j graph is employed in the resource allocation problem for interconnection networks, where a limited number of resources need to be uniformly dispersed throughout the network [BaeB97]. T3,1 2
2 1 1
1
3
2
1
3
3
3
1
2 3
2
3
2
4
3
2 3
C(5) B(4) 4
2 1
1
3
A(1)
3
2 1
2 1
1
2
1
2 1
3
3
2 3
Figure 11 Two steps in the coloring procedure of the general case of Ti,j
4.2 The Computation of the Diameter of Ti,j The diameter of a graph is the length of any longest shortest path between any two vertices in the graph. Let us consider the repeat origin points highlighted on the triangular lattice in Figure 12. The diameter of the Tij graph can then be easily computed as the shortest graph distance from the origin labeled as A to the point P, which actually represents the physical corner of the hexagon in the hexagonal tiling using the Voronoi diagram, as shown in Figure 5. Note that P could coincide or not with a lattice point, in which case we will take the integral part of the AP distance. Hence,
AP =
1 AF 3
The graph distance, denoted by d(), between the points A and F can be computed using the construction depicted in Figure 12, as follows:
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
392
d(A, F ) = d(A, B ) +d (B, F ) = = (d (A,C ) − d (B,C )) + (d (C , D ) + d(D, E ) + d (E , F )) = = (i − j ) + ( j + i + j ) = = 2 ⋅i + j Hence, the diameter of the graph can be expressed, simply, as:
2 ⋅ i + j d = 3
(5)
Note: One can obtain the same result by using Euclidean geometry [IrTh99]. However, the proof would be rather lengthy.
4.3 Local Planarity The Ti,j graph is locally planar in the context that given the number of vertices ρi,j of the graph, then the formula
ρ i, j 3 ρ i, j −1 d0 = ⋅ −1 = 3 2 2 defines the diameter of the largest induced subgraph of Ti,j which is planar [IrTh99]. This subgraph defines a planar hexagonal tile inscribed in the bigger hexagonal (toroidal) tile representing the Ti,j graph.
0
A
P F j=1 E
B C
D
i=3
0
0 Figure 12 The computation of the diameter
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
393
The local planarity property allows us to represent the graph as a hexagon on the infinite triangular lattice, and showing the toroidal embedding along the pasting edges as duplicate nodes around the tile, just as we show the traditional rectangular torus as a rectangular tile embedded in the plane. As we shall see in the following section, the Ti,j graph has the maximum number of vertices for a 6regular graph. This is valid for any 6regular graph that is embeddable on a surface of genus 1, i.e. the surface of a torus. This fact proved to be helpful in modeling and simulating cellular networks, since we could keep the model finite while preserving its regularity and avoiding undesired and artificial boundary effects. Being able to represent the graph in the plane in this fashion, helped us identify its topological properties, the most important being the fact that Ti,j is toroidal.
5 Applications 5.1 The Optimal Ti,j If j = i  1 , according to (5) the diameter of the T
i, j
graph becomes
d = i − 1 . The number of vertices is equal to:
ρ
i, j
= 3 ( i − 1 )2 + 3 ( i − 1 ) + 1 = 3 ⋅ d 2 + 3 ⋅ d + 1 .
We can show by induction that this value represents the maximum number of nodes situated at distance d on the infinite triangular lattice, from any given point, as follows: Assume the starting point 0. We expand from 0 by determining the number of nodes at distance 1, 2, … from it. Let’s denote by N(d) the total number of nodes situated at distance less than or equal to d. Hence:
N (0) = 1 N (1) = 1 + 6 = 7 N (2) = 1 + 6 + 12 = 19 ... N (d) = 1 + 6 + 12 + ... + 6d d
= 1 + 6∑i = 1 + 6 i =1
d(d + 1) = 3d 2 + 3d + 1 2
Assuming N(d), we need to prove that
N (d + 1) = 3(d + 1)2 + 3(d + 1) + 1 . At distance d we are adding 6(d+1) vertices. Then,
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
394
N (d + 1) = N (d ) + 6(d + 1) = 3d 2 + 3d + 1 + 6d + 6 = 3d 2 + 6d + 3 + 3d + 3 + 1
.
= 3(d + 1)2 + 3(d + 1) + 1 This number is maximal because at any step at distance d while expanding from the origin point we cannot add more than 6d nodes, since the number of all vertices situated at distance exactly d from the point 0 is equal to 6d. In the context of the maximum number of nodes, given a diameter d, the graph Ti,i1 is considered to be optimal. This property is very important especially in the design of interconnection networks where it is desirable to reduce the topological communication latency. Due to the relatively high degree of the graph and its Hamiltonian decomposition mentioned earlier, the Ti,j topology offers maximum connectivity and maximum fault tolerance, achieving 6 edgedisjoint paths between any two nodes/processors in the network. Figure 13 shows the smallest optimal Ti,j, the graph T2,1 which has 7 nodes and which, since it is regular of degree 6, it is the clique on 7 vertices, K7. 2 3 1
3
1
0 2
1
2
3
2 3
1
Figure 13 Graph K7 as the toroidal The duplicate nodes are T2,1. represented with light color
5.2 Applications to Interconnection Networks There is no exact way to compare different topologies of interconnection networks [Sieg96], [Bhuy97], [Mold93]. Still, there are some metrics for interconnection networks and these are useful to take into account when designing new topologies. These features are described below. N et w or k c on n ect i v it y : Network connectivity measures the resiliency of a network and is the ability to continue operation despite disabled components. In other words, the connectivity represents the minimum
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
395
number of nodes or links that must fail in order to partition the network into two or more disjoint networks (that is, to disconnect the network graph). N et w or k D i a m et er : Similar to the diameter definition of a graph, here the network diameter represents the minimum internode distance. It can be interpreted as the maximum number of links that must be traversed when sending a message to any node along the shortest path. B is ect i on W i dt h : Sometimes it is useful to measure the congestion of a network, that is the traffic along the links of the network). It is most useful when designing loadbalancing algorithms. The bisection width, or narrowness, of a network can be calculated by partitioning the network into two subnetworks S1 and S2, each with N1 and N2 processors (with N1≤N2), and determining the ratio between N1 and the number of links between S2 and S1. In fact, this is a min.cut max.flow type of problem found in network flow theory [FoFu62]. N et w or k E x p an s i o n I n c r e m e n t s : Another goal that is very important when designing an interconnection network is scalability. It should be possible and easy to scale the network at any time at a userrequired size (flexibly), i.e., to add new processors and new links with minimum effort and cost. Also, for cost reasons, it is desirable that the increments are small. This implies the possibility of upgrading the network to the desired size with a given budget. However, these are only a few characteristics to look at and they are mostly static features of a network but with direct implications in the dynamic behavior of the network. The wraparound (4regular) mesh is the most common topologies used in this field, probably because the human mind finds it easy to imagine topologies in a Cartesian coordinate system. Although is expands to higher dimensions, complicating the visualization of the network, the hypercube is another common and wellknown topology. Our extensive research in this area showed that only one research group at the University of Michigan, Ann Arbor, designed and implemented a 6regular interconnection topology [Chen90]. However, the underlying graph (which is the same as the optimal Ti,j, that is j=i−1) has been employed on a rather empirical basis, without and theoretical justification. Moreover, it has not been shown nor mentioned that the topology is actually a torus, or that a more generalized topology exists, featuring the same properties derived from its symmetric structure. The optimal Ti,j is useful in the area of interconnection networks not only for its maximum connectivity and maximum fault tolerance, but also for the natural way of labeling the processors (vertices), scheme presented previously. As a direct result, this topology allows a constant time addressing (routing) scheme and a linear time algorithm, in terms of the diameter, for onetomany broadcasting [Chen90]. This section intends to point out that a generalized topology is also possible, a topology which may be useful especially when expanding the network to larger diameters. The optimal case allows only increments of 6d when updating from diameter d1 to d, whereas the generalized Ti,j allows variable increments, as shown in Table 1. However, the presented topology
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
396
has a smaller network expansion increment than many of the wellknown topologies. According to the values of the diameter for various i and j, as shown in Table 1., in order to expand the topology of the network to a different diameter, one could both add or remove nodes in the network. For example, the network model T7,4 has 93 vertices and a diameter of 5. If we reconfigure the topology to T9,1, we obtain a network with a higher diameter, 6, but less nodes, 91. Notice also that for the same number of vertices, one could build two different topologies with different diameters, as shown in the above table for T6,5 and T9,1. In any case, we generate a very rich family of graphs on distinct number of vertices, all with remarkable properties, both topologically and algebraically.
Table 1 Some values of i
ρ
i, j
(diameter) for Ti,j for various i and j.
2
3
4
5
6
7
8
9
10
7(1)
13(2)
21(3)
31(3)
43(4)
57(5)
73(5)
91(6)
111(7)
19(2)

39(3)

67(5)

103(6)

37(3)
49(4)

79(5)
97(6)

139(7)
61(4)

93(5)

133(7)

91(5)
109(6)
129(6)
151(7)

127(6)


169(7)
193(8)
219(8)
217(8)

j
1 2 3 4 5 6 7 8 9
271(9)
A related issue here is the average distance, which for the maximal case, Ti,i1 is equal to (2i−1)/3. Moreover, since the graph Ti,j is 6connected, the topology possesses a high degree of fault tolerance in terms of connectivity. This implies that the triangulated toroidal network model, as opposed to most of the other existing topologies, can tolerate up to five node and link failures at a time. Table 2 shows the results for a comparative study among different interconnection topologies, including the regular triangulated toroidal graph (RTT). The optimal mesh refers to a 4regular triangulated toroidal graph with a maximal number of nodes for a given diameter and which has been introduced in [IrTh99]. As it can be inferred from Table 2, the RTT is more scalable than the hypercube and, moreover, for a network embedded on a surface of genus 1 (torus), the RTT (i.e., Ti,i1) has the maximum number of nodes possible for a given diameter and constant node degree 6. There exist
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
397
degree 6 network topologies with the same diameter and more nodes but which are not embeddable on a torus surface.
Table 2 Comparison among various multiprocessor architectures.
Parameter
V (nodes)
E (links)
Diameter
Degree
Connectivity
p
p(p1)/2
1
p1
p
p=2n
n2n1
n
n
n
Cycle Cn
p
p
[p/2]
2
2
Chordal Ring
p
3p/2
O(p1/2)
3
3
N1xN2 Mesh
p=N1xN2
2p
O(p1/2)
4
4
Optimal Mesh
p=2n2+2n
2p
n= O((p/2)1/2)
4
5
RTT. Ti,i1
p=3n2+3n +1
3p
n= O((p/3)1/2)
6
6
Topology Clique Kn Hypercube Qn
The topology of the generalized T i , j graph becomes very complex for analysis purposes, when i and j are arbitrary numbers with GCD(i,j)=1. This constituted and impediment in finding an efficient routing algorithm for this case. However, based on the translation isomorphism property and the symmetry along the x, y, and z axes, the following formula holds for any given node address (label) a.
a = x ⋅ 1 + y ⋅ k + z ⋅ (k − 1) (6) where x, y and z are the number of hops from the origin to the node labeled a along the three directions. Formula (6) actually determines the minimum number of routing hops between any two nodes (without enumerating the nodes in the route), based on the assumption of vertextransitivity. That is, given two nodes s and d, the minimum number of hops between the two nodes (the shortest path) can be determined by solving the following integer problem: minimize
x+y+z
such that
x+yk+z(k−1)=d−s
−d0 ≤ x,y,z ≤ d0 where d0 is the diameter of the maximal Ti’,i’1 inscribed in Ti,j and k is the parameter k computed earlier.
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
398
Given the properties shown earlier in this paper, the graph topology described here is also a Cayley graph based on the cyclic group
< 1, k , k 2 ,−1,−k ,−k 2 > , with k being the same parameter as above. Cayley graphs are frequently used in modeling and analysis of interconnection networks, due to certain symmetries that the Cayley graph representation manages to emphasize [DiMo96, GrMa64].
5.3 Applications to Cellular Networks Channel assignment for wireless mobile units is classically modeled by assuming the coverage regions of transceivers (T) partition the plane into disjoint hexagons [Hale80], [Katz96], [MacD79], [Poll96]. The overlap regions, as shown in Figure 14, incidental to the coverage regions being more like circles than hexagons are excluded from the fundamental hexagonal lattice. Overlap regions are separately identified with reference to methods of handoff, but the size and variation in overlap regions is not easily investigated in this traditional model [Poll96]. Our research included the extensive modeling of various forms of overlap segments and their regularities in a cellular arrangement. A new approach to the channel assignment problem in the presence of extensive overlap between coverage regions was obtained by graph theoretic modeling of the cellular assignment [YaMa97], [Yang91], [MaIr98], [MaIr99] [Irid98]. The strong overlap arrangement of Figure 15b, as opposed to the weak overlap in Figure 15a, suggests a good approximation is simply to have the full triangles of the planar dual triangular lattice serve as the overlap 3segments, with no other cell segments admitted. The dual triangular lattice, whose vertices are now the transceivers, is shown in Figure 14.
Ti4 Ti1
Ti6 Ti3 Ti7
Ti2
Ti5
A cluster of k contiguous cells of the hexagonal lattice, where each cell has a distinct one of the k fixed subsets of the available frequency channels, is
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002) Ti1
T’i2
1 Ti2
4
4
1 3 2
T’i3
1 2 2
Ti1
2
399
3
2
Ti3
2 1 2
2 2 1
4
Ti2
1 Ti3
(a)
T’i1
(b)
termed a fr e q ue n c y r e p e at t il e. A covering of the plane by this frequency repeat tile is termed a fr eq u en c y r e p e at t il in g o f t h e p la n e . Frequency repeat patterns typically involve a relatively small number of cells, with k=7 often employed for examples in the literature. We shall in general be interested in m  ce ll repeat sample regions for larger values of m that may or may not be related to multiples of the frequency repeat. Here we focus on the m  c e ll sample region repeats that can be identified with simple polygonal shapes such as a rectangle, rhombus, or hexagon. The 7cell repeat can be associated with a hexagon providing one important example, but many larger repeats will also be of interest. For mcell repeats associated with a rectangle, rhombus, or a hexagon, as shown in Section 2, it follows that the infinite triangular lattice can be homomorphically mapped onto an mvertex toroidal graph, such that the vertex, edge and face associations with hexagonal cells and overlap regions are preserved. When m is an appropriate multiple of k, the frequency channel set associations are also preserved. For homomorphisms corresponding to kcell frequency repeats, the relatively small toroidal graph provides a sufficient model for investigating and displaying properties of the frequency channel distribution. The larger (mvertex) toroidal graphs, derived from a sample region repeat, provide reasonable sized underlying structures for probabilistic mobile unit channel assignment studies. Theoretically and/or by simulation, channel assignment strategies, blocked regions, call cutoffs, and other probabilistic occurrences at load levels near full capacity, can be realistically studied in the mvertex toroidal graph model without anomalies due to boundary effects. Loading patterns over multiple cell regions will be quite realistic for estimation of the infinite lattice cellular network, provided the multiple cell regions constitute planar subgraphs of the toroidal graph.
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
400
To simulate this cellular system without boundary effects, we take the repeat tile and embed it on a torus [CaIr99]. The toroidal model is a natural and pertinent way of simulating and analyzing the behavior of the infinite cellular network using a finite model. If the repeat tile is a hexagon, constructed as described previously, the toroidal model obtained is the Ti,j graph. The Voronoi diagrams technique identifies a cluster of vertices that are closer to a repeat origin point than to any other origin point. The hexagonal repeat pattern can be easily employed in a multitier system where we can identify two repeat levels: 1.
a frequency repeat, relatively small (the m i c r o  c el l);
2.
a toroidal repeat (the m a c r o c el l).
Different rhombic numbers, as shown in Figure 16, characterize the microcell and the macrocell. The toroidal embedding of the macrocell will take care of the undesired boundary effect. The shifting parameters for the macrocell, as shown in Figure 16, are (7,7) and for the microcell, they are (2,1). We can also identify the shifting parameters (4,1) for the macrocell in terms of microcell units. It can be easily verified that 42+4⋅1+12 = 21, which is the total number of microcells contained in the macrocell. The total number of transceivers covered by the macrocell is equal to: 21x7=72 + 7⋅7+72= 147.
Observation: Any region of triangles, inside a macrocell, of radius smaller than the macrocell radius is planar. This follows from the sizes of the diameters of the two types of cells.
Figure 16 A toroidal embedding hexagonal repeat macrocell (T7,7), containing 21 microcells of 7frequency hexagonal repeats (T2,1)
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
401
Hence, we can locally study a region within the macrocell that is reasonably unrelated to the toroidal embedding. Moreover, we can take any contiguous region with the abovespecified radius constraint from the toroidal macrocell, without worrying about being too close to the “boundary” and thus introducing unrealistic behavior. All the contained microcells are similar and their behavior will not be influenced by their position within the macrocell.
6 Conclusions In this paper we introduced a 6regular toroidal graph, constructed from a hexagonal tiling of the infinite triangular lattice. The graph, denoted by Ti,j, where i, and j are the shifting parameters of the rhombic number ρi,j, represents a homomorphism of the triangular lattice and has a very symmetric structure. Some of its properties, such as vertex and edgetransitivity, rotation homomorphism, Hamiltonian cycle decomposition, and coloring, have been presented and discussed. When the shifting parameter j is equal to i1, the graph is optimal, in the sense that it features the largest packing of vertices for a 6regular graph, embeddable on a surface of genus 1 (locally planar), for a given diameter. The computation of the diameter of the graph involves computational geometry tools and is also presented in this paper. Due to its highly symmetric topology, the Ti,j graph family, and especially the optimal case, Ti,i1, has a series of applications in modeling and analysis of networks. In this paper we presented two of its applications, more specific, in interconnection and cellular networks. In interconnection networks, where one of the demands is to design topologies that feature high connectivity and fault tolerance, the optimal Ti,i1 represents a very attractive topology, which is also characterized by a constant time routing scheme, due to the natural labeling scheme presented here. In cellular networks, the graph is used to model and simulate without boundary artifacts, cellular assignment in systems with extensive overlap of transceiver coverage regions. The Ti,j graph is employed in the modeling of micro and macrocell systems and it offers a systematic labeling scheme useful for frequency planning.
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
402
References [Arna80]
J.F. Arnaud, Frequency Planning in Europe, IEEE Proc., Vol. 68, No. 12, Dec 1980
[Aker89]
B. Akers, B. Krishnamurthy, A Group Theoretic Model for Symmetric Interconnection Networks, IEEE Transactions on Computers, Vol. 38, No. 4, pp. 555566, 1989
[BaeB97]
M. M. Bae, B. Bose, Resource Placement in TorusBased Networks, IEEE Transactions on Computers, Vol. 46, No. 10, Oct. 1997
[Bhuy97]
L. N. Bhuyan, X. Zhang, Tutorial on Multiprocessor Performance Measurement and Evaluation, IEEE CS Press, 1997
[Boll79]
B. Bollobas, Graph Theory: An Introductory Course, N. Y. SpringerVerlag, 1979
[BoEr76]
B. Bollobas, P. Erdos, Alternating Hamiltonian Cycles, Israel J. Math., 23(1976)
[Broo41]
R. L. Brooks, On colouring the nodes of a network, Proceedings Cambridge Phil. Soc. 37, pp. 194197, 1941
[CaIr99]
H. C. Cankaya, M. Iridon, D. W. Matula, Performance Analysis of a Graph Model for Channel Assignment in a Cellular Network, COMPSAC 1999
[Chen90]
M. S. Chen, K. G. Shin, Addressing, Routing, and Broadcasting in Hexagonal Mesh Multiprocessors, IEEE Transactions on Computers, Vol. 39, No. 1, Jan. 1990
[Chva85]
V. Chvatal, Hamiltonian Cycles, John Wiley & Sons Ltd., 1985
[ChEr72]
V. Chvatal, P. Erdos, A note on Hamiltonian circuits, Discrete Math, 2(1972)
[DiMo96]
J. Dixon, B. Mortimer, Permutation Groups, New York, Springer Verlag, 1996
[FoFu62]
L. R. Ford, Jr., D. R. Fulkerson, Flows in Networks, Princeton Univ. Press, 1962
[Fort92]
S. Fortune, Voronoi Diagrams and Delauny Triangulations, edited by D.Z. Du and F. Hwang, Computing in Euclidean Geometry, Vol. 1, pp 193234, World Scientific, 1992
[GrMa64]
I. Grossman, W. Magnus, Groups and Their Graphs, New York Random House, 1964
[Hale80]
J. Hale, Frequency Assignment, IEEE Proc., vol. 68, no. 12, Dec. 1980
[Hara72]
F. Harary  Graph Theory, AddisonWesley, 1972
[HaWr79]
G. H. Hardy, E. M. Wright, An Introduction to the Theory of Numbers, Clarendon Press, Oxford, 1979
403
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002) [Heyd97a]
M.C. Heydemann, N. Marlin, S. Perennes, Cayley Graphs with Complete Rotations, Research Report: INRIA 3624, 1997
[Heyd97b]
M.C. Heydemann, Cayley Graphs and Interconnection Networks, Proceedings Graph Symmetry, Montreal, 1996, NATO ASI C, 1997
[Irid98]
M. Iridon, D. W. Matula, Symmetric Cellular Network Embeddings on a Torus, IEEE Proc. ICCCN, 1998, pp. 732736
[IrTh99]
M. Iridon, Regular Triangulated Toroidal Graphs with Applications in Cellular and Interconnection Networks, Ph.D. Thesis, Southern Methodist University, May 1999
[Katz96]
I. Katzela, M. Nagshineh, Channel Assignment Schemes for Cellular Mobile Telecommunication Systems: A Comprehensive Survey, IEEE Personal Communications, June 1996
[KoMa85]
P. Kornerup, D. W. Matula, Finite Precision Lexicographic Continued Fraction Number Systems, IEEE Proc. 7th Symposium on Computer Arithmetic, June 1985
[MacD79]
V.H. MacDonald, The Cellular Concept, The BELL System Technical Journal, Jan 1979, Vol. 58, No. 1, p.1541
[MaIr98]
D. W. Matula, M. Iridon, C. Yang, H. C. Cankaya, A Graph Theoretic Approach for Channel Assignment in Cellular Networks, 2nd International Workshop on Discrete Algorithms and Methods for Mobile Computing and Communications, Dallas, Oct. 1998. In conjunction with ACM/IEEE Mobicom’98
[MaIr99]
D. W. Matula, M. Iridon, C. Yang, A Graph Theoretic Approach for Channel Assignment in Cellular Networks, Wireless Networks Journal, Vol. 7, 2001, pp. 567574
[MaKo80]
D. W. Matula, P. Kornerup, Formulations of Finite Precision Rational Arithmetic, Springer Verlag, 1980
[Mold93]
I.D. Moldovan, Parallel Processing  From Applications, Morgan Kaufmann Publishers, 1993
[Poll96]
G. P. Pollini, Trends in Handover Communications Magazine, March 1996
[Sieg96]
H. J. Siegel, C. B. Stunkel; Inside Parallel Computers: Trends in Interconnection Networks, IEEE CS&E, Vol. 3, No 3, Fall 1996, pp. 6971
[SiKa94]
J. F. Sibeyn, M. Kaufmann, Deterministic lk Routing on Meshes, STACS 1994, pp. 237248
[Thom80]
C. Thomassen, Hamiltonianconnected Tournaments, Journal of Combinatorial Theory, B 28(1980).
[Till80]
T. W. Tillson, Hamiltonian Decomposition of K 2*m ,2m ≥ 8 , Journal of Combinatorial Theory, Ser. B, 29(1980).
Systems
Design,
to
IEEE
Iridon and Matula, A Torus Graph Family. JGAA 6(4) 373404 (2002)
404
[West96]
D. B. West, Introduction to Graph Theory, Prentice Hall, 1996
[YaMa97]
C. Yang, D. W. Matula, A Multilayered Arrangement for Load Sharing in a Cellular Communication System, U.S. Patent #5,633,915, May 1997.
[Yang90]
C. Yang, A MultiLayer Design and Load Sharing Algorithm for Personal Communication Networks, Ph.D. Thesis, Aug. 1991