Layered Polyline Drawings of Planar Graphs
Abstract
A -layer polyline drawing of a planar graph is a planar drawing of on a set of parallel lines such that each vertex is mapped to a point on and each edge is mapped to a polygonal chain with the endpoints and bends lying on . In the fixed embedding setting, the output drawing maintains the given planar embedding, whereas in the variable embedding setting, the embedding may change. Every -vertex planar graph admits a polyline drawing on layers, which is the best known upper bound for both settings. We improve this bound in the variable embedding setting. We show that every planar graph can be drawn on layers by choosing a proper planar embedding, breaking the long-standing -layer barrier.
Keywords and phrases:
Layered Drawing, Variable Embedding, Polyline Drawing, Cycle Separator2012 ACM Subject Classification:
Mathematics of computing Discrete mathematicsAcknowledgements:
The research is supported in part by the Natural Sciences and Engineering Research Council of Canada (NSERC).Editors:
Vida Dujmović and Fabrizio MontecchianiSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
A polyline drawing of a planar graph maps each vertex of to a distinct point in the Euclidean plane, and each edge of to a polygonal chain such that no two edges cross except possibly at their common endpoints. A straight-line drawing is a special case of polyline drawing where every polygonal chain is a straight line segment. The area of a drawing is the area of the smallest axis-aligned rectangle that encloses . The width and height of are the width and height of , respectively. Since a drawing can be scaled down arbitrarily, to measure the area we often require to be a grid drawing, i.e., a drawing where all the vertices and bends have integer coordinates.
Drawing planar graphs on a small integer grid is an active research area in graph drawing [5, 6, 11, 13, 16, 27, 22, 25]. In this paper we focus on layered polyline drawings that attempt to reduce the height of the drawing while the other dimension could be unbounded. This can be seen as a drawing of a graph on a set of parallel lines or layers. Formally, a -layer polyline drawing of a planar graph is a planar drawing of on a set of parallel lines (i.e., layers) such that each vertex is mapped to a point on and each edge is mapped to a polygonal chain with the endpoints and bends lying on . This drawing model has been studied extensively in the literature [4, 14, 17, 24, 26]. The distances between consecutive layers in a layered drawing can be assumed to be one unit, as any drawing with non-uniform spacing can be modified to satisfy this property without increasing the number of layers [17] (e.g., by adding extra bend points on edges at their intersections with layers and adjusting the gaps between layers). The results on the grid drawing of planar graphs readily imply upper bounds on the number of layers for their layered drawings. We briefly review these results under two drawing models. One is the fixed embedding setting, where the output drawing must respect the input planar embedding (i.e., a fixed combinatorial embedding with a prescribed outer face), and the other is the variable embedding setting, where the embedding in the output drawing can be different from the input embedding.
Fixed Embedding Setting.
Every -vertex planar graph admits a straight-line grid drawing with area [11, 25]. Many algorithms have appeared in the literature that compute straight-line drawings [8, 9] and polyline drawings [6, 29] of planar graphs, where one dimension of the drawing (equivalently, number of layers) is bounded by . To provide an upper bound on area, drawing algorithms are typically presented on maximal planar graphs or planar triangulations, where each face of the given embedding is a cycle of three vertices. Similarly, throughout the paper, we will consider the input to be a planar triangulation. This upper bound on the number of layers is tight, that is, every polyline drawing of an -vertex nested triangles graph requires at least layers [6].
Variable Embedding Setting.
The upper bound of layers implied by the results in the fixed embedding setting [8, 6, 28] applies also to the variable embedding setting. To the best of our knowledge, it is not known whether a better bound can be achieved for arbitrary planar graphs in the variable embedding setting. However, better upper bounds are known in the variable embedding setting for several subclasses of planar graphs (e.g., outerplanar graphs [3], series-parallel graphs [31, 30], planar graphs with small maximum degree or small cycle separator [17], planar 3-trees [21, 20], and nested triangles graphs [18]). The best known lower bound on layers in the variable embedding setting is [18]. The large gap between the upper and lower bounds motivates this paper.
Our Contribution.
We develop an algorithm that can draw arbitrary -vertex planar graphs on layers in the variable embedding setting. The idea is to use a balanced cycle separator of size to decompose the input planar graph into two subgraphs. We draw these subgraphs separately such that they can be merged without adding too many additional layers. The main challenge appears to be computing careful positions of the separator vertices in both drawings such that during the merge step, the vertices can be aligned with small modification. We tackle this by designing a drawing method that allows flexible positioning of separator vertices with necessary visibilities.
Note that the technique of using a separator to decompose a graph into subgraphs and then to merge the drawing of the subgraphs to obtain a drawing has previously been used in the literature [31, 15]. In particular, Durocher and Mondal [15] used a cycle separator of size to draw an -vertex planar graph in layers, where is the maximum degree in the graph. If , the bound becomes layers, but for , it can become larger than layers. When drawing each subgraph in layers, their strategy was to contract the rest of the graph into a single vertex. However, the merge step required rerouting the edges incident to the separator vertices, which added an additional layers. Later, they used an edge separator of size instead of a cycle separator to improve the bound to [17]. However, both these additive terms and can sometimes be large (e.g., consider a wheel graph), and the total layer count may exceed .
2 Preliminaries
A planar graph is called maximal if the addition of any more edges to results in a non-planar graph. Let be a straight-line drawing of a maximal planar graph in . Then every face in corresponds to a triangle in , and hence the graph is also called a planar triangulation. A planar graph is called internally triangulated if every inner face is a cycle of length three. A simple cycle of is called a cycle separator if both the interior and exterior of contain at most vertices. Every planar graph admits a simple cycle separator of size and several studies attempt to improve the constant factor [12, 19, 23]. Throughout the paper we assume that the layers are horizontal and denote the x- and y-coordinates of a vertex by and , respectively.
Canonical Ordering and Schnyder Realizer.
Let be a planar triangulation, and let and be the outer vertices of in counter-clockwise order. Let be an ordering of all vertices of . We denote by , , the subgraph of induced by , and by , the clockwise path on the outer face of that starts at and ends at . The ordering is called a canonical ordering of with respect to the outer edge if for each , , the following two conditions are satisfied [11]:
-
(a)
is -connected and internally triangulated.
-
(b)
If , then is an outer vertex of and the neighbors of in appear consecutively on .
For a vertex , let be the outer path of , where and are the leftmost and rightmost neighbors of , respectively. We call the edges and the -edge and the -edge of , respectively. The other edges incident to in are called the -edges of . For example, in Figure 1(a), the edges are respectively the -edge and -edge of . The -edges of are and . The set of all -edges in corresponds to a tree , which is rooted at and spans all the inner vertices. Figure 1(b) illustrates in thin solid lines. Similarly, the set of -edges in except and corresponds to a tree rooted at , and the set of -edges except and is a tree rooted at . Figure 1(b) depicts the trees and in thick black and thick gray edges, respectively. The trees form the Schnyder realizer [25] of . Each of and corresponds to a canonical ordering of . Let and be the number of leaves in and , respectively.
Lemma 1 (Bonichon et al. [7]).
Let be a minimum Schnyder realizer of an -vertex triangulation. Then , where is the number of cyclic inner faces in the realizer.
Generalization to Internally Triangulated Graphs.
The notions of canonical ordering and Schnyder realizer have been extended to other classes of planar graphs that are not necessarily triangulated [1, 2]. However, to describe our algorithm in this paper, we only need to consider the 2-connected and internally triangulated graphs. Let be a 2-connected and internally triangulated graph with the outer vertices in counter-clockwise order. If , then consider a dummy edge and triangulate the face . We can now order the inner vertices of satisfying properties (a) and (b) of a canonical ordering. We can define the - and -edges in the same way as we defined for canonical ordering. Observe that the set of -edges corresponds to a tree , which is rooted at , but the -edges and -edges may no longer form the trees and . To form the trees and , we assume the edges on the outer path to belong to both these trees, e.g., Figure 1(c). Let be a drawing of . We call a vertex of to have top visibility in if the vertically upward ray starting at does not intersect except at .
We now have the following lemma, which will be used later to describe our drawing algorithm.
Lemma 2.
Let be a 2-connected and internally triangulated graph with the outer vertices in counter-clockwise order. Let be a Schnyder realizer of rooted at , respectively, where is a path in both and . Then admits the following types of layered drawings:
-
(a)
A drawing on layers where the path is drawn on the bottommost layer and have top visibility.
-
(b)
A drawing on layers where the path is drawn on the bottommost layer and have top visibility.
-
(c)
A drawing on layers where the path lies along a vertical line (perpendicular to the layers) and all other vertices and edges lie in the same half-plane of .
Proof.
Here we show that admits a drawing on a grid where the path is drawn on the bottommost layer and has top visibility. This will correspond to the type-(a) drawing of the lemma, whereas the type-(c) drawing can be obtained by rotating the drawing . To obtain the drawing of type-(b), one can construct drawing on a grid symmetrically.
We assume familiarity with the “shift algorithm” to compute grid drawings for planar graphs [11]. We treat the vertex as a leaf of . Let be the vertices listed according to a preorder traversal of , where the children are visited in counter-clockwise order. Then the ordering is another canonical ordering of [10, Lemma 3.5]. Let be the leaves of according to the preorder traversal of , where is the number of leaves in . We assign each leaf of a path called pseudo-segment, as follows. The first pseudo-segment assigned to is the unique path from to . The pseudo-segment assigned to , where , is the shortest path in that starts at and ends at a vertex which is adjacent to some previous pseudo-segment. Figure 2(a)–(b) illustrates such a pseudo-segment decomposition of . Let be the subgraph of induced by the vertices , where . We now show that admits a drawing satisfying the following properties.
- .
-
is a polyline drawing on layers, where is the number of leaves of in and belongs to the pseudo-segment .
- .
-
The y-coordinates of the vertices of a pseudo-segment is , where .
- .
-
The clockwise path on the outer face of is drawn as a strictly x-monotone polygonal chain in , i.e., the vertices on have top visibility.
We first draw the path by placing each , where , at (Figure 2(c)). It is straightforward to verify – for . We now add the remaining vertices in the order they appear in . While inserting a new vertex , where , we consider two cases depending on whether is a leaf or an internal vertex in . Let be the clockwise path on the outer face of . Let be the pseudo-segment that contains .
Case 1.
If is a leaf of , then we shift the vertices and their descendants in one unit to the right, e.g., see the vertex insertions in Figure 2(d)–(f). Then we place at . Note that and have top visibility in and retain this visibility even after the shift. Since is the highest y-coordinate in the current drawing and since , we can draw the edge with a straight line segment without introducing any edge crossing. If belongs to or if , then we can draw with a straight line segment. Otherwise, we use a bend point at .
We now show that satisfies properties –. Here holds as the drawing width increases by one unit due to the insertion of a new leaf and the height of the drawing becomes . The shift operation keeps the resulting drawing planar, does not change the y-coordinates of the vertices, and does not affect the x-monotonicity of the edges [11]. Therefore, the drawing of the - and -edges of ensures that the path is drawn as an x-monotone polygonal chain where the vertices have top visibility. Consequently, the drawing satisfies and .
Case 2.
If is an internal vertex of , then we place at . Let be the first -edge of in clockwise order. Since is strictly -monotone in , the other vertices on the pseudo-segment before lie to the left of the line . Since is a child of in , it cannot belong to and hence its y-coordinate is smaller than . Hence the grid point is empty.
Since , we can draw with a straight line segment (e.g., insertion of in Figure 2(g)). If belongs to or if , then we can draw with a straight line segment. Otherwise, we use a bend point at (Figure 2(g)). We now consider the drawing of the -edges. To draw an -edge , we first check whether . If so, then we can draw the edge with a straight line segment. Otherwise, we create a bend point at . This is possible because appears in a pseudo-segment where , and thus the grid point is empty. Here holds as we do not change the width of the current drawing and the height increases only when we start adding a new pseudo-segment. – hold by the drawing of the - and -edges of ensuring the top visibility for , and by the property of the shift algorithm that it preserves the y-coordinates of the vertices and the x-monotonicity of the edges [11].
3 Drawing Algorithm
We first choose a suitable embedding of , then decompose the graph into two subgraphs and draw them independently, and finally, merge these drawings by considering different cases depending on the structure of their Schnyder realizers.
Embedding Selection.
Let be a planar triangulation with a simple cycle separator of size , as shown in bold in Figure 3(a). Let be a planar embedding of and let be an inner face in such that is an edge of and is an inner vertex in . We then create a new planar embedding by choosing as the outer face (Figure 3(b)). We then add a subdivision vertex on the edge (Figure 3(c)), and triangulate the inner face incident to . Finally, for each pair of vertices in , where , if the edge exists in , then we add a subdivision vertex on and triangulate the graph. Let be the resulting drawing. By () we refer to the subgraph of that lies in the closed interior (exterior) of . By and we refer to the number of vertices of and , respectively. Since we added at most division vertices, .
Draw and Merge.
Let be the trees of a minimum Schnyder realizer of rooted at , respectively. Similarly, let be the trees of a minimum Schnyder realizer of rooted at , respectively. Let be a positive constant to be determined later. We now consider two cases depending on whether the following condition holds: and .
Case 1 ( and ).
In this case we construct a drawing of on layers, as follows. By Lemma 2, admits a drawing on layers with the path of the cycle separator drawn on the bottommost layer (Figure 3(d)–(e)). Let be the bottommost layer and let be the layer above . We consider a horizontal line between these two layers (i.e., the blue line in Figure 3(h)) and add a bend point at each intersection point between and the edges. We insert layers below and move the vertices on these newly inserted layers consecutively below , as shown in Figure 3(h)–(i). We redraw the edges and part of the edges below with straight line segments. Since the ordering of the bend points on corresponds to the ordering of the vertices in the newly inserted layers, the resulting drawing remains planar. Since , the drawing takes at most layers. We draw using Lemma 2 on layers with the path of the cycle separator drawn on the bottommost layer (Figure 3(f)–(g)). We then modify the drawing to bring the vertices on a set of consecutive bottommost layers of the drawing below . To obtain the final drawing of , we bring the drawings of and close together such that they coincide on the path (Figure 3(j)). The top visibility of ensures planarity, i.e., the polylines representing and do not overlap. Since these drawings share a common set of layers, the number of layers is bounded by .
Case 2 ( or ).
Without loss of generality assume that . Then by Lemma 1, we have . In this scenario, we consider two subcases depending on whether or not, and in both cases we construct a drawing of on layers.
Case 2.1 ().
We first draw using Lemma 2 in layers where the path is drawn along a vertical line (perpendicular to the layers) and the drawing lies to the left half-plane of (Figure 4(a)–(b)). We now draw on the right half-plane of taking the drawing of as input, and inserting the remaining vertices of following the method described in the proof of Lemma 2. This inserts new layers within the drawing of . Since , the total number of layers remains bounded by (Figure 4(c)–(d)).
Case 2.2 ().
We draw in the same way as in Case 2.1 on layers. By Lemma 1, either or is at most . By Lemma 2, admits a drawing on layers with the path drawn on the bottommost layer (Figure 4(e)–(f)). We modify the drawing similar to Case 1 by inserting new layers below and moving the vertices below . However, instead of placing these vertices on consecutive layers, we move them to their corresponding layers in the drawing of . Hence the total number of layers after merging the drawings of and is bounded by (Figure 4(g)–(h)).
Upper Bound Computation.
The algorithm produces a drawing on layers. Since and , we have
Hence the number of layers is bounded by layers, which is minimized when . We thus have the following theorem.
Theorem 3.
Every planar graph with vertices admits a planar polyline drawing on layers.
4 Conclusion
In this paper we have shown how to draw an -vertex planar graph using layers. Since only a lower bound is known [18], a natural open problem is to reduce this gap. It would be interesting to investigate whether our strategy can be combined with the techniques in [15, 17] to improve the upper bound further.
We did not analyze the number of bends produced in our drawing, which could be another parameter for optimization. The trade-off between the number of layers and the number of bends also requires further investigation.
References
- [1] Luca Castelli Aleardi, Éric Fusy, and Thomas Lewiner. Schnyder woods for higher genus triangulated surfaces, with applications to encoding. Discrete & Computational Geometry, 42(3):489–516, 2009. doi:10.1007/s00454-009-9169-z.
- [2] Olivier Bernardi and Éric Fusy. Schnyder decompositions for regular plane graphs and application to drawing. Algorithmica, 62(3-4):1159–1197, 2012. doi:10.1007/s00453-011-9514-5.
- [3] Therese C. Biedl. Small drawings of outerplanar graphs, series-parallel graphs, and other planar graphs. Discrete & Computational Geometry, 45(1):141–160, 2011. doi:10.1007/s00454-010-9310-z.
- [4] Therese C. Biedl. Transforming planar graph drawings while maintaining height. CoRR, abs/1308.6693, 2013. doi:10.48550/arXiv.1308.6693.
- [5] Therese C. Biedl. On area-optimal planar graph drawings. In Proceedings of the 41st International Colloquium on Automata, Languages, and Programming (ICALP), volume 8572 of Lecture Notes in Computer Science, pages 198–210. Springer, 2014. doi:10.1007/978-3-662-43948-7_17.
- [6] Nicolas Bonichon, Bertrand Le Saëc, and Mohamed Mosbah. Optimal area algorithm for planar polyline drawings. In Proceedings of the 28th International Workshop on Graph-Theoretic Concepts in Computer Science (WG), volume 2573 of LNCS, pages 35–46. Springer, 2002. doi:10.1007/3-540-36379-3_4.
- [7] Nicolas Bonichon, Bertrand Le Saëc, and Mohamed Mosbah. Wagner’s theorem on realizers. In Proceedings of the 29th International Colloquium on Automata, Languages and Programming (ICALP), volume 2380 of Lecture Notes in Computer Science, pages 1043–1053. Springer, 2002. doi:10.1007/3-540-45465-9_89.
- [8] Franz J. Brandenburg. Drawing planar graphs on area. Electronic Notes in Discrete Mathematics, 31:37–40, 2008. doi:10.1016/j.endm.2008.06.005.
- [9] Marek Chrobak and Shin-Ichi Nakano. Minimum-width grid drawings of plane graphs. Computational Geometry, 11(1):29–54, 1998. doi:10.1016/S0925-7721(98)00016-9.
- [10] Hubert de Fraysseix and Patrice Ossona de Mendez. On topological aspects of orientations. Discrete Mathematics, 229(1-3):57–72, 2001. doi:10.1016/S0012-365X(00)00201-6.
- [11] Hubert de Fraysseix, János Pach, and Richard Pollack. How to draw a planar graph on a grid. Combinatorica, 10(1):41–51, 1990. doi:10.1007/BF02122694.
- [12] Hristo N. Djidjev and Shankar M. Venkatesan. Reduced constants for simple cycle graph separation. Acta Informatica, 34(3):231–243, 1997. doi:10.1007/s002360050082.
- [13] Danny Dolev, Frank Thomson Leighton, and Howard Trickey. Planar embedding of planar graphs. Advances in Computing Research, 2:147–161, 1984. URL: https://hdl.handle.net/1721.1/149047.
- [14] Vida Dujmović, Michael R Fellows, Matthew Kitching, Giuseppe Liotta, Catherine McCartin, Naomi Nishimura, Prabhakar Ragde, Frances Rosamond, Sue Whitesides, and David R Wood. On the parameterized complexity of layered graph drawing. Algorithmica, 52:267–292, 2008. doi:10.1007/s00453-007-9151-1.
- [15] Stephane Durocher and Debajyoti Mondal. Drawing planar graphs with reduced height. In International Symposium on Graph Drawing, pages 392–403. Springer, 2014. doi:10.1007/978-3-662-45803-7_33.
- [16] Stephane Durocher and Debajyoti Mondal. Trade-offs in planar polyline drawings. In Proceedings of the 22nd International Symposium on Graph Drawing (GD), volume 8871 of LNCS, pages 306–318. Springer, 2014. doi:10.1007/978-3-662-45803-7_26.
- [17] Stephane Durocher and Debajyoti Mondal. Drawing planar graphs with reduced height. J. Graph Algorithms Appl., 21(4):433–453, 2017. doi:10.7155/jgaa.00424.
- [18] Fabrizio Frati and Maurizio Patrignani. A note on minimum area straight-line drawings of planar graphs. In Proceedings of the 15th International Symposium on Graph Drawing (GD), volume 4875 of LNCS, pages 339–344. Springer, 2008. doi:10.1007/978-3-540-77537-9_33.
- [19] Hillel Gazit and Gary L Miller. Planar separators and the Euclidean norm. In Proceedings of the International Symposium on Algorithms (SIGAL), volume 450 of LNCS, pages 338–347. Springer, 1990. doi:10.1007/3-540-52921-7_83.
- [20] Md. Iqbal Hossain, Debajyoti Mondal, Md. Saidur Rahman, and Sammi Abida Salma. Universal line-sets for drawing planar 3-trees. In Proceedings of the 6th International Workshop on Algorithms and Computation (WALCOM), volume 7157 of LNCS, pages 136–147. Springer, 2012. doi:10.1007/978-3-642-28076-4_15.
- [21] Md Iqbal Hossain, Debajyoti Mondal, Md Saidur Rahman, and Sammi Abida Salma. Universal line-sets for drawing planar 3-trees. Journal of Graph Algorithms and Applications, 17(2):59–79, 2013. doi:10.7155/jgaa.00285.
- [22] Charles E. Leiserson. Area-efficient graph layouts (for VLSI). In Proceedings of the 21st Annual Symposium on Foundations of Computer Science, pages 270–281. IEEE Computer Society, 1980. doi:10.1109/SFCS.1980.13.
- [23] Gary L. Miller. Finding small simple cycle separators for 2-connected planar graphs. J. Comput. Syst. Sci., 32(3):265–279, 1986. doi:10.1016/0022-0000(86)90030-9.
- [24] Debajyoti Mondal, Muhammad Jawaherul Alam, and Md Saidur Rahman. Minimum-layer drawings of trees. In Proceedings of the 5th International Workshop on Algorithms and Computation, volume 6552 of LNCS, pages 221–232. Springer, 2011. doi:10.1007/978-3-642-19094-0_23.
- [25] Walter Schnyder. Embedding planar graphs on the grid. In Proceedings of the 1st Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), San Francisco, California, USA, pages 138–148. ACM, 1990. URL: http://dl.acm.org/citation.cfm?id=320176.320191.
- [26] Matthew Suderman. Pathwidth and layered drawings of trees. International Journal of Computational Geometry and Applications, 14:203–225, 2004. doi:10.1142/S0218195904001433.
- [27] Roberto Tamassia, editor. Handbook of Graph Drawing and Visualization. CRC Press, 2013.
- [28] Huaming Zhang. Planar polyline drawings via graph transformations. Algorithmica, 57(2):381–397, 2010. doi:10.1007/s00453-008-9215-x.
- [29] Huaming Zhang and Sadish Sadasivam. On planar polyline drawings. In Proceedings of the 15th International Symposium on Graph Drawing (GD), pages 213–218. Springer, 2007. doi:10.1007/978-3-540-77537-9_22.
- [30] Xiao Zhou, Takashi Hikino, and Takao Nishizeki. Small grid drawings of planar graphs with balanced bipartition. In Proceedings of the 4th International Workshop on Algorithms and Computation (WALCOM), volume 5942 of LNCS, pages 47–57. Springer, 2010. doi:10.1007/978-3-642-11440-3_5.
- [31] Xiao Zhou, Takashi Hikino, and Takao Nishizeki. Small grid drawings of planar graphs with balanced partition. Journal of Combinatorial Optimization, 24(2):99–115, 2012. doi:10.1007/s10878-011-9381-7.
