Algorithms and Bounds for Drawing Directed Graphs
Abstract
In this paper we present a new approach to visualize directed graphs and their hierarchies that completely departs from the classical fourphase framework of Sugiyama and computes readable hierarchical visualizations that contain the complete reachability information of a graph. Additionally, our approach has the advantage that only the necessary edges are drawn in the drawing, thus reducing the visual complexity of the resulting drawing. Furthermore, most problems involved in our framework require only polynomial time. Our framework offers a suite of solutions depending upon the requirements, and it consists of only two steps: (a) the cycle removal step (if the graph contains cycles) and (b) the channel decomposition and hierarchical drawing step. Our framework does not introduce any dummy vertices and it keeps the vertices of a channel vertically aligned. The time complexity of the main drawing algorithms of our framework is , where is the number of channels, typically much smaller than (the number of vertices).
Tom Sawyer Software, Inc. Berkeley, CA 94707 U.S.A.^{2}^{2}email: tollis@csd.uoc.gr
1 Introduction
The visualization of directed (often acyclic) graphs is very important for many applications in several areas of research and business. This is the case because such graphs often represent hierarchical relationships between objects in a structure (the graph). In their seminal paper of 1981, Sugiyama, Tagawa, and Toda [20] proposed a fourphase framework for producing hierarchical drawings of directed graphs. This framework is known in the literature as the "Sugiyama" framework, or algorithm. Most problems involved in the optimization of various phases of the Sugiyama framework are NPhard. In this paper we present a new approach to visualize directed graphs and their hierarchies that completely departs from the classical fourphase framework of Sugiyama and computes readable hierarchical visualizations that contain the complete reachability information of a graph. ^{†}^{†}* This author’s research was performed in part while he was visiting the University of Crete. Additionally, our approach has the advantage that only the necessary edges are drawn in the drawing, thus reducing the visual complexity of the resulting drawing. Furthermore, most problems involved in our framework require polynomial time.
Let be a directed graph with vertices and edges. The Sugiyama Framework for producing hierarchical drawings of directed graphs consists of four main phases [20]: (a) Cycle Removal, (b) Layer Assignment, (c) Crossing Reduction, and (d) Horizontal Coordinate Assignment. The reader can find the details of each phase and several proposed algorithms to solve various of their problems and subproblems in Chapter 9 of the Graph Drawing book of [2]. Other books have also devoted significant portions of their Hierarchical Drawing Algorithms chapters to the description of this framework [13, 14].
The Sugiyama framework has also been extensively used in practice, as manifested by the fact that various systems have chosen it to implement hierarchical drawing techniques. Several systems such as AGD [16], da Vinci [5], GraphViz [7], Graphlet [8], dot [6], and others implement this framework in order to hierarchically draw directed graphs. Even commercial software such as the Tom Sawyer Software TS Perspectives [19] and yWorks [22] essentially use this framework in order to offer automatic hierarchical visualizations of directed graphs. More recent information regarding the Sugiyama framework and newer details about various algorithms that solve its problems and subproblems can be found in [14].
Even tough this framework is very popular, it has several limitations: as discussed above, most problems and subproblems that are used to optimize the results of each phase have turned out to be NPhard. Several of the heuristics employed to solve these problems give results that are not bounded by any approximation. Additionally, the required manipulations of the graph often increase substantially the complexity of the graph itself (such as the number of dummy vertices in phase b can be as high as ). The overall time complexity of this framework (depending upon implementation) can be as high as , or even higher if one chooses algorithms that require exponential time. Finally, the main limitation of this framework is the fact that the heuristic solutions and decisions that are made during previous phases (e.g., crossing reduction) will influence severely the results obtained in later phases. Nevertheless, previous decisions cannot be changed in order to obtain better results.
In this paper we propose a new framework that departs completely from the typical Sugiyama framework and its four phases. Our framework is based on the idea of partitioning the vertices of a graph into channels, that we call channel decomposition of . Namely, after we partition the vertices of into channels, we compute a new graph which is closely related to and has the same reachability properties as . The new graph consists of the vertices of , channels edges that connect vertices that are in the same channel, and cross edges that connect vertices that belong to different channels. Our framework draws either (a) graph without the transitive "channel edges" or (b) a condensed form of the transitive closure of . Our idea is to compute a hierarchical drawing of and, since has the same reachability properties as , this drawing contains most edges of and gives us all the reachability information of . The "missing" incident edges of a vertex can be drawn interactively on demand by placing the mouse on top of the vertex and its incident edges will appear at once in red color.
Our framework offers a suite of solutions depending upon the requirements of the user, and it consists of only two steps: (a) the cycle removal step (if the graph contains cycles) and (b) the channel decomposition and hierarchical drawing step. Our framework does not introduce any dummy vertices, keeps the vertices of a channel vertically aligned and it offers answers to reachability queries between vertices by traversing at most one cross edge. Let be the number of channels and be the number of cross edges in . We show that . The number of bends we introduce is at most and the required area is at most . The number of crossings between cross edges and channels can be minimized in time, which is reasonable for small . If is large, we present lineartime heuristics that find a small number of such crossings. The total time complexity of the algorithms of our framework is plus the time required to compute the channel decomposition of , which depends upon the type of channel decomposition required.
Our paper is organized as follows: the next section presents necessary preliminaries including a brief description of the phases of the Sugiyama framework, the time complexity of the phases, and a description of "bad" choices. In Section 3 we present the concept of path decomposition of a DAG and of path graph (i.e., when the channels are required to be paths of ) and we present the new algorithm for hierarchical drawing which is based on any (computed) path decomposition of a DAG. Section 4 presents the concepts of channel decomposition of a DAG and of channel graph (where channels are not paths) and the new algorithm for hierarchical drawing which is based on any (computed) channel decomposition of a DAG. In Section 5 we present the properties of the drawings obtained by our framework, we offer comparisons with the drawings obtained by traditional techniques, and present our conclusions. Due to space limitations, we present the techniques on minimizing the number of crossings between cross edges and channels in the Appendix.
2 Sugiyama Framework
Let be a directed graph with vertices and edges.
A Hierarchical drawing of requires that all edges are drawn in the same direction upward (downward, rightward, or leftward) monotonically. If contains cycles this is clearly not possible, since in a drawing of the graph some edges have to be oriented backwards. The Sugiyama framework contains the Cycle Removal Phase in which a (small) subset of edges is selected and the direction of these edges is reversed. Since it is important to maintain the character of the input graph, the number of the selected edges has to be minimum. This is a well known NPhard problem, called the Feedback Arc Set problem. A well known approximation algorithm, called GreedyCycleRemoval, runs in linear time and produces sets that contain at most edges. If the graph is sparse, the result is further reduced to edges [2].
Since the input graph may contain cycles our framework also needs to remove or absorb them. One approach is to use a cycle removal algorithm (similar to Sugiyama’s first step) but instead of reversing the edges, we propose to remove them, since reversing them could lead to an altered transitivity of the original graph. This is done because the reversed edge will be a transitive edge in the new graph and hence it may affect the drawing. By the way, this is another disadvantage of Sugiyama’s framework. Since the removal and/or reversal of such edges will create a graph that will have a "different character" than the original graph we propose another possibility that will work well if the input graphs do not contain long cycles. It is easy to (a) find the Strongly Connected Components (SCC) of the graph in linear time, (b) cluster and collapse each SCC into a supernode, and then the resulting graph will be acyclic.
Even if both techniques are acceptable, we believe that the second one might be able to better preserve the character of the input graph. On the other hand, this technique would not be useful if most vertices of a graph are included in a very long cycle. From now on, we assume that the given graph is acyclic after using either of the techniques described above.
In the Layer Assignment Phase of the Sugiyama framework the vertices are assigned to a layer and the layering is made proper, see [2, 14, 20]. In other words, long edges that span several layers are broken down into many smaller edges by introducing dummy vertices, so that every edge that starts at a layer terminates at the very next layer. Clearly, in a graph that has a longest path of length and transitive edges, the number of dummy vertices can be as high as . This fact will impact the running time (and space) of the subsequent phases, with heaviest impact on the next phase, Crossing Reduction Phase.
The Crossing Reduction Phase is perhaps the most difficult and most timeconsuming phase. It deals with various difficult problems that have attracted a lot of attention both by mathematicians and computer scientists. It is outside the scope of this paper to describe the various techniques for crossing reduction, however, the reader may see [2, 14] for further details. The most popular technique for crossing reduction is the LayerbyLayer Sweep [2, 14]. This technique solves multiple problems of the well known TwoLayerCrossing Problem by considering the layers in pairs going up (or down). Of course, a solution for a specific two layer crossing problem "fixes" the relative order of the
vertices (real and dummy) for the next two layer crossing problem, and so on. Therefore, "bad" choices may propagate. Please notice that each two layer crossing problem is NPcomplete [4]. The heuristics employed here tend to reduce crossings by various techniques, but notice that the number of crossings may be as high as , where
is the number of edges between the vertices of two adjacent layers.
Finally, in the last phase the exact coordinates of the vertices are computed by quadraticprogramming techniques [2, 14], which require considerable computational resources.
The dummy vertices are replaced by bends. This implies that the number of bends is about equal to the number of dummy vertices (except when the edge segments are completely aligned).
3 Path Constrained Hierarchical Drawing
Let be a DAG. In this paper we define a path decomposition of as a set of vertexdisjoint paths such that is a partition of . A path is called a decomposition path. The vertices in a decomposition path are clearly ordered in the path, and we denote by the fact that is the jth vertex of path . The path decomposition graph, or simply path graph, of associated with path decomposition is a graph such that if and only if and (a) are consecutive in a path of (called path edges) or (b) and belong to different paths (called cross edges). In other words, an edge of is a path edge if it connects two consecutive vertices of the same decomposition path, else it is a cross edge. Notice that the edges belonging to but not to are transitive edges between vertices of the same path of .
A path constrained hierarchical drawing (PCH drawing) of given is a hierarchical drawing of such that two vertices are drawn on the same vertical line (i.e., same coordinate) if and only if they belong to the same decomposition path. In this section we propose an algorithm that computes PCH drawings assigning to each vertex the coordinate of the path it belongs to and for coordinate we will use its rank in a topological sorting. We will prove that this assignment lets us obtain good results in terms of both area and number of bends.
Next we present Algorithm PCHDraw that computes a PCH drawing of such that every edge of bends at most once. We denote by the xcoordinate of Path and by the xcoordinate and the ycoordinate of any vertex . Let be the path of containing . By definition of PCH drawing we have that . Suppose that the vertices of are topologically ordered and let be the position of in a topological order of . PCHDraw associates to every path, and consequently to every vertex of the path, an xcoordinate that is an even number and to every vertex a ycoordinate that corresponds to its topological order, i.e., (Steps 14). The algorithm draws every edge as a straight line if the drawn edge doesn’t intersect a vertex different from and in (Steps 57). Otherwise it draws edge with one bend such that: its xcoordinate is equal to if , or if . The ycoordinate of bend is equal to (Steps 814).
Algorithm PCHDraw(, , )
1. For to do
2.
3. For any
4.
5. For any
6. If the straight line drawing of does not intersect a vertex different from :
7. Draw as a straight line
8. Else:
9. If :
10.
11.Else:
12.
13.
14.Draw with one bend at point
In Figure 1 we show an example of a drawing computed by Algorithm PCHDraw. In (a) we show the drawing of a graph as computed by Tom Sawyer Perspectives (a tool of Tom Sawyer Software) which follows the Sugiyama Framework. In (b) we show the drawing of computed by Algorithm PCHDraw. The path decomposition that we used to compute the drawing is , where: ; ; . Edge is the only one bending. In grey we show edge drawn as straight line, intersecting vertex .
Any drawing computed by Algorithm PCHDraw has several interesting properties. First, the area of is typically less than . By construction, has height and width of . Hence . Given and the topological order of the vertices of , every vertex need O(1) time to be placed. Every edge needs time to be placed, since before drawing it we need to check if its straight line drawing would intersect a vertex different from (Step 6). Since the drawing of must be monotonous, it can intersect at most one edge per path, so we just need to check if in correspondence of every path placed between the path of and in the drawing of intersects some vertex. Hence we have:
Theorem 3.1
Algorithm PCHDraw computes a drawing of a DAG in time. Furthermore, .
Lemma 1
A cross edge does not intersect a vertex different from and in .
Lemma 2
Let and be two cross edges drawn with a bend in . Their bends are placed in the same point if and only if and are in the same decomposition path and .
In the case described by the above lemma, two edges have overlapping segments and . We consider this feature acceptable, or even desirable for two edges that have the same endpoint. This typical merging of edges has been used in the past, see for example [1, 11, 17]. However, in case that this feature is not desirable, we propose two alternative solutions that avoid this overlap. The price to pay is larger area, or less edges drawn:

Larger area option: We can shift horizontally by one unit the position of bend and all the vertices and bends such that and . In this case we have no overlaps, but the area of can be as large as .

Less edges option: We can define the path decomposition graph differently by removing some transitive cross edges from . For every vertex we remove the edge if there exists an edge such that and are in the same decomposition path and precedes in the order of . It is easy to prove that is a subgraph of and that contains only transitive edges of . By definition of , given a decomposition path , for any vertex there exists at most one cross edge such that . According to Lemma 2, there are no bends overlapping. The area of a drawing computed using is . However, we pay for the absence of overlapping bends by the exclusion from the drawing of some transitive cross edges of .
In Figure 2 we show an example of the edge overlap described above in a drawing of . Part (a) shows a simple drawing where two edges, and , overlap. In grey the drawings of as straight lines, please notice that both of them intersect a vertex. In part (b) we shift horizontally the drawing, removing the overlap but, of course, increasing the area. Part (c) shows the drawing of , where edge is removed since has a higher order in their path.
Alternatively we propose to draw every cross edge with a bend. In this case we can avoid Step 6, so we can obtain the drawing in . Of course, we pay the reduced time complexity by having more bends in the drawing.
Notice that graphs and are computed from by simply removing some transitive edges. Hence we have the following:
Theorem 3.2
The path decomposition graphs and have the same reachability properties of .
Theorem 3.2 is rather simple, but it is very important, since it tells us that visualizing a hierarchical drawing of or we do read and understand correctly any reachability relation between the vertices of .
A path decomposition of a DAG with a small number of paths lets us compute a readable PCH drawing of , since the number of decomposition paths influences the area of the drawing and its number of bends. Indeed, since a cross edge can intersect at most one vertex of every decomposition path, the number of decomposition paths influences the number of bends of the drawing. Furthermore, the number of paths clearly influences the time to find the minimum number of crossings between cross edges and paths, as it is described in the Appendix. Several algorithms solve the problem of finding a path decomposition of minimum size [9, 12, 15, 18]. The algorithm of [12] is the fastest one for sparse and medium DAGs. In the next section we introduce a relaxed definition of path, the channel, and a way to obtain hierarchical drawings based on a channel decomposition. Notice that, since paths are constrained versions of channels, we expect the minimum size of a channel decomposition to be lower than or in the worst case equal to the minimum size of a path decomposition. Therefore, we now turn our attention to the concept of a channel decomposition.
4 Channel Constrained Hierarchical Drawing
Let be a DAG. A channel is an ordered set of vertices such that any vertex has a path to each of its successors in . In other words, given any two vertices , precedes in the order of channel if and only if is reachable from in . A channel can be seen as a generalization of a path, since a path is always a channel, but a channel may not be a path. A channel decomposition is a partition of the vertex set of the graph into channels. If vertex belongs to channel we write if is the th vertex of channel . The channel decomposition graph and a channel constrained hierarchical drawing (CCH drawing) of are defined in a similar fashion as we defined the path decomposition graph and the PCH drawing of in the previous section. Notice that, since the channel is a generalization of a path, the concepts of channel decomposition graph and CCH drawing are a generalization of the concepts of path decomposition graph and PCH drawing. We can define Algorithm CCHDraw in a similar fashion as Algorithm PCHdraw, and its pseudocode is similar to the pseudocode of Algorithm PCHdraw. The only difference is that Algorithm CCHDraw takes as input a channel decomposition instead of a path decomposition and that its output is a CCH drawing instead of a PCH drawing. Algorithm CCHDraw is clearly a generalization of Algorithm PCHDraw. Because of space limitations we do not discuss the complete details of Algorithm CCHDraw here.
Now we introduce a "special" transitive closure, called compressed transitive closure, which is based on the concept of channel decomposition. This transitive closure is obtained from an ordinary transitive closure by removing some of its transitive edges. Next, we will define a graph , based on the compressed transitive closure, that will let us obtain more readable drawings.
Compressed Transitive Closure (CTC): Let be a list of vertices associated with a vertex such that: contains at most one vertex of any decomposition channel; a vertex is reached from in if and only if list contains a vertex such that: and are in the same decomposition channel and precedes in the order of that decomposition channel.
The compressed transitive closure (CTC) of is the set of all the lists . In [10] it is shown how to compute the CTC of a graph in time. Next we show how we can store the CTC in space and that it contains the complete reachability information of .
We define the compressed transitive closure graph (CTC graph) such that if and only if is the highest vertex in the order of its channel such that . Notice that an edge of may not exist in the original graph , as is the case in the ordinary transitive closure graph of . Furthermore, an edge of may not be included in , while contains all the edges of . Please notice that has the same reachability properties (i.e., the same transitive closure) as , since it is computed directly from the CTC of . We denote by channel edge an edge of connecting two vertices of the same channel, else it is a cross edge, similar to the definition of the previous section.
Let be a vertex. The list contains by definition the vertex , since it is the lowest vertex in the channel reachable from . Hence we have the following property:
Lemma 3
for any .
Lemma 3 implies that the channel decomposition of is a path decomposition of , so a CCH drawing of is essentially also a PCH drawing and hence we can compute it using Algorithm CCHDraw or Algorithm PCHDraw since in this case the two algorithms produce the same result.
In Figure 3 an example of a CCH drawing of computed by Algorithm CCHDraw using as an input is shown: Part (a) shows the original graph drawn as computed by Tom Sawyer Perspectives that uses the Sugiyama Framework. A channel decomposition of this graph is , where: ; ; ; . In part (b) we show the drawing of as computed by Algorithm CCHDraw. The dotted edges are edges that do not exist in . Some channel edges are dotted, since a channel may not be a path of .
There is one list for every vertex and every list contains elements. Since every element of a list corresponds to (at most) one edge of we have that contains edges. Hence we have the following:
Theorem 4.1
The number of edges of is .
The above theorem implies that the number of edges of is linear if is a constant. Also, it requires only space to be stored. As we did in the previous section, we denote by cross edge an edge of connecting two vertices belonging to two different channels. We denote by mono channel path (mcpath) a path of such that all the edges of it are in the same channel, while we denote by double channel path (dcpath) a path of composed by two mcpaths and a cross edge.
Theorem 4.2
Let and be any pair of vertices such that is reachable from . Then there exists either an mcpath or a dcpath from to in .
Proof
Suppose that and are in the same channel . In this case there exists an mcpath from to as a consequence of Lemma 3. Suppose that and are in two different channels and . If reaches , by definition of , there must be a vertex that is a successor of in and a vertex which is predecessor of in , such that . Let be the mcpath from to and be the mcpath from to . The path is a dcpath from to .
We claim that such a CCH drawing of is a very useful instrument to visualize the reachability properties of . Indeed, if we want to check if a vertex reaches another vertex in (and consequently in ) we just need to check if there exists an mcpath or a dcpath connecting them (Lemma 4.2). Moreover, finding an mcpath or a dcpath in is very easy, since every mcpath is drawn on a vertical line and every dcpath is drawn as two different vertical lines connected by a cross edge. Moreover since has an almostlinear number of edges () by Theorem 4.1 it makes easier to visualize and so it gives us a clear way to visualize the reachability properties of . The price we have to pay is that we do not visualize many edges of the original graph . These edges can be visualized (in red) on demand by moving the mouse over a given query vertex.
A channel decomposition with a small number of channels lets us compute a readable CCH drawing of . The width of a DAG is the maximum cardinality of a subset of of pairwise incomparable vertices of , i.e., there is no path between any two vertices in the subset. In [3] it is proved that the minimum value of the cardinality of , is and in [10] an algorithm is given to compute with in time. The time complexity is improved to in [21]. Clearly, since paths are a restricted type of channels, the minimum size of is less than or equal to the minimum size of .
5 Comparisons and Conclusions
We discussed the results of our algorithms in terms of bends and area. The framework we present in this paper produces results that are far superior to the results produced by the Sugiyama framework with respect to the number of crossings, number of bends, area of the drawing and visual clarity of the existing paths and reachability. Namely, because the hierarchical drawings produced by the Sugiyama framework have (a) many crossings (a bound is not possible to be computed), (b) the total number of bends is large and it depends heavily on the number of dummy vertices introduced, (c) the area is large because the width of the drawing is negatively influenced by the number of dummy vertices, (d) the number of bends per edge is also influenced by the number of dummy vertices on it (although the last phase tries to straighten the edges by aligning its segments, at the expense of the area, of course), (e) most problems and subproblems of each phase are NPhard, and many of the heuristic are very time consuming, and (f) the reachability information in the graph is not easy to detect from the drawing.
Our framework produces hierarchical drawings that are far superior of the ones produced by the Sugiyama framework in all measures discussed above. Namely, our drawings have (a) a minimum number of channel crossings as an upper bound (see the Appendix), (b) the total number of bends is low since we introduce at most one bend for some (not all) cross edges, (c) the area is precisely bounded by a rectangle of height and width , where is typically a small fraction of , (d) the reachability and path information is easily visible in our drawings since any path is deduced by following at most one cross edge (which might have at most one bend), (e) the vertices in each channel are vertically aligned and there is a path from each vertex
in the channel to all the vertices that are at higher coordinates, (f) all our algorithms run in polynomial time (with the exception of the minimization of the number of channel crossings, which requires time), and finally, (g) the flexibility of our framework allows a user to decide to have their specified paths as channels, thus allowing for user paths to be drawn aligned.
The only drawback of the drawings produced by our framework is the fact that it does not draw all the edges of the graph, which might be important for some applications. This might be considered as an advantage by some other users since it offers drawings that are not cluttered by the edges. In any case, we offer the remedy to visualize all the edges incident to a vertex interactively when the mouse is placed on top of a vertex.
We believe that the above comparison is convincing of the power of the new framework. Hence we do not offer experimental results here. However, in the future we plan to contact user studies in order to verify that the users we will benefit from the aforementioned properties by showing higher understanding and ease of use of the new drawing framework. We plan to work on allowing to include user specified channels (or paths), and still find the minimum number of channels in a channel decomposition. It would be interesting to find specific topological orderings and/or sophisticated layer assignment that will reduce the hight, the number of crossings and the number of bends of the computed drawing. Finally, it would be desirable to avoid the exponential in (i.e., ) factor in the time complexity of finding the best order of the channels.
References
 [1] Bannister, M.J., Brown, D.A., Eppstein, D.: Confluent orthogonal drawings of syntax diagrams. In: Di Giacomo, E., Lubiw, A. (eds.) Graph Drawing and Network Visualization  23rd International Symposium, GD 2015, Los Angeles, CA, USA, September 2426, 2015, Revised Selected Papers. pp. 260–271. Lecture Notes in Computer Science (2015). https://doi.org/10.1007/9783319272610_22, https://doi.org/10.1007/9783319272610_22
 [2] Di Battista, G., Eades, P., Tamassia, R., Tollis, I.G.: Graph Drawing: Algorithms for the Visualization of Graphs. PrenticeHall (1999)
 [3] Dilworth, R.P.: R. p. a decomposition theorem for partially ordered sets. ann. math. 52, (1950), 161166.
 [4] Eades, P., Wormald, N.C.: Edge crossings in drawings of bipartite graphs. Algorithmica 11(4), 379–403 (1994). https://doi.org/10.1007/BF01187020, https://doi.org/10.1007/BF01187020
 [5] Fröhlich, M., Werner, M.: Demonstration of the interactive graphvisualization system da Vinci. In: Graph Drawing, DIMACS International Workshop, GD ’94, Princeton, New Jersey, USA, October 1012, 1994, Proceedings. pp. 266–269 (1994). https://doi.org/10.1007/3540589503_379, https://doi.org/10.1007/3540589503_379
 [6] Gansner, E., Koutsofios, E., North, S.: Drawing graphs with dot. Tech. rep. (2006), http://www.graphviz.org/Documentation/dotguide.pdf
 [7] Gansner, E.R., North, S.C.: An open graph visualization system and its applications to software engineering. Softw., Pract. Exper. 30(11), 1203–1233 (2000). https://doi.org/10.1002/1097024X(200009)30:11<1203::AIDSPE338>3.0.CO;2N
 [8] Himsolt, M.: Graphlet: design and implementation of a graph editor. Softw., Pract. Exper. 30(11), 1303–1324 (2000). https://doi.org/10.1002/1097024X(200009)30:11<1303::AIDSPE341>3.0.CO;23
 [9] Hopcroft, J.E., Karp, R.M.: An n algorithm for maximum matchings in bipartite graphs. SIAM J. Comput. 2(4), 225–231 (1973). https://doi.org/10.1137/0202019, https://doi.org/10.1137/0202019
 [10] Jagadish, H.V.: A compression technique to materialize transitive closure. ACM Trans. Database Syst. 15(4), 558–598 (1990). https://doi.org/10.1145/99935.99944, http://doi.acm.org/10.1145/99935.99944
 [11] Kornaropoulos, E.M., Tollis, I.G.: Algorithms and bounds for overloaded orthogonal drawings. Journal of Graph Algorithms and Applications 20(2), 217–246 (2016). https://doi.org/10.7155/jgaa.00391
 [12] Kuosmanen, A., Paavilainen, T., Gagie, T., Chikhi, R., Tomescu, A.I., Mäkinen, V.: Using minimum path cover to boost dynamic programming on dags: Colinear chaining extended. In: Research in Computational Molecular Biology  22nd Annual International Conference, RECOMB 2018, Paris, France, April 2124, 2018, Proceedings. pp. 105–121 (2018). https://doi.org/10.1007/9783319899299_7, https://doi.org/10.1007/9783319899299_7
 [13] Michael Kaufmann, D.W.: Drawing Graphs: Methods and Models. Springer (2001)
 [14] Nikolov, N.S., Healy, P.: Hierarchical Drawing Algorithms, in Handbook of Graph Drawing and Visualization, ed. Roberto Tamassia. CRC Press (2014), pp. 409453
 [15] Orlin, J.B.: Max flows in o(nm) time, or better. In: Symposium on Theory of Computing Conference, STOC’13, Palo Alto, CA, USA, June 14, 2013. pp. 765–774 (2013). https://doi.org/10.1145/2488608.2488705, http://doi.acm.org/10.1145/2488608.2488705
 [16] Paulisch, F.N., Tichy, W.F.: EDGE: an extendible graph editor. Softw., Pract. Exper. 20(S1), S1 (1990)
 [17] Pupyrev, S., Nachmanson, L., Kaufmann, M.: Improving layered graph layouts with edge bundling. In: Brandes, U., Cornelsen, S. (eds.) Graph Drawing  18th International Symposium, GD 2010, Konstanz, Germany, September 2124, 2010. Revised Selected Papers. pp. 329–340. Lecture Notes in Computer Science (2010). https://doi.org/10.1007/9783642184697_30, https://doi.org/10.1007/9783642184697_30
 [18] Schnorr, C.: An algorithm for transitive closure with linear expected time. SIAM J. Comput. 7(2), 127–133 (1978). https://doi.org/10.1137/0207011, https://doi.org/10.1137/0207011
 [19] Software, T.S.: www.tomsawyer.com
 [20] Sugiyama, K., Tagawa, S., Toda, M.: Methods for visual understanding of hierarchical system structures. IEEE Trans. Systems, Man, and Cybernetics 11(2), 109–125 (1981). https://doi.org/10.1109/TSMC.1981.4308636, https://doi.org/10.1109/TSMC.1981.4308636
 [21] Yangjun Chen, Y.C.: On the dag decomposition. British Journal of Mathematics and Computer Science (2014), 10(6): 127, 2015, Article no.BJMCS.19380, ISSN: 22310851
 [22] yWorks: www.yworks.com
