Log In Sign Up

Graph Drawing via Gradient Descent, (GD)^2

by   Reyan Ahmed, et al.

Readability criteria, such as distance or neighborhood preservation, are often used to optimize node-link representations of graphs to enable the comprehension of the underlying data. With few exceptions, graph drawing algorithms typically optimize one such criterion, usually at the expense of others. We propose a layout approach, Graph Drawing via Gradient Descent, (GD)^2, that can handle multiple readability criteria. (GD)^2 can optimize any criterion that can be described by a smooth function. If the criterion cannot be captured by a smooth function, a non-smooth function for the criterion is combined with another smooth function, or auto-differentiation tools are used for the optimization. Our approach is flexible and can be used to optimize several criteria that have already been considered earlier (e.g., obtaining ideal edge lengths, stress, neighborhood preservation) as well as other criteria which have not yet been explicitly optimized in such fashion (e.g., vertex resolution, angular resolution, aspect ratio). We provide quantitative and qualitative evidence of the effectiveness of (GD)^2 with experimental data and a functional prototype: < mwli/graph-drawing/>.


Multicriteria Scalable Graph Drawing via Stochastic Gradient Descent, (SGD)^2

Readability criteria, such as distance or neighborhood preservation, are...

Stress-Plus-X (SPX) Graph Layout

Stress, edge crossings, and crossing angles play an important role in th...

SmartGD: A Self-Challenging Generative Adversarial Network for Graph Drawing

A multitude of studies have been conducted on graph drawing, but many ex...

INKA: An Ink-based Model of Graph Visualization

Common quality metrics of graph drawing have been about the readability ...

FORBID: Fast Overlap Removal By stochastic gradIent Descent for Graph Drawing

While many graph drawing algorithms consider nodes as points, graph visu...

Deep Neural Network for DrawiNg Networks, (DNN)^2

By leveraging recent progress of stochastic gradient descent methods, se...

Soft-Robust Algorithms for Handling Model Misspecification

In reinforcement learning, robust policies for high-stakes decision-maki...

1 Introduction

Graphs represent relationships between entities and visualization of this information is relevant in many domains. Several criteria have been proposed to evaluate the readability of graph drawings, including the number of edge crossings, distance preservation, and neighborhood preservation. Such criteria evaluate different aspects of the drawing and different layout algorithms optimize different criteria. It is challenging to optimize multiple readability criteria at once and there are few approaches that can support this. Examples of approaches that can handle a small number of related criteria include the stress majorization framework of Wang et al. [35], which optimizes distance preservation via stress as well as ideal edge length preservation. The Stress Plus X (SPX) framework of Devkota et al. [13] can minimize the number of crossings, or maximize the minimum angle of edge crossings. While these frameworks can handle a limited set of related criteria, it is not clear how to extend them to arbitrary optimization goals. The reason for this limitation is that these frameworks are dependent on a particular mathematical formulation. For example, the SPX framework was designed for crossing minimization, which can be easily modified to handle crossing angle maximization (by adding a cosine factor to the optimization function). This “trick” can be applied only to a limited set of criteria but not the majority of other criteria that are incompatible with the basic formulation.

Figure 1: Three layouts of the dodecahedron: (a) optimizing the number of crossings, (b) optimizing uniform edge lengths, and (c) optimizing stress.

In this paper, we propose a general approach, Graph Drawing via Gradient Descent, , that can optimize a large set of drawing criteria, provided that the corresponding metrics that evaluate the criteria are smooth functions. If the function is not smooth, either combines it with another smooth function and partially optimizes based on the desired criterion, or uses modern auto-differentiation tools to optimize. As a result, the proposed framework is simple: it only requires a function that captures a desired drawing criterion. To demonstrate the flexibility of the approach, we consider an initial set of nine criteria: minimizing stress, maximizing vertex resolution, obtaining ideal edge lengths, maximizing neighborhood preservation, maximizing crossing angle, optimizing total angular resolution, minimizing aspect ratio, optimizing the Gabriel graph property, and minimizing edge crossings. A functional prototype is available on This is an interactive system that allows vertices to be moved manually. Combinations of criteria can be optimized by selecting a weight for each; see Figure 1.

2 Related Work

Many criteria associated with the readability of graph drawings have been proposed [36]. Most of graph layout algorithms are designed to (explicitly or implicitly) optimize a single criterion. For instance, a classic layout criterion is stress minimization  [25], where stress is defined by . Here, is a matrix containing coordinates for the nodes, is typically the graph-theoretical distance between two nodes and and is a normalization factor with equal to or . Thus reducing the stress in a layout corresponds to computing node positions so that the actual distance between pairs of nodes is proportional to the graph theoretic distance between them. Optimizing stress can be accomplished by stress minimization, or stress majorization, which can speed up the computation [21]. In this paper we only consider drawing in the Euclidean plane, however, stress can be also optimized in other spaces such as the torus [8].

