An Experimental Comparison of Three Graph Drawing Algorithms (Extended Abstract)
Giuseppe Di Battista
Ashim Garg
y
[email protected]
Roberto Tamassia y
[email protected]
Emanuele Tassinari
z
[email protected]
D. I. F. A. Univ. della Basilicata 85100 Potenza Italy
Giuseppe Liotta
z
[email protected]
Francesco Vargiu
x
Dept. of Computer Science Brown University Providence, RI 02912{1910 USA
Abstract In this paper we present an extensive experimental study comparing three general-purpose graph drawing algorithms. The three algorithms take as input general graphs (with no restrictions whatsoever on the connectivity, planarity, etc.) and construct orthogonal grid drawings, which are widely used in software and database visualization applications. The test data (available by anonymous ftp) are 11,582 graphs, ranging from 10 to 100 vertices, which have been generated from a core set of 112 graphs used in \real-life" software engineering and database applications. The experiments provide a detailed quantitative evaluation of the performance of the three algorithms, and show that they exhibit trade-os between \aesthetic" properties (e.g., crossings, bends, edge length) and running time. The observed practical behavior of the algorithms is consistent with their theoretical properties. Research supported in part by the US National Science Foundation, by the US Army Research Oce, by the US Oce of Naval Research and the Advanced Research Projects Agency, by the NATO Scienti cAairs Division, by the \ProgettoFinalizzato Sistemi Informatici e Calcolo Parallelo (Sottoprogetto 6, Infokit)" and Grant 94.23.CT07 of the Italian National Research Council (CNR), and by the ESPRIT II Basic Research Actions Program of the European Community (project ALgorithms and Complexity).
x
[email protected]
[email protected] z
x
x
Dip. Informatica e Sistemistica Univ. di Roma \La Sapienza" 00198 Roma Italy
1 Introduction
Graph drawing algorithms construct geometric representations of abstract graphs and networks. Because of the direct applications of graph drawing to advanced graphic user interfaces and visualization systems, and thanks to the many theoretical challenges posed by the interplay of graph theory and geometry, an extensive literature on the subject [12, 46] has grown in the last decade. Various graphic standards have been proposed for the representation of graphs in the plane. Usually, vertices are represented by points or simple geometric gures (e.g., rectangles, circles), and each edge ( ) is represented by a simple open Jordan curve joining the points associated with the vertices and . A drawing is planar if no two edges cross. A graph is planar if it admits a planar drawing. An orthogonal drawing maps each edge into a chain of horizontal and vertical segments (see Figures 2{3). A grid drawing is embedded in a rectilinear grid such that the vertices and bends of the edges have integer coordinates. Orthogonal drawings are widely used for graph visualization in many applications, including database systems (Entity-Relationship diagrams), software engineering (Data-Flow diagrams), and circuit design (circuit schematics). u; v
u
v
1.1 Previous Experimental Work in graph Drawing
Many graph drawing algorithms have been implemented and used in practical applications. Most papers in this area show sample outputs, and some also provide limited experimental results on small (with fewer than 100 graphs) test suites (see, e.g., [9, 18, 20, 24, 25, 28] and
the experimental papers in [46]). However, in order to evaluate the practical performance of a graph drawing algorithm in visualization applications, it is essential to perform extensive experimentations with input graphs derived from the application domain. The performance of four planar straight-line drawing algorithms [6, 7, 10, 38, 48] is compared in [23]. These algorithms have been implemented and tested on 10,000 randomly generated maximal planar graphs. The standard deviations in angle size, edge length, and face area are used to compare the quality of the planar straight-line drawings produced. Since the experiments are limited to randomly generated maximal planar graphs, this work gives only partial insight on the performance of the algorithms on general planar graphs. Himsolt [21] presents a comparative study of twelve graph drawings algorithms, including [6, 10, 18, 26, 41, 42, 50, 52]. The algorithms selected are based on various approaches (e.g., force-directed, layering, and planarization) and use a variety of graphic standards (e.g., orthogonal, straight-line, polyline). Only three algorithms draw general graphs, while the others are specialized for trees, planar graphs, Petri nets, and graph grammars. The experiments are conducted with the graph drawing system GraphEd [22]. Many examples of drawings constructed by the algorithms are shown, and various objective and subjective evaluations on the aesthetic quality of the drawings produced are given. However, statistics are provided only on the edge length, and details on the experimental setting (e.g., provenance, composition, and size of the test suite) are not provided. The charts on the edge length have marked oscillations, suggesting that the number of test graphs is not very large. This work provides an excellent overview and comparison of the main features of some popular drawing algorithms. However, it does not give detailed statistical results on their performance.
1.2 Our Results
In this paper we present an extensive experimental study comparing three general-purpose graph drawing algorithms. The three algorithms take as input general graphs (with no restrictions whatsoever on the connectivity, planarity, etc.) and construct orthogonal grid drawings. The test data (available by anonymous ftp) are 11,582 graphs, ranging from 10 to 100 vertices, which have been generated from a core set of 112 graphs used in \real-life" software engineering and database applications. The experiments provide a detailed quantitative evaluation of the performance of the three algorithms, and show that they exhibit trade-os between \aesthetic" properties (e.g., crossings, bends, edge length) and running time. The observed practical behavior of the algorithms is consistent with their theoretical properties.
The contributions of this work can be summarized as follows:
We have generated a large test suite of graphs derived from \real-life" visualization applications. We believe that it will be useful to other researchers interested in experimental graph drawing. We have implemented three algorithms with solid theoretical foundations that construct orthogonal grid drawings of arbitrary input graphs. We have presented the rst extensive experimental study of general-purpose graph drawing algorithms, with test graphs derived from software engineering and database applications.
1.3 Organization of the Paper
The rest of this paper is organized as follows: In Section 2, we overview the drawing system used for our study. The three drawing algorithms analyzed are described in Section 3. Details on the experimental setting are give in Section 4. In Section 5, we summarize our experimental results in nine charts and perform a comparative analysis of the performance of the algorithms. Finally, open problems are addressed in Section 6.
2 Diagram Server
Our experimental study was conducted using Diagram Server [13], a network server for client-applications that use diagrams (drawings of graphs). Diagram Server offers to its clients an extensive set of facilities to represent and manage diagrams through a multiwindowing environment. One of the most important facilities is a library of sophisticated automatic graph drawing algorithms. Diagram Server can be fully customized according to dierent application contexts and graphic environments. The main features of Diagram Server are listed below. Independence from the client-applications: Because of
the client-server interaction between Diagram Server and each one of its clients, both the development of the clients and the customization of Diagram Server do not require any knowledge of the internal structure of Diagram Server. The clients can specify the visual appearance of symbols and connections, the graphic standard, the aesthetic requirements that diagrams should satisfy, and the whole interface con guration. Automatic graph drawing: Diagram Server has an automatic graph drawing facility [4] that is based on a large modular library of graph drawing algorithms and on a tool that, given the requirements of an application, selects the suitable algorithms for such
requirements. Both the set of algorithms and the set of requirements can be easily extended or customized, and the result is an automatic graph drawing facility with high exibility and extensibility, that combines the eciency of special purpose algorithms with the variety of the possible application contexts. A graph drawing algorithm is fully speci ed in the automatic graph drawing facility by an algorithmic path, which describes the sequence of steps and intermediate representations (e.g., planar embedding, orthogonal shape, visibility representation) produced by the algorithm. Multiple representations: A graph can be represented by several diagrams, and dierent portions of a diagram can be displayed on dierent windows. The consistency between dierent representations of the same object is automatically maintained by Diagram Server. Multi-user environment: Diagram Server supports diagram visualization activities that are shared among networked client-applications. Each client takes user input and submits requests to the server. In this way, the user gains access to capabilities not usually available locally on its desktop computer, such as an eective usage of a huge library of automatic graph drawing algorithms and the possibility of handling large diagrams. Message-passing protocol: Diagram Server communicates to the client each action that the nal user performs on a diagram through the user interface. All the exchanged data are enclosed into messages. This implies that no common memory is shared by the applications and that the system behavior is independent from the operating system and the hardware environment. Diagram Server has been implemented and tested on a wide variety of client-applications including information systems design, project management and reverse software engineering. Also, Diagram Server has been successfully used to test new graph drawing algorithms and to evaluate their performance with respect to several aesthetic criteria.
3 The Drawing Algorithms Under Evaluation
The three drawing algorithms considered in this paper, denoted Bend-Stretch, Column, and GIOTTO, take as input general graphs (with no restrictions whatsoever on connectivity, planarity, etc.) and construct orthogonal drawings.
Algorithms Bend-Stretch and GIOTTO are based on a general approach where the drawing is incrementally speci ed in three phases (see Fig. 1): The rst phase, planarization, determines the topology of the drawing. The second phase, orthogonalization, computes an orthogonal shape for the drawing. The third phase, compaction, produces the nal drawing. This approach allows homogeneous treatment of a wide range of diagrammatic representations, aesthetics and constraints (see, e.g., [28, 43, 47]) and has been successfully used in industrial tools.
(a)
(b)
(c)
(d)
Figure 1: A general strategy for orthogonal grid drawings. (a) Input graph. (b) Planarization. (c) Orthogonalization. (d) Compaction. The main dierence between the two algorithms is in the orthogonalization phase: Algorithm GIOTTO uses a network- ow method that guarantees the minimum number of bends but has quadratic timecomplexity [42]. Algorithm Bend-Stretch adopts the \bend-stretching" heuristic [45] that only guarantees a constant number of bends on each edge but runs in linear time. More speci cally, algorithms GIOTTO and Bend-Stretch are described by the following two algorithmic paths of the automatic graph drawing facility of Diagram Server: GIOTTO: { multigraph { MakeConnected connected { MakePlanar connectedplanar { Make4planar fourplanar { Step3giotto orthogonal { Step4giotto manhattan }}}}}}
Bend-Stretch: { multigraph { MakeConnected connected { MakeBiconnected biconnected { MakePlanar biconnectedplanar { Step1TaTo89 visibilityrepresentation { Step2TaTo89 orthogonal { Step4TaTo89 orthogonal {Step4Giotto manhattan}}}}}}}}
In the above notation, upper-case identi ers denote algorithmic components, and lower-case identi ers denote intermediate representations (such as graphs and drawings), as shown in Table 1. Algorithm Column, is an extension of the orthogonal drawing algorithm by Biedl and Kant [5] to graphs of arbitrary vertex degree. More speci cally, algorithm Column is described by the following algorithmic path of the automatic graph drawing facility of Diagram Server: Column:
{ multigraph { MakeConnected connected { MakeBiconnected biconnected { BiedlKant manhattan }}}}
Note that the connectivity and biconnectivity augmentation steps were introduced in order to use algorithms designed for connected and biconneceted graphs, respectively. The augmentation edges are not displayed in the nal drawing. Examples of \typical" drawings generated by Bend-Stretch, Column, and GIOTTO are shown in Figures 2{3. The drawings are all orthogonal grid drawings and have been dierently scaled to t in the page. Let be the number of vertices of the input graph, and be the number of crossings in the drawing constructed. The worst-case asymptotic time complexity is ( + ) for algorithms Bend-Stretch and Column, and (( + )2 log( + )) for algorithm GIOTTO. Note that it is NP-hard to compute the minimum number of crossings, so that all the three algorithms heuristically attempt at reducing the number of crossings. However, algorithm GIOTTO guarantees to construct a planar drawing if the input graph is planar. In addition to the three algorithms we have implemented and compared ( Bend-Stretch, Column, and GIOTTO), several other orthogonal drawing algorithms (mostly for planar graphs) have been reported in the literature. Because of the techniques used, we expect the behavior of the algorithms in [14, 16, 17, 11, 27, 33, 34, 35, 32, 40] to be similar to that of one of Bend-Stretch, Column, or GIOTTO. It would be interesting to perform further experiments on the practical performance of the recent algorithm by Papakostas and Tollis [37], and of separatorbased methods [15, 31, 49] that were originally developed for VLSI layout. N
C
O N O
N
C
C
N
C
multigraph MakeConnected connected MakeBiconnected biconnected MakePlanar connectedplanar Make4planar
fourplanar
Step3giotto step1TaTo89 step2TaTo89 step4TaTo89
orthogonal
Step4giotto BiedlKant manhattan
general multigraphs accepted as input connectivity testing and augmentation connected graph biconnectivity testing and augmentation biconnected graph planarization phase [3, 36] crossing are now replaced by dummy vertices expansion of vertices with degree greater than 4 into rectangular symbols viewing the rectangular symbols as cycles of dummy vertices, the graph has now maximum degree 4 orthogonalization phase [42] construction of a visibility representation [39, 44, 51]) fast orthogonalization [45] bend-stretching transformations, which remove bends by local layout modi cations [45] orthogonal representation, describing shape of the drawing in term of its angles compaction phase [3] orthogonal drawing algorithm [5] the nal output is an orthogonal grid drawing
Table 1: Algorithmic components and intermediate representations used by algorithms Bend-Stretch, Column, and GIOTTO in the automatic graph drawing facility of Diagram Server.
4 Experimental Setting
4.1 Quality Measures Analyzed
The following quality measures of a drawing of a graph have been considered: Area: area of the smallest rectangle with horizontal and vertical sides covering the drawing; Cross: total number of crossings; TotalBends: total number of bends; TotalEdgeLen: total edge length; MaxEdgeBends: maximum number of bends on any edge; MaxEdgeLen: maximum length of any edge; UnifBends: standard deviation of the number of bends on the edges;
1
60
69
2
31
25
78
28
44
56
44
35
39
4 8
47
11
7
51
52
42
67
8
85
38
47
55
34
43
36
45
9
48
12
55 17
1
45
15
16
61
57
71
70
21
79
16
81
18
27
63
34
58
33
57
6
5
10
48
23
27
28
12
30
43
17
82
3
75
14
15
9
80
6
11
22
50
37
36
59
3
35
19
23
26
25
62
42
39
24
54
10
5
4
77
29
32
50
13
7
41
59
2
30
61 72
24
54
53
41
60
63
62
49 20
38
14
56
18
21
13
22
64
52
29
20
40
66
58
49
32
33
68
46
40
53
31 26
46
84
(a)
51
37
73
19
76
39
40
65
74
52
(a)
21
14
2
31
6
80
22
3
82
75
59 58
63
34
57
66
10
54
7
32
29
50
13
30
24
62
63
20
37
84
46
48
21
57
16
5 9
15
8 60
39
28
35
44
55
56
47
33 52
36 4
45
49
53
34
38
1
(b) 35
48
39 79
81
7
8
9
1
2 60
69
57 65
16
70
71
43
8 3 67
25
78
62
82
63
10
11
9
75
14
80 73 37
84
59 41
50
13
26
46
6
72
64
33
68
22 27
51 52 45
48
36
10
83
74
5
2
61
42
54
6
27 28
44
53 30
18
45
15
23
22
12
58
49
49
57
4
38 54
14
53
40
29
1
51
56
18
21
77
62
43
32
40
32
31
52
30
7
47
55
42
39
29
20
56
35
20
15
37
36
31
3
59
17
16
47
24 66
46
11
50
63
61
4
5
17
85
38
58
34
34
21
55
12
19
76
26
25
24
28
19
23
13
44
33
60
3
59
(b)
41
36
61
18
56
17
17
43
62
70
2
79
81
71
76
43
19
42
51
73
4
26
40
58
44
15
47
16
7
11
78
50
46
68
6
5
48
10
77
33
26
23
25
24
42
38
72
8
19
14
41
12
23
18
37
35
27
61
27
53
60 32
41
11
64
83
74
85
65
67
25
1
45
69
30
28
22
49
13
20
9
12
55
29
54
31
51
83
(c)
(c)
Figure 2: Drawings of the same 63-vertex graph produced by algorithms (a) Bend-Stretch, (b) Column, and (c) GIOTTO.
Figure 3: Drawings of the same 85-vertex graph produced by algorithms (a) Bend-Stretch, (b) Column, and (c) GIOTTO.
UnifLen: standard deviation of the edge length;
4.2 Generation of the Test Graphs
ScreenRatio: deviation from the optimal aspect ra-
tio, computed as the dierence between the width/height ratio of the the best of the two possible orientations (portrait and landscape) of the drawing and the standard 4 3 ratio of a computer screen. =
It is widely accepted (see, e.g., [12] ) that small values of the above measures are related to to perceived aesthetic appeal and visual eectiveness of the drawing.
Since we are interested in evaluating the performance of graph drawing algorithms in practical applications, we have disregarded approaches completely based on random graphs. Our test graph generation strategy is as follows. First, we have focused on the important application area of database and software visualization, where EntityRelationship diagrams and Data-Flow diagrams are usually displayed with orthogonal drawings. Second, we have collected 112 \real life" graphs with number of vertices between 10 and 100, from now
on called core graphs, from the following sources: 54% of the graphs have been obtained from major Italian software companies (especially from Database Informatica) and large government organization (including the Italian Internal Revenue Service and the Italian National Advisory Council for Computer Applications in the Government (Autorita per l'Informatica nella Pubblica Amministrazione)). 33% of the graphs were taken from well-known reference books in software engineering [19] and database design [1], and from journal articles on software visualization in the recent issues of Information Systems and the IEEE Transactions on Software Engineering. 13% of the graphs were extracted from theses in software and database visualization written by students at the University of Rome \La Sapienza". Third, we have generated the 11 582 test graphs as variations of the core graphs. This step is the most critical, since we needed to devise a method for generating graphs \similar" to the core graphs. Our approach is based on the following scheme. We de ned several primitive operations for updating graphs, which correspond to the typical operations performed by designers of Entity-Relationship and DataFlow Diagrams, and attributed a certain probability to each of them. More speci cally, the updating primitives we have used are the following: InsertEdge, which inserts a new edge between two existing vertices; DeleteEdge, which deletes an existing edge; InsertVertex, which splits an existing edge into two edges by inserting a new vertex; DeleteVertex, which deletes a vertex and all its incident edges; and MakeVertex, which creates a new vertex and connects it to a subset of vertices. The test graphs were then generated in several iterations starting from the core graphs by applying random sequences of operations with a \genetic" mechanism. Namely, at each iteration a new set of test graphs was obtained by applying a random sequence of operations to the current test set. Each new graph was then evaluated for \suitability", and those found not suitable were discarded. The probability of each primitive operation was varied at the end of each iteration. The evaluation of the suitability of the generated graphs was conducted using both objective and subjective analyses. The objective analysis consisted of determining whether the new graph had similar structural properties with respect to the core graph it was derived from. We have taken into account parameters like the average ratio between number of vertices and number of edges and the average number of biconnected components. The subjective analysis consisted in a visual inspection of the new graph and an assessment by expert
;
users of Entity-Relationship and Data-Flow diagrams of its similarity to a \real-life" diagram. For obvious reasons, the subjective analysis has been done on a randomly selected subset of the graphs. Figure 4 depicts the distribution of the test graphs with respect to the number of vertices, and the average number of edges of the test graphs with vertices, for = 10 100. Note that at least 50 graph for each vertex cardinality between 10 and 100 have been generated. The 11 582 test graphs are available by anonymous ftp from infokit.dis.uniroma1.it:public. Sparsity and \near-planarity" are typical properties of graphs used in software engineering and database applications [2]. As expected, the test graphs turn out to be sparse (the average vertex degree is about 2.7, see Fig. 4.b) and with low crossing number (the average crossing number is no more than about 0.7 times the number of vertices, see Fig. 6.b). We did not include graphs with more than 100 vertices because they are rarely displayed in full in the above applications (clustering methods are typically used to hierarchically display large graphs). N
N
; ;
;
5 Analysis of the Experimental Results The Bend-Stretch, Column, and GIOTTO algorithms have been executed on each of the 11,582 test graphs. Figures 6{8 show the average values of the nine quality measures Area, Cross, ScreenRatio, TotalBends, MaxEdgeBends, UnifBends, TotalEdgeLen, MaxEdgeLen, UnifLen achieved by the three algorithms on test graphs
with vertices, for = 10 100. Figure 5 shows the line styles used in Figures 6{8 for the three algorithms. We make the following observations on the experimental results, which show a clear trade-o between running time and aesthetic quality of the drawings: N
N
; ;
Area: GIOTTO outperforms both Bend-Stretch and Column, which behave about the same. For N >
70, the dierence becomes signi cant for the user (see, e.g., Fig. 3).
Cross: Bend-Stretch and GIOTTO behave more or less
the same, especially for 10 60, and 95 100. This happens even though BendStretch has a MakeBiconnected step before the MakePlanar step. The behavior of Column is considerably worse. < N