Appendix
Proof of Lemma 1
If is drawn as a straight line the lemma is true by the construction of Algorithm PCHDraw. Otherwise, is composed of two segments: and . Both segments are diagonals of the rectangles inside which there is no vertices, so the two segments, and consequently , cannot intersect any vertex different from .
Proof of Lemma 2
since . In this case and are in the same path of the path decomposition. since and since there is no vertex such that .
Minimizing the Number of Crossings
We denote by channel crossing a crossing between a channel (edge) and a cross edge. In this section we discuss how we can reduce the number of channel crossings of a CCH drawing computed by Algorithm CCHDraw, by changing the lefttoright order of the channels. Notice that because of the similarities of CCH and PCH drawings, the techniques we will describe for CCH drawings are applicable to the PCH drawings as well. We will discuss the results with respect to the compressed transitive closure graph , but the same results can be obtained with any decomposition graph .
Let be the xcoordinate of the vertices of a channel in the CCH drawing . Let and be two different channels. Let be the number of channels that lie between and , e.g., . Let be the set of the cross edges connecting any two vertices of and, where . Clearly, every edge of can be involved in at most channel crossings, since this is the number of channels between its beginpoint and its endpoint. Hence, is the maximum number of crossings of the set of edges . Since the set of all possible is a partition of then we have the following:
Lemma 4
is an upper bound on the number of channel crossings of a drawing .
In order to find the optimum order of channels that minimizes the upper bound on channel crossings we use a brute force approach. In other words, we simply count the crossings for each of the permutations.
Algorithm BestOrder will compute the order of the channels of a drawing such that it has a minimum upper bound on the number of crossings, . The algorithm takes and as input and gives as output an ordered channel decomposition with the order described above. The first step is computing the value for every possible couple of channels of . Let be an order of the channels of , where if precedes in . Then the algorithm will try all the possible permutations of the channels and for every permutation computes the values for every pair of channels. Then it computes the value . Finally the algorithm chooses the order of the channels with minimum () and gives as output the ordered channel decomposition where the channels are ordered as in .
Algorithm BestOrder(,)
1.
2. For any cross edge
3. Let and
4.
5.
6.
7. For any possible order of :
8. For any couple of different channels :
9.
10.
11.If :
12.
13.
14. ordered channel decomposition containing the channels of
15.Order the channels of as in
16.output
Algorithm BestOrder tries all possible orders of channel decomposition and chooses the one that implies the minimum . Furthermore, since Step 2 requires time and Steps 7 and 8 require , we have the following:
Theorem .1
BestOrder(, ) is the ordered channel decomposition such that CCHDraw(, ) has minimum among all the channels decomposition having the same channels of . Furthermore, it runs in time.
If is a small number, Algorithm BestOrder is a nice heuristic to reduce the number of channel crossings, since it minimizes the worst case. Suppose on the other hand that is large. Let be a channel and let be the set of cross edges adjacent to it. Suppose that is placed in the center of the drawing. The number of channel edges crossing an edge of is at most , since it can cross all the channels on the left or on the right of , and in both cases the number of such channels is about . In this case the number of channel crossings inolving edges of is at most . On the other hand, if is placed in one of the two borders of the drawing then an edge of can cross all the channels of the drawing, in the case that the other endpoint of that edge is in the channel placed in the other border. In this case the number of channel crossings inolving edges of is at most . As a conclusion we suggest to place the two channels with the least cross edge degree at the border of the drawing. Next, from the remaining channels, we pick the two channels with the least cross edge degree and place them next to the two channels placed recently toward the center, and so on. Consequently the channels with large will be placed in the center of the drawing.