Stress minimization corresponds to optimizing the global structure of the layout, as the stress metric takes into account all pairwise distances in the graph. The t-SNET algorithm of Kruiger et al. [26] directly optimizes neighborhood preservation, which captures the local structure of a graph, as the neighborhood preservation metric only considers distances between pairs of nodes that are close to each other. Optimizing local or global distance preservation can be seen as special cases of the more general dimensionality reduction approaches such as multi-dimensional scaling [33, 27].

Purchase et al. [29] showed that the readability of graphs increases if a layout has fewer edge crossings. The underlying optimization problem is NP-hard and several graph drawing contests have been organized with the objective of minimizing the number of crossings in the graph drawings [2, 7]. Recently several algorithms that directly minimize crossings have been proposed  [32, 30].

The negative impact on graph readability due to edge crossings can be mitigated if crossing pairs of edges have a large crossings angle [3, 24, 23, 14]

. Formally, the crossing angle of a straight-line drawing of a graph is the minimum angle between two crossing edges in the layout, and optimizing this property is also NP-hard. Recent graph drawing contests have been organized with the objective of maximizing the crossings angle in graph drawings and this has led to several heuristics for this problem 

[11, 4].

The algorithms above are very effective at optimizing the specific readability criterion they are designed for, but they cannot be directly used to optimize additional criteria. This is a desirable goal, since optimizing one criterion often leads to poor layouts with respect to one or more other criteria: for example, algorithms that optimize the crossing angle tend to create drawings with high stress and no neighborhood preservation [13].

Davidson and Harel [10] used simulated annealing to optimize different graph readability criteria (keeping nodes away from other nodes and edges, uniform edge lengths, minimizing edge crossings). Recently, several approaches have been proposed to simultaneously improve multiple layout criteria. Wang et al. [35] propose a revised formulation of stress that can be used to specify ideal edge direction in addition to ideal edge lengths in a graph drawing. Devkota et al. [13] also use a stress-based approach to minimize edge crossings and maximize crossing angles. Eades et al. [18] provided a technique to draw large graphs while optimizing different geometric criteria, including the Gabriel graph property. Although the approaches above are designed to optimize multiple criteria, they cannot be naturally extended to handle other optimization goals.

Constraint-based layout algorithms such as COLA 

[16, 17], can be used to enforce separation constraints on pairs of nodes to support properties such as customized node ordering or downward pointing edges. The coordinates of two nodes are related by inequalities in the form of for a node pair . These kinds of constraints are known as hard constraints and are different from the soft constrains in our framework.

3 The Framework


framework is a general optimization approach to generate a layout with any desired set of aesthetic metrics, provided that they can be expressed by a smooth function. The basic principles underlying this framework are simple. The first step is to select a set of layout readability criteria and a loss functions that measures them. Then we define the function to optimize as a linear combination of the loss functions for each individual criterion. Finally, we iterate the gradient descent steps, from which we obtain a slightly better drawing at each iteration. Figure 

2 depicts the framework of : Given any graph and readability criterion , we find a loss function which maps from the current layout (i.e. a matrix containing the positions of nodes in the drawing) to a real value that quantifies the current drawing. Note that some of the readability criteria naturally correspond to functions that should be minimized (e.g., stress, crossings), while others to functions that should be maximized (e.g., neighborhood preservation, angular resolution). Given a loss function of where a lower value is always desirable, at each iteration, a slightly better layout can be found by taking a small () step along the (negative) gradient direction: .

Figure 2: The

framework: Given a graph and a set of criteria (with weights), formulate an objective function based on the selected set of criteria and weights. Then compute the quality (value) of the objective function of the current layout of the graph. Next, generate the gradient (analytically or automatically). Using the gradient information, update the coordinates of the layout. Finally, update the objective function based on the layout via regular or stochastic gradient descent. This process is repeated for a fixed number of iterations.

To optimize multiple quality measures simultaneously, we take a weighted sum of their loss functions and update the layout by the gradient of the sum.

3.1 Gradient Descent Optimization

There are different kinds of gradient descent algorithms. The standard method considers all vertices, computes the gradient of the objective function, and updates vertex coordinates based on the gradient. For some objectives, we need to consider all the vertices in every step. For example, the basic stress formulation [25] falls in this category. On the other hand, there are some problems where the objective can be optimized only using a subset of vertices. For example, consider stress minimization again. If we select a set of vertices randomly and minimize the stress of the induced graph, the stress of the whole graph is also minimized [37]. This type of gradient descent is called stochastic gradient descent. However, not all objective functions are smooth and we cannot compute the gradient of a non-smooth function. In that scenario, we can compute the subgradient, and update the objective based on the subgradient. Hence, as long as the function is continuously defined on a connected component in the domain, we can apply the subgradient descent algorithm. In table 3, we give a list of loss functions we used to optimize 9 graph drawing properties with gradient descent variants. In section 4, we specify the loss functions we used in detail.

