Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

Book embeddings and book drawings are a fundamental and well-studied topic in graph theory and graph drawing. Combinatorially, a k -page book drawing of a graph \(G = (V, E)\) consists of a cyclic linear ordering of its vertices along a spine and an assignment of each edge to one of the k pages, which are half-planes bounded by the spine. The spine and the k pages form a book (Fig. 1). Clearly, two edges \(\{u, v \}\) and \(\{w, z\}\) in a book drawing cross if and only if they are assigned to the same page and the four vertices alternate on the spine.

Fig. 1.
figure 1

3-page book drawing of \(K_5\) with two crossings.

A book drawing is called a book embedding if it is crossing-free. The book thickness (or pagenumber) of a graph G is the smallest k such that G admits a k-page book embedding [5]. Deciding whether a graph can be embedded on k pages is an NP-complete problem even for \(k=2\) [6, 30] and there are many results about lower and upper bounds on the book thickness of specific graph classes. A long-standing open question [13] is to determine whether the book thickness of planar graphs is three or four. Yannakakis [41] showed that any planar graph can be embedded on four pages and there are planar graphs that cannot be embedded on two pages. Likewise, the book thickness of k-planar graphs is open. Alam et al. [1] showed that there are 1-planar graphs that need four pages and that 16 is an upper bound.

If the number k of pages is given, a k-page book embedding may not exist. In this case, crossing minimization becomes the primary optimization goal. It reduces to two basic and interdependent combinatorial problems: the vertex ordering (VO) along the spine and the page assignment (PA) for the edges.

Again, computing the k-page book crossing number, i.e., the minimum number of crossings over all k-page book drawings of a graph, is an NP-hard problem [30, 35] and fixed-parameter tractable algorithms for 1- and 2-page crossing minimization are known [2]. Book drawings are motivated by several applications, e.g., network visualization [4, 16,17,18, 39], VLSI design [40], RNA folding [11], and knot theory [14]. Various heuristic algorithms have been proposed in the literature. In addition, crossing minimization in book drawings has been the challenge problem of the Graph Drawing Contests in 2015 and 2016. Yet there are no broader comparative studies of these algorithms and no established set of challenging benchmark graph classes. In this paper, we introduce a comprehensive benchmark set for book drawing algorithms and provide the first extensive experimental study of the performance of state-of-the-art book drawing algorithms for multiple numbers of pages.

There are several heuristics for 2-page crossing minimization [8,9,10] with a fixed linear vertex ordering, as well as algorithms for the general 2-page crossing minimization problem [21, 22]. Genetic and evolutionary crossing minimization algorithms have been proposed for one page [18], two pages [3, 19, 32], and any number of pages [34]. Further, neural networks have been used for 2-page crossing minimization [20, 38] and for k-page crossing minimization [29].

Experimental evaluations have been performed by Satsangi et al. [34], who, however, excluded previously best performing algorithms by Baur and Brandes [4] and tested algorithms for VO and PA problems only independently from each other, not in combination. He et al. [23] performed an experimental study of several heuristics, but only for the 2-page crossing minimization problem.

Contributions and outline. In this paper, we determine the strengths and weaknesses as well as the relative performance of heuristic algorithms for the book drawing problem by means of a detailed quantitative experimental study. To this end, we present a list of state-of-the-art heuristic algorithms from the literature as well as some newly proposed heuristics in Sect. 2. Section 3 presents a collection of different graph classes together with suitable random graph generators to be used for creating benchmark graphs for our evaluation. Finally, Sect. 4 contains our comparative experimental evaluation. The main focus of our study is the relative performance of the heuristics in terms of crossing minimization depending on the properties of the benchmark instances, such as book thickness, graph size, edge density, and graph structure. Since out implementations are not optimized for a fast performance, we refrained from a detailed running time analysis. Some preliminary indications of the running times can be found in the appendix of the full version of this paper [27]. The code of our benchmark graph generators and of the book drawing algorithms can be found onlineFootnote 1.

2 Algorithms