When a function is not defined in a connected domain, we can introduce a surrogate loss function to ‘connect the pieces’. For example, when optimizing neighborhood preservation we maximize the Jaccard similarity between graph neighbors and nearest neighbors in graph layout. However, Jaccard similarity is only defined between two binary vectors. To solve this problem we extend Jaccard similarity to all real vectors by its Lovász extension 

[5] and apply that to optimize neighborhood preservation. An essential part of gradient descent based algorithms is to compute the gradient/subgradient of the objective function. In practice, it is always not necessary to write down the gradient analytically as it can be computed automatically via automatic differentiation [22]

. Deep learning packages such as Tensorflow 


and PyTorch 

[28] apply automatic differentiation to compute the gradient of complicated functions.

When optimizing multiple criteria simultaneously, we combine them via a weighted sum. However, choosing a proper weight for each criterion can be tricky. Consider, for example, maximizing crossing angles and minimize stress simultaneously with a fixed pair of weights. At the very early stage, the initial drawing may have many crossings and stress minimization often removes most of the early crossings. As a result, maximizing crossing angles in the early stages can be harmful as it move nodes in directions that contradict those that come from stress minimization. Therefore, a well-tailored weight scheduling is needed for a successful outcome. Continuing with the same example, a better outcome can be achieved by first optimizing stress until it converges, and later adding weights for the crossing angle maximization. To explore different ways of scheduling, we provide an interface that allows manual tuning of the weights.

3.2 Implementation

We implemented the framework in JavaScript. In particular we used the automatic differentiation tools in tensorflow.js [34] and the drawing library d3.js [6]. The prototype is available at

4 Properties and Measures

In this section we specify the aesthetic goals, definitions, quality measures and loss functions for each of the 9 graph drawing properties we optimized: stress, vertex resolution, edge uniformity, neighborhood preservation, crossing angle, aspect ratio, total angular resolution, Gabriel graph property, and crossing number. In the following discussion, since only one (arbitrary) graph is considered, we omit the subscript in our definitions of loss function and write for short. Other standard graph notation is summarized in Table 1.

Notation Description
The set of nodes in , indexed by , or
The set of edges in , indexed by a pair of nodes in
Number of nodes in
Number of edges in
and Adjacency matrix of and its -th entry
and Graph-theoretic distances between pairs of nodes and the -th entry
2D-coordinates of nodes in the drawing
The Euclidean distance between nodes and in the drawing
crossing angle
Angle between incident edges and
Table 1: Graph notation used in this paper.

4.1 Stress

We use stress minimization to draw a graph such that the Euclidean distance between pairs of nodes is proportional to their graph theoretic distance. Following the ordinary definition of stress [25], we minimize


Where is the graph-theoretical distance between nodes and , and are the 2D coordinates of nodes and in the layout. The normalization factor, , balances the influence of short and long distances: the longer the graph theoretic distance, the more tolerance we give to the discrepancy between two distances. When comparing two drawings of the same graph with respect to stress, a smaller value (lower bounded by ) corresponds to a better drawing.

4.2 Ideal Edge Length

When given a set of ideal edge lengths we minimize the average deviation from the ideal lengths:


For unweighted graphs, by default we take the average edge length in the current drawing as the ideal edge length for all edges. . The quality measure is lower bounded by and a lower score yields a better layout.

4.3 Neighborhood Preservation

Neighborhood preservation aims to keep adjacent nodes close to each other in the layout. Similar to Kruiger et al. [26], the idea is to have the -nearest (Euclidean) neighbors (k-NN) of node in the drawing to align with the nearest nodes (in terms of graph distance from

). A natural quality measure for the alignment is the Jaccard index between the two pieces of information. Let,

, where denotes the adjacency matrix and the -th row in denotes the -nearest neighborhood information of : if is one of the k-nearest neighbors of and = 0 otherwise.

To express the Jaccard index as a differentiable minimization problem, first, we express the neighborhood information in the drawing as a smooth function of node positions and store it in a matrix . In , a positive entry means node is one of the k-nearest neighbors of , otherwise the entry is negative. Next, we take a differentiable surrogate function of the Jaccard index, the Lovász hinge loss (LHL) [5], to make the Jaccard loss optimizable via gradient descent. We minimize


where LHL is given by Berman et al. [5], denotes the -nearest neighbor prediction:


where is the Euclidean distance between node and its nearest neighbor and denotes the adjacency matrix. Note that is positive if is a k-NN of , otherwise it is negative, as is required by LHL [5].

4.4 Crossing Number

Reducing the number of edge crossings is one of the classic optimization goals in graph drawing, known to affect readability [29]. Following Shabbeer et al. [32]

, we employ an expectation-maximization (EM)-like algorithm to minimize the number of crossings. Two edges do not cross if and only if there exists a line that separates their extreme points. With this in mind, we want to separate every pair of edges (the M step) and use the decision boundaries to guide the movement of nodes in the drawing (the E step). Formally, given any two edges

that do not share any nodes (i.e., , , and are all distinct), they do not intersect in a drawing (where nodes are drawn at , a row vector) if and only if there exists a decision boundary (a 2-by-1 column vector) together with a bias (a scalar) such that: .

Here we use to denote the subgraph of which only has two edges and , and . The loss reaches its minimum at

when the SVM classifier

predicts node and to be greater than and node and to be less than . The total loss for the crossing number is therefore the sum over all possible pairs of edges. Similar to (soft) margin SVM, we add a term to maximize the margin of the decision boundary: . For the E and M steps, we used the same loss function to update the boundaries and node positions :

(M step 1)
(M step 2)
(E step)

To evaluate the quality we simply count the number of crossings.

4.5 Crossing Angle Maximization

When edge crossings are unavoidable, the graph drawing can still be easier to read when edges cross at angles close to 90 degrees [36]. Heuristics such as those by Demel et al. [11] and Bekos et al. [4] have been proposed and have been successful in graph drawing challenges [12]. We use an approach similar to the force-directed algorithm given by Eades et al. [19] and minimize the squared cosine of crossing angles: . We evaluate quality by measuring the worst (normalized) absolute discrepancy between each crossing angle and the target crossing angle (i.e. 90 degrees): .

4.6 Aspect Ratio

Good use of drawing area is often measured by the aspect ratio [15] of the bounding box of the drawing, with as the optimum. We consider multiple rotations of the current drawing and optimize their bounding boxes simultaneously. Let , where and denote the width and height of the bounding box when the drawing is rotated by degrees. A naive approach to optimize aspect ratio, which scales the and coordinates of the drawing by certain factors, may worsen other criteria we wish to optimize and is therefore not suitable for our purposes. To make aspect ratio differentiable and compatible with other objectives, we approximate aspect ratio based on (soft) boundaries (top, bottom, left and right) of the drawing. Next, we turn this approximation and the target () into a loss function using cross entropy loss. We minimize


where is the number of rotations sampled (e.g., ), and , are the (approximate) width and height of the bounding box when rotating the drawing around its center by an angle . For any given -rotated drawing, is defined to be the difference between the current (soft) right and left boundaries, , where is a collection of the coordinates of all nodes in the -rotated drawing, and softmax returns a vector of weights given by . Note that the approximate right boundary is a weighted sum of the coordinates of all nodes and it is designed to be close to the coordinate of the right-most node, while keeping other nodes involved. Optimizing aspect ratio with the softened boundaries will stretch all nodes instead of moving the extreme points. Similarly, Finally, we evaluate the drawing quality by measuring the worst aspect ratio on a finite set of rotations. The quality score ranges from 0 to 1 (where 1 is optimal):

4.7 Angular Resolution

Distributing edges adjacent to a node makes it easier to perceive the information presented in a node-link diagram [23]. Angular resolution [3], defined as the minimum angle between incident edges, is one way to quantify this goal. Formally, , where is the angle formed by between edges and . Note that for any given graph, an upper bound of this quantity is where is the maximum degree of nodes in the graph. Therefore in the evaluation, we will use this upper bound to normalize our quality measure to , i.e. . To achieve a better drawing quality via gradient descent, we define the angular energy of an angle to be , where is a constant controlling the sensitivity of angular energy with respect to the angle (by default ), and minimize the total angular energy over all incident edges:


4.8 Vertex Resolution

Good vertex resolution is associated with the ability to distinguish different vertices by preventing nodes from occluding each other. Vertex resolution is typically defined as the minimum Euclidean distance between two vertices in the drawing [9, 31]. However, in order to align with the units in other objectives such as stress, we normalize the minimum Euclidean distance with respect to a reference value. Hence we define the vertex resolution to be the ratio between the shortest and longest distances between pairs of nodes in the drawing, , where . To achieve a certain target resolution by minimizing a loss function, we minimize


In practice, we set the target resolution to be , where

is the number of vertices in the graph. In this way, an optimal drawing will distribute nodes uniformly in the drawing area. The purpose of the ReLU is to output zero when the argument is negative, as when the argument is negative the constraint is already satisfied. In the evaluation, we report, as a quality measure, the ratio between the actual and target resolution and cap its value between

(worst) and (best).


4.9 Gabriel Graph Property

A graph is a Gabriel graph if it can be drawn in such a way that any disk formed by using an edge in the graph as its diameter contains no other nodes. Not all graphs are Gabriel graphs, but drawing a graph so that as many of these edge-based disks are empty of other nodes has been associated with good readability [18]. This property can be enforced by a repulsive force around the midpoints of edges. Formally, we establish a repulsive field with radius equal to half of the edge length, around the midpoint of each edge , and we minimize the total potential energy:


where and . We use the (normalized) minimum distance from nodes to centers to characterize the quality of a drawing with respect to Gabriel graph property: .

5 Experimental Evaluation