We distinguished between constructive heuristics that have the common property that they consider each vertex and edge once, and local search heuristics that make several rounds re-considering the same vertices and edges iteratively. We evaluate these algorithms separately, as the latter can be seen as local search heuristics, which also use much more computation time. The constructive heuristics themselves can be characterized as VO heuristics, PA heuristics, and combined heuristics, that construct both VO and PA simultaneously.

2.1 Constructive Heuristics

Four of the heuristics presented in this section have not appeared in the literature earlier, namely treeBFS, conGreedy, conGreedy+, and earDecomp (see [26] for more details). Several additional heuristics are referenced, but not included in our study because they were always outperformed by the other presented heuristics in previous experimentation.

VO Heuristics. A VO heuristic considers vertices in some particular order and places them on the spine based on some criteria. An edge \(\{u,v\}\) where only one of u and v (resp. both) has been placed on the spine is called open (resp. closed).

 

smallest degree DFS (smlDgrDFS):

[18]. DFS-based heuristics set the VO to be the order in which the vertices are visited by a depth-first traversal of the graph. The smlDgrDFS heuristic starts with a smallest degree vertex and chooses a neighbor with smallest degree to proceed.

random DFS (randDFS):

[3]. In contrast to smlDgrDFS, randDFS starts with a random vertex and proceeds with a random neighbor.

tree-based BFS (treeBFS).:

This heuristic generates a breath-first spanning tree of the graph and embeds it crossing-free in a 1-page book yielding the VO. All three search based heuristics have a running time of \(\mathcal {O}(m + n)\).

connectivity based (conCro):

[4]. This heuristics builds the VO step by step. At each step it selects the vertex with the most neighbors already placed and breaks ties in favor of vertices with fewest unplaced neighbors (connectivity \(\rightarrow \) con). It places the vertex on that end of the already computed spine, where it introduces fewer crossings with open edges (crossings \(\rightarrow \) Cro). The intuition behind this heuristic is that the chosen vertex closes most open edges and opens fewest at ties. Its running time is \(\mathcal {O}((m + n)\log n)\).

greedy connectivity based (conGreedy).:

Like conCro it selects the next vertex to place based on connectivity, however, it places it on any position (not just one of the end points) of the current spine where it introduces fewer crossings with closed edges. With \(\mathcal {O}(m^2 n)\) it has the highest running time.

 

Heuristics excluded, due to relatively poor performance, are among others a maximum neighborhood heuristic, a vertex-cover heuristic, a simple BFS heuristic [34], and variations of conCro  [4].

PA Heuristics. The following first three heuristics share a general framework. They first compute an edge order according to some strategy and then place the edges one by one on the page where the increase in crossings is minimal.

 

ceil-floor (ceilFloor):

[24]. In this strategy the edges are ordered non-increasingly by their length in a circular drawing.

length (eLen):

[8, 34]. Here the edges are ordered non-increasingly by the distance of their end vertices on a spine. Thus edge \(\{1,n\}\) is listed first and any edge \(\{i, i+1\}\) last. Like ceilFloor, it has a \(\mathcal {O}(m^2)\) running time.

circular (circ):

[34]. The edges are enumerated in the order they are visited by the paths \(P_1\dots P_{\lceil \frac{n}{2} \rceil }\), where path \(P_i\) starts at vertex i and visits vertices \(i+1, i-1, i+2, \ldots , i + \lceil \frac{n}{2} \rceil \). This heuristic is inspired by the fact that it achieves zero crossings for complete graphs on \(\lceil \frac{n}{2} \rceil \) pages by placing edges of each path on a distinct page. It has a running time of \(\mathcal {O}(n^4)\).

ear decomposition (earDecomp).:

Consider a circular drawing \(\varGamma _C\) of a graph \(G = (V, E)\). The edge intersection graph is defined as \(G_C=(E, \{\{e,e'\} \mid e,e' \in E \wedge e,e' \text { cross in }\varGamma _C\})\). The heuristic earDecomp considers the circular drawing for the given VO, constructs its intersection graph \(G_C\), and an ear decomposition of \(G_C\), and then assigns the vertices of each ear (i.e., the edges of G) alternatingly to different pages. The intuition behind the heuristic is that it tries to put the conflicting edges to different pages. earDecomp can be implemented to run in \(\mathcal {O}(m^2)\) time.

slope (slope):

[22]. Consider the circular drawing with equally distributed vertices for a graph and VO. Then, the more the geometric slopes of two non-incident edges in this drawing differ, the more likely they cross. slope groups the edges based on their slopes and assigns each group to a page. It has a linear running time \(\mathcal {O}(m)\).

 

Again, due to relatively poor performance, we excluded several other greedy variations [8, 21, 34], a dynamic programming and a divide and conquer approach [8].

Combined Heuristics. Almost all existing constructive heuristics compute a VO and a PA independently. He et al. [21] first combined the two problems. They extended smlDgrDFS such that whenever an edge is closed it is assigned to the page where it introduces the smallest number of crossings. We experimented with such extensions for smlDgrDFS and randDFS heuristics and concluded that they performed worse than using them in combination with another PA heuristic [26]. The following heuristic utilizes this idea for conGreedy.

 

combined greedy connectivity based (conGreedy+).:

While constructing the VO like conGreedy, this heuristic considers the PA of already placed edges. More precisely, the best position for a new vertex is the position where this vertex’s incident and now closed edges induce fewest new crossings. The PA is then accordingly extended to these newly closed edges. The heuristic’s overall asymptotic running time is \(\mathcal {O}(m^2 n)\).

 

We note that the immediate page assignment done by conGreedy+ also affects the computed VO. Hence, conGreedy+ can also be used as VO heuristic by discarding the produced PA.

2.2 Local Search Heuristics

Local search heuristics take a given book drawing and try to reduce its number of crossings by performing local changes. Heuristics greedyAlt and greedy+ are newly proposed, while simAnn has been proposed by Cibulka [7], who won the Automated Graph Drawing Challenge in 2015 [25].

 

alternating greedy search (greedyAlt).:

A single vertex round of this heuristic considers vertices in a random order, takes each of them in this order and places it on the position on the spine where it produces the least number of crossings. Here edges stay on the pages they are. A single edge round does the same with the edges: it considers edges in a random order and places them on the page where it produces the least number of crossings. greedyAlt alternates between vertex and edge rounds until it converges to a local minimum.

combined greedy search (greedy+).:

A single round of this heuristic is similar to conGreedy+, but the vertices are considered in a random order. Several rounds are performed until a local minimum is found.

simulated annealing (simAnn):

[7]. This algorithm, depending on a temperature that decreases with each iteration, makes local changes to the book drawing and accepts them if they either improve the drawing, or with a certain probability depending on the temperature and how many crossings the move introduces. The moves in each iteration are (1) m times moving an edge to a random page, (2) \(n \sqrt{n}\) times swapping a random vertex with its neighbor, (3) n times moving a vertex to a random position and greedily improving the assignment of its incident edges, and (4) \(\frac{4}{n}\) times searches, in the fashion of greedy+, for the best position of a vertex. It runs 1000 iterations.

 

The literature contains similar greedy optimization algorithms for the VO [21, 36], another simulated annealing approach [34], evolutionary [24, 33], and neural network algorithms [29, 38]. However, they all were either restricted to only two pages or were outperformed by other heuristics in previous experiments [26].

3 Benchmark Graphs

Our previous experiments have shown that there is no fixed ranking for the performance of the construction heuristics in terms of crossing minimisation [26]. On the contrary, rankings depend on the number of pages, the edge densities of the graphs and their structuredness. We therefore selected nine different benchmark graph classes that vary in terms of density and structuredness and that are challenging for book drawing algorithms. This excludes some previously used graph classes such as trees or complete graphs. With our choices we aim to establish a set of benchmark graphs that will also serve as a basis for future investigations on book drawings.

 

Random. :

We use random graphs (Erdős-Rényi model) with linear density a, i.e., n-vertex graphs with an edges for \(a = 2, \ldots , 10\), and with quadratic density in terms of n, i.e., edge probabilities p.

Topological planar. :

To generate n-vertex triangulated planar graphs, we used a random edge-flip walk of length \(n^3\) in the space of planar triangulations with a random Apollonian network as starting point. Known bounds suggest that \(n^3\) is a suitable and still practical length [31].

Topological 1-planar. :

We generated 1-planar graphs by augmenting the 4-cycles in our planar triangulations with diagonals in a random order. This yielded on average \(93\%\) of the maximal number of edges in a 1-planar graph.

Geometric k-planar. :

For k from zero to four, we generated k-planar graphs as follows. Taking a random set of points in the plane, we sort them lexicographically, and then add an edge from a vertex (processed in sorted order) to an already processed vertex (in reversed order) only if the segment connecting them would not create more than k crossings in the current drawing. This process achieved on average \(85\%\) of the maximal number of edges.

k-tree. :

A k -tree is a recursively defined graph that is formed by starting with a k-clique and adding vertices and connecting them to all vertices of a k-clique of the current graph. We used this process to construct k-trees.

Hypercube. :

We used hypercubes \(Q_d\) of dimension d. They have \(n = 2^d\) vertices and \(m = \frac{1}{2}nd = \frac{1}{2}n \log n\) edges. Their book thickness is \(d -1\) [28].

Cube-connected cycles. :

A cube-connected cycle \(CCC_d\) of dimension d is a hypercube \(Q_d\) with vertices replaced by cycles of length d. They have \(n = d2^d\) vertices and \(m = 1.5n\) edges.

Toroidal mesh. :

A toroidal mesh \(C_i \times C_j\) is the product graph of two cycles of length i and j. It has \(n = ij\) vertices and \(m = 2n\) edges.

3-toroidal mesh. :

A 3-toroidal mesh \(C_i \times C_j \times C_k\) is the product graph of three cycles of length i, j and k. It has \(n = ijk\) vertices and \(m = 3n\) edges.

 

The structuredness of these graph classes varies from very symmetric graphs, such as hypercubes and toroidal meshes (we call them homogeneous) to less homogeneous but still geometrically structured graphs, such as k-trees and k-planar graphs (we call them structured) to finally random, unstructured graphs.

4 Evaluation

In this section, we present the results of our experiments on the performance of the heuristic algorithms presented in Sect. 2 on the different benchmark graph classes introduced in Sect. 3. Our main focus in the evaluation is to analyze the relative performance of the book drawing heuristics, based on the density and structuredness of the graph classes, as well as the specified number of pages.

4.1 Experimental Setup

For each experiment, we used specific graphs, like hypercubes, 200 times or 200 graphs of the same class. For each graph, in the data representation, the order of the vertices and adjacency lists were randomized. The maximal number of pages considered in an experiment was either determined by the book thickness of a graph (if known), or limited to the first number where the best heuristic achieved less than ten crossings, or a 20 pages otherwise.

4.2 Constructive Heuristics

We first evaluate the constructive heuristics of Sect. 2.1 by considering all possible combinations of VO and PA heuristics. In previous experiments we observed that the right combination of them is crucial [26]. We thus refrained from testing them independently as done by Satsangi et al. [34]. By plotting the number of produced crossings for all the heuristic combinations and various graph classes, we observed that the parameters density, number of pages, and structure have a significant impact. To analyze how the performance depends on these three factors we consider each graph class individually, grouping them into homogeneous, structured and random graphs.

Fig. 2.
figure 2

Tile diagram for homogeneous graphs. One tile represents the heuristic or heuristic combination that achieved the best mean of crossings for the specific number of pages (row) and graph (column).

Homogeneous graphs. Figure 2 shows the best heuristics on the hypercubes \(Q_4\) to \(Q_9\) and on different toroidal meshes. For \(Q_4\), having book thickness \(d- 1 = 3\), conGreedy-ceilFloor could almost achieve its book embedding, however as the dimension increases the performance of the heuristics gets worse. The same holds for toroidal meshes and cube-connected cycles, which both have book thickness three [26, 37]. As we can observe by more detailed analysis (see the appendix of the full version of this paper [27]), all heuristics have on average more than a hundred crossings for hypercubes and toroidal meshes on book thickness many pages. For example, as shown in Fig. 3b, the best heuristics have on average more than 250 crossings for \(C_{16} C_{16}\) on three pages. We suspect that the book thickness of 3-toroidal meshes is constant, and most likely below 8. If this holds, the performance of the heuristics is also poor for this graph class. The best performing heuristics (refer to Fig. 2) for hypercubes are conGreedy-ceilFloor and conCro-circ. For 3-toroidal meshes conCro-ceilFloor is also often the winner. For toroidal meshes and cube-connected cycles conGreedy+ performs best.

Figure 3a illustrates the vertical dimension of the tile diagram for \(Q_7\). It shows the performance of heuristics depending on the number of pages. We see that the changes are smooth and that, however, for a high number of pages conGreedy-ceilFloor is substantially better than conCro-circ and the other heuristic. Figure 3b shows the results for all heuristics on \(C_{16} C_{16}\) and three pages. Here conGreedy+ performed best. Overall, we see that the choice of the VO heuristics has higher significance than PA, except if in combination with slope. It is also interesting that treeBFS performs significantly better than the other search based heuristics. Similar results appear for the other homogeneous graphs (see the full version of this paper [27] for figures).

Fig. 3.
figure 3

Number of crossings of the heuristics (a) with respect to conCro-ceilFloor (lower means less) for \(Q_7\) depending on the number of pages, and (b) in absolute values for the toroidal mesh \(C_{16} C_{16}\) and three pages.

Structured graphs. The structured graphs that we investigate are the k-planar graphs and k-trees. Figure 4 presents the best performing heuristics for geometric k-planar graphs and topological planar and 1-planar graphs. We observe that the difference in the structure of these graphs is crucial for the performance of the heuristics. For topological planar graphs conGreedy-ceilFloor dominates, while for geometric k-planar graphs conCro-ceilFloor is ahead in the majority of the cases. The PA heuristic earDecomp performs well for two pages.

Fig. 4.
figure 4

Tile diagram for k-planar graphs, geometric (left) and topological (right).

Figure 5a shows the performance of the heuristics for topological planar graphs plotted as a function of the number of vertices for four pages, the upper bound for the book thickness of planar graphs [41]. The leading heuristic conGreedy-ceilFloor is not close to the optimum of zero, but achieves, for example, for graphs with 250 vertices on average 62 crossings. In contrast to the homogeneous graphs, we see in Fig. 5b, that the two DFS-based heuristics perform better on topological planar graphs, while treeBFS performs worst. Similar observations [27] can be made for k-planar graphs.

Fig. 5.
figure 5

Performance of the heuristics on topological planar graphs.

Fig. 6.
figure 6

Tile diagram for k-trees.

Figure 6 shows the overview of the results for k-trees. The diagram is dominated by conGreedy-circ and conGreedy-ceilFloor. We note that the book thickness of k-trees is at most \(k + 1\) [13, 15] and then observe that conGreedy+ achieves less than ten crossings on average for \(k + 1\) pages. This becomes more apparent in Fig. 7, which shows the performance as a function of the number of pages for 8-trees with 250 vertices. We see that for a small number of pages, where conGreedy-circ dominates, the performance of all heuristics is comparable, while for more pages conGreedy-ceilFloor performs clearly better and finally, on nine pages, conGreedy+ takes significant lead.

Fig. 7.
figure 7

Performance of conGreedy+ relative to conGreedy in combination with PA heuristics, for 8-trees, \(n = 150\) and two to nine pages. A higher value means thus fewer crossings compared to conGreedy+.

Random graphs. The tile diagram in Fig. 8 for random graphs with linear number of edges shows again a clear pattern. Further investigation (see the full version of this paper [27]) shows that the transition between the best heuristics in Fig. 8 shifts smoothly along the number of vertices, pages and density. The heuristic conGreedy+ dominates for small number of pages and not too high density. However, if the number of pages is relatively high, we observe that conGreedy+-ceilFloor and conGreedy-ceilFloor perform best. The differences between PA heuristics becomes more apparent for both higher density and more pages. The performance of slope gets significantly better with higher density, either with conGreedy or randDFS. The search based VO heuristics perform nearly equally, as do the greedy VO heuristics with conGreedy however slightly in the lead.

The good performance of slope seems natural, as with high density, and thus more edges per page, one edge with a slope different from other edges on the same page, is very likely to produce a lot of crossings. The results for random graphs with quadratic density illustrate this even further (see [27]). In fact, de Klerk et al. [12] conjecture that on complete graphs slope finds an optimal solution for any number of pages. They proved this for two and \(\lfloor \frac{n}{2} \rfloor \) pages, with the latter being the book thickness of complete graphs \(K_n\) [5].

Fig. 8.
figure 8

Tile diagram for random graphs with linear density, i.e. roughly an edges.

4.3 Local Search Heuristics

In this section, we evaluate the local search heuristics greedyAlt, greedy+ and simAnn (the core of the algorithm that won the 2015 Graph Drawing Contest), described in Sect. 2.2. Recall that conGreedy+ is a combined constructive heuristic that considers VO and PA simultaneously, and as seen above often outperforms other heuristic combinations. With greedy+, we extended the idea of conGreedy+ to a local search heuristic, which does multiple rounds on all vertices and edges, until a local minimum is found.

Fig. 9.
figure 9

Performance of the local search heuristics on graphs of various classes.

We tested the local search heuristics, similarly to the constructive heuristics, on graphs of different sizes, densities, structure, and with different numbers of pages (see Fig. 9 and Fig. 20 in the full version of this paper [27]). Here our findings are more clear-cut. In all our experiments greedy+ performed best, followed by greedyAlt. The heuristic simAnn had sometimes difficulties to improve the given book drawings, and performed worse than greedyAlt. The good performance of greedy+ comes with a high trade-off in running time compared to greedyAlt. However, our implementation of simAnn was even slowerFootnote 2.

5 Discussion and Conclusions

In our experiment, we investigated the relative performance of the heuristics presented in Sect. 2. We saw that the choice of the best constructive heuristic depends on several factors: density of the graphs, their structural properties and the number of pages. We could also saw that the performance strongly depends on the selected combination of VO and PA heuristics.

We observed that constructive heuristics are mostly unable to achieve optimal results. For graph classes with known book thickness, the constructive heuristics could achieve very low crossing numbers only on k-trees. For homogeneous and structured graphs the results were far from optimal. We also observed that whenever the constructive heuristics performed poorly, the results of local search heuristics were also far from optimal. This fact, however, is not surprising, as even for trees, starting from random configuration, local search heuristics cannot achieve a book embedding [26]. Since most crossing numbers for the considered graph classes are unknown, we could not further investigate the relative performances in these cases.

The constructive heuristics conGreedy and its combined version conGreedy+ performed best most of the times, but at a cost of higher running time. In several cases the VO heuristic conCro performed better than conGreedy, even though the former is just a restricted version of the latter. We observed that the slope heuristic performed well on dense graphs or in the case of a high ratio of the number of edges to the number of pages, which complies with the earlier conjecture about the power of slope to achieve optimal results for complete graphs. We also saw that our new VO heuristic treeBFS and PA heuristic earDecomp perform best or comparably to the other heuristics for homogeneous graphs and few pages. Regarding the local search heuristics, greedy+ performed significantly better than the other local search heuristics on all graph classes, densities and number of pages. The simulated annealing algorithm performed even worse.

Our experiment can be extended into several directions that were beyond the limit of this paper: other theoretically and practically interesting graphs or graph classes, concentration on particular graph classes, more sophisticated implementations of the heuristics that would make it possible to test larger graphs, and finally a more detailed analysis of the results.

With respect to the tested heuristics, closer investigation would be necessary to understand why conCro performs better than conGreedy in several cases. It would also be of interest to see whether the performance of treeBFS on regular graphs could be further improved by derandomizing the way the BFS tree is constructed. Concerning local search heuristics, an interesting open question is whether the optimisation of the VO or the PA is more influential on the overall performance of a heuristics.