In this section, we describe the experiment we conducted on 10 graphs to assess the effectiveness and limitations of our approach. The graphs used are depicted in Figure 3 along with information about each graph. The graphs have been chosen to represent a variety of graph classes such as trees, cycles, grids, bipartite graphs, cubic graphs, and symmetric graphs.

In our experiment we compare with neato [20] and sfdp [20], which are classical implementations of a stress-minimization layout and scalable force-directed layout. In particular, we focus on 9 readability criteria: stress (ST), vertex resolution (VR), ideal edge lengths (IL), neighbor preservation (NP), crossing angle (CA), angular resolution (ANR), aspect ratio (AR), Gabriel graph properties (GG), and crossings (CR). We provide the values of the nine criteria corresponding to the 10 graphs for the layouts computed by by neato, sfdp, random, and 3 runs of initialized with neato, sfdp, and random layouts in Table 2. The best result is shown with bold font, green cells indicate improvement, yellow cells represent ties, with respect to the initial values (scores for different criteria obtained using neato, sfdp, and random initialization). From the experimental results we see that improves the random layout in 90% of the tests. also improves or ties initial layouts from neato and sfdp, but the improvements are not as strong or as frequent, most notably for the CR, NP, and CA criteria.

Figure 3: Drawings from different algorithms: neato, sfdp and with stress (ST), aspect ratio (AR), crossing angle maximization (CAM) and angular resolution (ANR) optimization on a set of 10 graphs. Edge color is determined by the discrepancy between actual and ideal edge length (here all ideal edge lengths are ); informally, short edges are red and long edges are blue.

In this experiment, we focused on optimizing a single metric. In some applications, it is desirable to optimize multiple criteria. We can use a similar technique i.e., take a weighted sum of the metrics and optimize the sum of scores. In the prototype (, there is a slider for each criterion, making it possible to combine different criteria.

6 Limitations

Although is a flexible framework that can optimize a wide range of criteria, it cannot handle the class of constraints where the node coordinates are related by some inequalities, i.e., the framework does not support hard constraints. Similarly, this framework does not naturally support shape-based drawing constraints such as those in [16, 17, 35]. takes under a minute for the small graphs considered in this paper. We have not experimented with larger graphs as the implementation has not been optimized for speed.

7 Conclusions and Future Work

We introduced the graph drawing framework and showed how this approach can be used to optimize different graph drawing criteria and combinations thereof. The framework is flexible and natural directions for future work include adding further drawing criteria and better ways to combine them. To compute the layout of large graphs, a multi-level algorithmic model might be needed. It would also be useful to have a way to compute appropriate weights for the different criteria.


This work was supported in part by NSF grants CCF-1740858, CCF-1712119, and DMS-1839274.

Crossings neato sdfp rnd dodec. 6.0 6.0 79.0 6.0 6.0 10.0 cycle 0.0 0.0 11.0 0.0 0.0 0.0 tree 0.0 0.0 31.0 0.0 0.0 0.0 block 23.0 16.0 297.0 23.0 16.0 25.0 compl. 3454 3571 3572 3454 3571 3572 cube 2.0 2.0 18.0 2.0 2.0 2.0 symme. 1.0 0.0 77.0 1.0 0.0 0.0 bipar. 40.0 52.0 40.0 40.0 40.0 40.0 grid 0.0 0.0 190.0 0.0 0.0 0.0 spx t. 73.0 71.0 7254.0 73.0 71.0 76.0 Ideal edge length neato sdfp rnd dodec. 0.14 0.15 0.53 0.1 0.15 0.08 cycle 0.0 0.0 0.42 0.0 0.0 0.0 tree 0.03 0.13 0.31 0.03 0.04 0.09 block 0.31 0.43 0.5 0.25 0.33 0.31 compl. 0.42 0.41 0.45 0.41 0.41 0.41 cube 0.08 0.12 0.29 0.03 0.0 0.12 symme. 0.08 0.19 0.46 0.07 0.05 0.04 bipar. 0.31 0.26 0.44 0.16 0.13 0.1 grid 0.01 0.09 0.41 0.0 0.0 0.01 spx t. 0.4 0.32 0.45 0.3 0.2 0.32 Stress neato sdfp rnd dodec. 21.4 17.58 111.05 17.45 17.58 17.6 cycle 0.77 0.77 30.24 0.77 0.77 0.77 tree 2.11 2.7 98.49 2.11 2.62 5.5 block 26.79 28.22 203.31 12.72 23.71 11.2 compl. 33.54 31.58 37.87 31.53 31.49 31.47 cube 2.75 2.71 11.69 2.66 2.69 2.65 symme. 9.88 5.38 180.48 9.88 3.36 3.97 bipar. 9.25 8.5 12.48 8.52 8.5 9.6 grid 6.77 7.38 221.66 6.77 6.78 6.77 spx t. 674.8 418.4 9794 227.1 235.3 227.2 Angular resolution neato sdfp rnd dodec. 0.39 0.39 0.01 0.6 0.39 0.6 cycle 0.8 0.8 0.05 0.8 0.8 0.8 tree 0.61 0.56 0.04 0.78 0.83 0.88 block 0.05 0.01 0.0 0.36 0.02 0.29 compl. 0.0 0.01 0.0 0.0 0.01 0.0 cube 0.28 0.3 0.01 0.46 0.44 0.4 symme. 0.66 0.6 0.03 0.68 0.76 0.77 bipar. 0.01 0.03 0.01 0.02 0.04 0.11 grid 0.52 0.54 0.0 0.52 0.54 0.52 spx t. 0.02 0.0 0.0 0.03 0.0 0.0 Neighbor preservation neato sdfp rnd dodec. 0.32 0.3 0.1 0.5 0.3 0.5 cycle 1.0 1.0 0.08 1.0 1.0 1.0 tree 1.0 1.0 0.02 1.0 1.0 1.0 block 0.57 0.93 0.12 0.83 0.93 1.0 compl. 1.0 1.0 1.0 1.0 1.0 1.0 cube 0.5 0.5 0.12 0.5 0.5 0.5 symme. 0.75 0.95 0.05 0.75 1.0 1.0 bipar. 0.47 0.47 0.43 0.47 0.47 0.43 grid 1.0 1.0 0.05 1.0 1.0 1.0 spx t. 0.36 0.44 0.03 0.49 0.46 0.53 Gabriel graph property neato sdfp rnd dodec. 0.16 0.64 0.07 0.32 0.64 0.32 cycle 1.0 1.0 0.29 1.0 1.0 1.0 tree 1.0 1.0 0.05 1.0 1.0 1.0 block 0.16 0.03 0.04 0.57 0.14 0.59 compl. 0.0 0.01 0.02 0.04 0.01 0.07 cube 0.43 0.51 0.01 0.75 0.8 0.71 symme. 0.54 1.0 0.15 0.7 1.0 1.0 bipar. 0.08 0.11 0.25 0.48 0.64 0.74 grid 1.0 1.0 0.03 1.0 1.0 1.0 spx t. 0.04 0.0 0.02 0.06 0.08 0.08 Vertex resolution neato sdfp rnd dodec. 0.52 0.54 0.07 0.7 0.81 0.68 cycle 0.98 0.98 0.32 0.98 0.98 0.98 tree 0.68 0.57 0.23 0.69 0.68 0.68 block 0.66 0.38 0.1 0.72 0.59 0.51 compl. 0.8 1.0 0.18 0.84 1.0 0.91 cube 0.66 0.82 0.11 0.66 0.82 0.67 symme. 0.35 0.43 0.06 0.38 0.51 0.6 bipar. 0.83 0.87 0.21 0.83 0.87 0.35 grid 0.87 0.8 0.08 0.88 0.88 0.88 spx t. 0.47 0.48 0.05 0.47 0.48 0.32 Aspect ratio neato sdfp rnd dodec. 0.92 0.91 0.88 0.96 0.96 0.96 cycle 0.96 0.95 0.67 0.96 0.95 0.96 tree 0.73 0.67 0.88 0.86 0.76 0.88 block 0.9 0.74 0.7 0.96 0.9 0.96 compl. 0.89 0.97 0.91 0.98 0.98 0.98 cube 0.76 0.79 0.57 0.87 0.79 0.88 symme. 0.58 0.67 0.89 0.6 0.67 0.89 bipar. 0.82 0.9 0.91 0.82 0.9 0.91 grid 1.0 1.0 0.82 1.0 1.0 1.0 spx t. 0.98 0.86 0.88 0.99 0.99 0.99 Crossing angle neato sdfp rnd dodec. 0.06 0.12 0.24 0.06 0.09 0.15 cycle 0.0 0.0 0.19 0.0 0.0 0.0 tree 0.0 0.0 0.23 0.0 0.0 0.0 block 0.11 0.1 0.24 0.05 0.06 0.09 compl. 0.25 0.24 0.24 0.24 0.24 0.24 cube 0.03 0.03 0.21 0.03 0.03 0.04 symme. 0.03 0.0 0.24 0.03 0.0 0.0 bipar. 0.16 0.17 0.23 0.16 0.17 0.19 grid 0.0 0.0 0.23 0.0 0.0 0.0 spx t. 0.16 0.22 0.25 0.16 0.15 0.21
Table 2: The values of the nine criteria corresponding to the 10 graphs for the layouts computed by neato, sfdp, random, and 3 runs of initialized with neato, sfdp, and random layouts. Bold values are the best. Green cells show an improvement, yellow cells show a tie, with respect to the initial values.


  • [1] M. Abadi, P. Barham, J. Chen, Z. Chen, A. Davis, J. Dean, M. Devin, S. Ghemawat, G. Irving, M. Isard, et al. (2016)

    Tensorflow: a system for large-scale machine learning

    In 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI’16), pp. 265–283. Cited by: §3.1.
  • [2] B. M. Ábrego, S. Fernández-Merchant, and G. Salazar (2012) The rectilinear crossing number of : closing in (or are we?). Thirty Essays on Geometric Graph Theory. Cited by: §2.
  • [3] E. N. Argyriou, M. A. Bekos, and A. Symvonis (2011) Maximizing the total resolution of graphs. In Proceedings of the 18th International Conference on Graph Drawing, pp. 62–67. Cited by: §2, §4.7.
  • [4] M. A. Bekos, H. Förster, C. Geckeler, L. Holländer, M. Kaufmann, A. M. Spallek, and J. Splett (2018) A heuristic approach towards drawings of graphs with high crossing resolution. In Proceedings of the 26th International Symposium on Graph Drawing and Network Visualization, pp. 271–285. Cited by: §2, §4.5.
  • [5] M. Berman, A. Rannen Triki, and M. B. Blaschko (2018)

    The lovász-softmax loss: a tractable surrogate for the optimization of the intersection-over-union measure in neural networks


    Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

    pp. 4413–4421. Cited by: §3.1, §4.3, §4.3, §4.3, Table 3.
  • [6] M. Bostock, V. Ogievetsky, and J. Heer (2011) D3: data-driven documents. IEEE transactions on visualization and computer graphics 17 (12), pp. 2301–2309. Cited by: §3.2.
  • [7] C. Buchheim, M. Chimani, C. Gutwenger, M. Jünger, and P. Mutzel (2013) Crossings and planarization. Handbook of Graph Drawing and Visualization, pp. 43–85. Cited by: §2.
  • [8] K. Chen, T. Dwyer, K. Marriott, and B. Bach (2020) DoughNets: visualising networks using torus wrapping. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems, pp. 1–11. Cited by: §2.
  • [9] M. Chrobak, M. T. Goodrich, and R. Tamassia (1996) Convex drawings of graphs in two and three dimensions. In Proceedings of the 12th annual symposium on Computational geometry, pp. 319–328. Cited by: §4.8.
  • [10] R. Davidson and D. Harel (1996) Drawing graphs nicely using simulated annealing. ACM Transactions on Graphics (TOG) 15 (4), pp. 301–331. Cited by: §2.
  • [11] A. Demel, D. Dürrschnabel, T. Mchedlidze, M. Radermacher, and L. Wulf (2018) A greedy heuristic for crossing-angle maximization. In Proceedings of the 26th International Symposium on Graph Drawing and Network Visualization, pp. 286–299. Cited by: §2, §4.5.
  • [12] W. Devanny, P. Kindermann, M. Löffler, and I. Rutter (2017) Graph drawing contest report. In Proceedings of the 25th International Symposium on Graph Drawing and Network Visualization, pp. 575–582. Cited by: §4.5.
  • [13] S. Devkota, R. Ahmed, F. De Luca, K. E. Isaacs, and S. Kobourov (2019) Stress-plus-x (spx) graph layout. In Proceedings of the 27th International Symposium on Graph Drawing and Network Visualization, pp. 291–304. Cited by: §1, §2, §2.
  • [14] W. Didimo and G. Liotta (2014) The crossing-angle resolution in graph drawing. Thirty Essays on Geometric Graph Theory, pp. . Cited by: §2.
  • [15] C. A. Duncan, M. T. Goodrich, and S. G. Kobourov (1998) Balanced aspect ratio trees and their use for drawing very large graphs. In Proceedings of the 6th International Symposium on Graph Drawing, pp. 111–124. Cited by: §4.6.
  • [16] T. Dwyer, Y. Koren, and K. Marriott (2006) IPSep-cola: an incremental procedure for separation constraint layout of graphs. IEEE transactions on visualization and computer graphics 12, pp. 821–8. Cited by: §2, §6.
  • [17] T. Dwyer (2009) Scalable, versatile and simple constrained graph layout. Comput. Graph. Forum 28, pp. 991–998. Cited by: §2, §6.
  • [18] P. Eades, S. Hong, K. Klein, and A. Nguyen (2015) Shape-based quality metrics for large graph visualization. In Proceedings of the 23rd International Conference on Graph Drawing and Network Visualization, pp. 502–514. Cited by: §2, §4.9.
  • [19] P. Eades, W. Huang, and S. Hong (2010) A force-directed method for large crossing angle graph drawing. arXiv preprint arXiv:1012.4559. Cited by: §4.5.
  • [20] J. Ellson, E. Gansner, L. Koutsofios, S. C. North, and G. Woodhull (2001)

    Graphviz—open source graph drawing tools

    In Proceedings of the 9th International Symposium on Graph Drawing, pp. 483–484. Cited by: §5.
  • [21] E. R. Gansner, Y. Koren, and S. North (2004) Graph drawing by stress majorization. In International Symposium on Graph Drawing, pp. 239–250. Cited by: §2.
  • [22] A. Griewank and A. Walther (2008) Evaluating derivatives: principles and techniques of algorithmic differentiation. Vol. 105, SIAM. Cited by: §3.1.
  • [23] W. Huang, P. Eades, S. Hong, and C. Lin (2013) Improving multiple aesthetics produces better graph drawings. Journal of Visual Languages & Computing 24 (4), pp. 262 – 272. Cited by: §2, §4.7.
  • [24] W. Huang, P. Eades, and S. Hong (2014) Larger crossing angles make graphs easier to read. Journal of Visual Languages & Computing 25 (4), pp. 452–465. Cited by: §2.
  • [25] T. Kamada and S. Kawai (1989) An algorithm for drawing general undirected graphs. Information Processing Letters 31 (1), pp. 7 – 15. Cited by: §2, §3.1, §4.1.
  • [26] J. F. Kruiger, P. E. Rauber, R. M. Martins, A. Kerren, S. Kobourov, and A. C. Telea (2017) Graph layouts by t-sne. Comput. Graph. Forum 36 (3), pp. 283–294. Cited by: §2, §4.3.
  • [27] J. B. Kruskal (1964) Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis. Psychometrika 29 (1), pp. 1–27. Cited by: §2.
  • [28] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al. (2019) PyTorch: an imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pp. 8024–8035. Cited by: §3.1.
  • [29] H. Purchase (1997) Which aesthetic has the greatest effect on human understanding?. In Proceedings of the 5th International Symposium on Graph Drawing, pp. 248–261. Cited by: §2, §4.4.
  • [30] M. Radermacher, K. Reichard, I. Rutter, and D. Wagner (2018) A geometric heuristic for rectilinear crossing minimization. In The 20th Workshop on Algorithm Engineering and Experiments, pp. 129–138. Cited by: §2.
  • [31] A. Schulz (2011) Drawing 3-polytopes with good vertex resolution.. J. Graph Algorithms Appl. 15 (1), pp. 33–52. Cited by: §4.8.
  • [32] A. Shabbeer, C. Ozcaglar, M. Gonzalez, and K. P. Bennett (2010) Optimal embedding of heterogeneous graph data with edge crossing constraints. In

    NIPS Workshop on Challenges of Data Visualization

    Cited by: §2, §4.4, Table 3.
  • [33] R. N. Shepard (1962) The analysis of proximities: multidimensional scaling with an unknown distance function. Psychometrika 27 (2), pp. 125–140. Cited by: §2.
  • [34] D. Smilkov, N. Thorat, Y. Assogba, C. Nicholson, N. Kreeger, P. Yu, S. Cai, E. Nielsen, D. Soegel, S. Bileschi, M. Terry, A. Yuan, K. Zhang, S. Gupta, S. Sirajuddin, D. Sculley, R. Monga, G. Corrado, F. Viegas, and M. M. Wattenberg (2019) TensorFlow.js: machine learning for the web and beyond. In Proceedings of Machine Learning and Systems 2019, pp. 309–321. Cited by: §3.2.
  • [35] Y. Wang, Y. Wang, Y. Sun, L. Zhu, K. Lu, C. Fu, M. Sedlmair, O. Deussen, and B. Chen (2017) Revisiting stress majorization as a unified framework for interactive constrained graph visualization. IEEE transactions on visualization and computer graphics 24 (1), pp. 489–499. Cited by: §1, §2, §6.
  • [36] C. Ware, H. Purchase, L. Colpoys, and M. McGill (2002) Cognitive measurements of graph aesthetics. Information visualization 1 (2), pp. 103–110. Cited by: §2, §4.5.
  • [37] J. X. Zheng, S. Pawar, and D. F. Goodman (2018) Graph drawing by stochastic gradient descent. IEEE transactions on visualization and computer graphics 25 (9), pp. 2738–2748. Cited by: §3.1.

8 Appendix

The following table summarizes the objective functions used to optimize the nine drawing criteria via different optimization methods.

Property Gradient Descent Subgradient Descent Stochastic Gradient Descent
Stress for a random pair of nodes
Ideal        Edge Length (Eq. 2) for a random edge
Crossing       Angle for a random crossing
Neighborhood Preservation Lovász softmax [5] between neighborhood prediction (Eq.4) and adjacency matrix Lovász hinge [5] between neighborhood prediction (Eq.4) and adjacency matrix Lovász softmax or hinge [5] on a random node. (i.e. Jaccard loss between a random row of K in Eq. 4 and the corresponding row in the adjacency matrix )
Crossing Number Shabbeer et al. [32] Shabbeer et al. [32] Shabbeer et al. [32]
Angular       Resolution
for random
Vertex        Resolution (Eq. 7) for random
Gabriel Graph (Eq. 9) for random and
Aspect Ratio Eq. 5 Eq. 5 Eq. 5
Table 3: Summary of the objective functions via different optimization methods.