Abstract
Symmetry is one of the most important aesthetic criteria on graph drawing. It is quite necessary to measure the extent to which the drawings can be considered symmetric. For this purpose, a symmetric metric based on vertex coordinate calculation is proposed in this paper. It is proven theoretically and experimentally that the proposed metric is robust to contraction, expansion, and rotation of drawings. This robustness conforms to human perception of symmetry. Star-subgraphs and cycles are two common structures in digraphs. Both of them have inherent symmetry which should be displayed in drawings. For this purpose, a force-directed algorithm named FDS is proposed which can draw star-subgraphs and cycles as symmetrically as possible. FDS algorithm draws cycles as circles whose positions are fixed to provide a scaffolding for overall layout, renders non-leaf vertices by a standard force-directed layout, and places leaf vertices on concentric circles via a deterministic strategy. A series of experiments are carried out to test FDS algorithm. The results show that FDS algorithm draws digraphs more symmetrically than the existing state-of-the-art algorithms and performs efficiency comparable to YFHu algorithm.
1. Introduction
Graph drawing is the research on how to communicate knowledge visually through drawings of graphs. The main purpose of graph drawing is to produce understandable drawings from graphs within bearable time. The understandability of drawings is a highly subjective matter and affected by not only intrinsic data characteristics [1], but also drawings themselves. The understandability affected by intrinsic data characteristics can be interpreted as whether the important structures, e.g., star-subgraphs and cycles, are drawn to be eye-catching in drawings. The understandability affected by drawings is specified as aesthetics. Bhanji et al. [2] summed up three common aesthetics: maximized symmetry, minimized edge crossings, and minimized bends. With the development of research on aesthetics, the number of common aesthetics increases to seven [3]. Furthermore, Ware et al. [4] believed that continuity (i.e., keeping multiedge paths as straight as possible) is also an important aesthetic. It is commonly accepted that a drawing would be understandable if it conforms to these aesthetics.
Indubitably, symmetry is one of the most important aesthetic criteria that represents the structure and properties of a graph visually. The importance of symmetry on graph drawing has been pointed out by Lipton et al. [5]. Even Eades and Hong discussed symmetric graph drawing in a chapter of the book “Handbook of Graph Drawing and Visualization” [6]. Existing studies explored the issues of symmetry by combining with isomorphisms [7] and automorphisms [5, 8–10]. In addition, there also is an interesting research topic on symmetry in layouts sketched by participants [11–14]. However, symmetry is on the basis of human intuition and subjective judgement of researchers. In other words, symmetry would remain subjective if there is no quantified metric to measure it. There have been some objective metrics proposed for symmetry. A model for measuring the symmetry of straight line drawing was given by Lipton et al. [5]. But this model is associated with automorphisms which is computational hardly. Purchase [3] presented a formal metric to measure the extent to which the drawing can be considered symmetric by returning an objective real number between 0 and 1 inclusive. Although Purchase’s method is applicable to any drawing of any size, it ignored rotational symmetry. And the ignorance is in contradiction with human perception of symmetry. Thus, it is very necessary to develop an objective symmetric metric which is easy to compute and in accord with human perception of symmetry.
Then the first contribution of this paper is that an objective symmetric metric is proposed to measure the extent to which the drawings produced by graph drawing algorithms can be considered symmetric, which is based on vertex coordinate calculation. Locally, this metric works out a value for every vertex, which can measure the extent to which neighbors can be considered to be distributed symmetrically around the vertex. Globally, expected value and variance of all local values are used to measure the extent to which the drawing can be considered symmetric. Compared to these existing symmetry metrics, the proposed symmetric metric in this paper is not only applicable to any drawing of any size, but also robust to contraction, expansion, and rotation of drawings. In addition, it can return metric values within few time because it is based on vertex coordinate calculation.
As two common structures in digraphs, a star-subgraph contains a star vertex and several leaf vertices connecting the star vertex, and a cycle is defined as a closed path with no repetitions of vertices and edges. From viewpoint of knowledge visualization, star-subgraphs and cycles are worthy of being visualized since the two structures from digraphs are originally two kinds of knowledge. It should be noted that there is inherent symmetry in star-subgraphs and cycles, so these two structures should be displayed symmetrically in overall drawings. For drawing cycles, Becker and Rojas [15] once tried to draw cycles by circular layout algorithm. Although circular layout algorithm can display cycles as circles which is the most symmetrical geometric figure, it can not highlight circles. As a result, the circles can not be easily distinguished from overall drawings. On the other hand, the task of drawing star-subgraphs is essentially how to distribute leaf vertices around star vertices. There are already some works which involve leaf vertices. In multilevel force-directed approaches [16], they deal with leaf vertices by deletion. However, it is inappropriate from the viewpoint of knowledge discovery because removing of leaf vertices would cause loss of knowledge. The problem of drawing star-subgraphs symmetrically is actually the problem of drawing leaf vertices. Some multilevel force-directed approaches can display leaf vertices via coarsening phase [17]. However, displaying of these leaf vertices still takes noticeable time and does not exhibit sufficient inherent symmetry of star-subgraphs. RINGs [18], Circular [19], and Radial [20] layouts can also deal with leaf vertices. RINGs algorithm [18] places successors in concentric rings around the center of the predecessor circle for any digraphs. However, overlapping between vertices would be induced when other structures exist except for star-subgraphs. In the drawing of star-subgraphs, produced by Circular algorithm [19], vertices are placed on the same circle leading to insufficient space utilization. Star-subgraphs can be drawn with the shape of fan by Radial algorithm [20], which did not exhibit sufficient inherent symmetry of star-subgraphs. Thus, there is an urgent need for an algorithm which can draw digraphs containing star-subgraphs and cycles symmetrically conspicuously.
In consideration of the demand for displaying star-subgraphs and cycles symmetrically, and based on above discussions, the second contribution of this paper is that a force-directed algorithm named FDS is proposed by using scaffolding strategy, which can solve the problems encountered in drawing star-subgraphs and cycles. The reason for taking scaffolding strategy is that the positions of cycle vertices should be fixed once the coordinates of them are acquired so that the symmetry displayed are not changed in the process of drawing other vertices. Similar scaffolding strategy has been used in [21, 22]. In [21], authors took spanning trees and planar graphs to provide a scaffolding for drawing so that structure and follow path can be discerned. Unlike [21], in this paper, we take the found cycles to provide the scaffolding for overall drawing so that cycles can be discerned from overall drawing. The basic idea of FDS is as follows: firstly, use HL-DPC algorithm [23] to discover cycles of digraphs, and a cycle drawing algorithm based on circle placement (CD-CP) is proposed as a subalgorithm of FDS. CD-CP algorithm can fix the cycle vertices on equal amount of highlighted circles which provide a fixed scaffolding to overall drawings. Secondly, a standard force-directed algorithm, FR algorithm [24], is taken to deal with non-leaf vertices. Thirdly, a leaf vertices distribution algorithm (LD) is proposed as a subalgorithm of FDS. LD algorithm can distribute leaf vertices evenly around the centers of star-subgraphs and star vertices, so that the drawing of star-subgraphs is symmetrical. Compared to existing methods, our FDS algorithm solves the problems when drawing cycles and star-subgraphs. For cycles, as FDS’s subalgorithm, CD-CP algorithm can not only distribute cycle as circles but also highlight them so that cycles are displayed symmetrically and conspicuously. For star-subgraphs, as FDS’s subalgorithm, LD algorithm can distribute leaf vertices belonging to star-subgraphs most symmetrically by cost of few time.
It can be seen that a standard force-directed algorithm, FR, is used as a subalgorithm of proposed FDS algorithm. The reason for utilizing FR algorithm is that force-directed algorithms are the most widely used tools for graph drawing and famous for ability of producing pleasing layouts having balanced aesthetics. The basic idea of force-directed algorithm is that a graph is simulated by a physical system of attractive spring forces along edges and repulsive forces emanating from vertices. Then vertices will move along the direction of the combined force. These movements are repeated until the force system reaches equilibrium. There are already various force-directed algorithms. In 1984, Eades [26] proposed a landmark force-directed algorithm. However, Eades’s implementation does not follow Hook law but the spring force formula built by himself. Kamada and Kawai (KK) [27] proposed an energy model which made improvement on Eades’s spring model. KK algorithm uses spring forces proportional to the graph theoretic distances. Appealing drawing can be obtained by decreasing the system total energy until minimum. Fruchterman and Reingold (FR) [24] referenced the works of Eades [26] and Quinn [28]. They used a spring-electrical system, which is based on Coulomb’s law, to take the place of Eades’s spring physical system. Although FR is a very simple algorithm, it provides quite excellent results. Even today, it is still one of the most popular algorithms for graph drawing. Jacomy [29] proposed the well-known forceatlas2 algorithm by reference of LinLog model. Forceatlas2 algorithm can produce good quality with few iterations for most graphs [30]. An important improvement on force-directed algorithms is the multilevel technique. There are some famous multilevel graph algorithms, such as FMS [31], GRIP [32], Walshaw’s [33], [16], and YifanHu [17] algorithms. YifanHu algorithm is both efficient and high quality, which is proposed based on combining a multilevel approach with the Barnes and Hut [34] octree technique. There are other outstanding algorithms, such as Gansner’s stress majorization [35], Landmark MDS [36], PivotMDS [37], and MaxEnt [38].
This paper is organized as follows. In Section 2, related definitions and works are given. In Section 3, a symmetric metric based on vertex coordinate calculation is proposed to measure the extent to which the drawings produced by various algorithms can be considered symmetric. In Section 4, the proposed FDS algorithm is described in detail. In Section 5, a Gephi layout plugin is developed in NetBeans that is a software development platform written in Java. Related experiments are performed to compare the efficiency and quality of FDS algorithm with existing methods, including FR algorithm [24], YifanHu algorithm [17], and ForceAtlas2 algorithm [29]. Finally, in Section 6 a conclusion is given.
2. Related Work
In this section, firstly, we briefly review several related graph definitions; secondly, HL-DPC algorithms [23] should be reviewed shortly because it is used to compute cycles of digraphs; thirdly, FR algorithm [24], a standard force-directed algorithm, also should be introduced briefly because we take it to draw non-leaf vertices of digraphs.
2.1. Related Graph Definitions
In order to facilitate the descriptions in this paper, related definitions of graph theory are introduced here. A graph may be either directed or undirected. A digraph is a pair , where represents the set of vertices and the set of directed edges. A leaf vertex is a vertex with degree one. A universal vertex is a vertex that is adjacent to every other vertex in the graph. A star vertex is a vertex that is adjacent to several leaf vertices. A star vertex and its adjacent leaf vertices can derive a star-subgraph. If a closed path is with no repetitions of vertices and edges, then the path is called a directed cycle. As the two notions, leaf vertices and subgraphs, are involved in this work, related definitions are also introduced as follows.
Definition 1 (see [39]). Let be a simple graph. The subgraph induced by a subset of the vertex set is the graph , where the edge set contains an edge in if and only if both endpoints of this edge are in .
Definition 2. Let be a digraph, with the set of vertices and the set of edges, where . The number of leaf vertices associated with is denoted by .
Definition 3. Let be a digraph. The number of leaf vertices in is denoted by . Then the proportion of leaf vertices in is denoted by , which is calculated by
2.2. HL-DPC Algorithms [23]
One of the purposes of this paper is to draw cycles as symmetric as possible. The precondition of drawing cycles is finding cycles. In [23], HL-DPC algorithm is proposed to find cycles from strongly connected components (SCCs) with 3 vertices at least which is proven to contain cycles certainly. The main idea of the HL-DPC algorithm is to conduct heuristic DFS to a given SCC which is found from a digraph via Tarjan’s algorithm [40]. There are two pieces of heuristic information to decide whether DFS is forward or backward and control the process of DFS on choosing vertices. A stack is used for recording the vertices visited by heuristic DFS. If a vertex belonging to is visited again but the size of does not meet the experimental threshold, then would be removed from . DFS continues to run from the top vertex in until visiting vertex is visited again and the size of meets an experimental threshold. Then a cycle is asserted to be found.
The two pieces of heuristic information used in HL-DPC algorithm are introduced as follows. Firstly, a direction parameter is introduced to decide whether DFS is forward or backward.
Definition 4 (see [23]). Let be a digraph. is a SCC of with 3 vertices at least. A direction parameter, , is defined by
In (2), and are the number of outgoing edges and incoming edges adjacent to vertex in the SCC, respectively. Then according to the value of , the direction of DFS can be determined by the corresponding formula in [23]. The experiments in [23] also show that the proposed parameter is necessary and useful.
Secondly, DFS will visit neighbor vertex with maximum and of visited vertex . The second heuristic information is also proved to be necessary by corresponding experiments in [23].
2.3. FR Algorithm [24]
In this paper, we take a standard force-directed algorithm as a part of our methods. It is necessary to review it briefly. Force-directed algorithms model the graph drawing problem by calculating attractive and repulsive forces between vertices. Optimal drawing would be achieved when the energy of system descends to the minimum. Force-directed algorithms can produce appealing drawings for most graphs and display isomorphic and symmetric substructures. Although there is a drawback of high runtime compared to other graph drawing algorithms, force-directed algorithms still dominate the algorithms of graph drawing. FR algorithm which requires time is one of the most famous force-directed algorithms. It was proposed by Fruchterman and Reingold [24] based on the famous Eades’s spring force-directed [26] model. Although FR is a very simple algorithm, it provides quite excellent results. Even today, after years of its creation, it is still one of the most popular algorithms for graph drawing. In this work, FR algorithm will be used to calculate repulsive and attractive forces between vertices.
Fruchterman and Reingold represented the graph drawing problem by a system of electrically charged vertices connected by some springs. There are only two criteria demanded for a good graph drawing. Connected vertices should be close to each other. Vertices should not be drawn too close to each other.
Certainly FR model also moves vertices according to the attractive and repulsive forces. When the total energy of the system decreases to a minimum, the movement will stop and the best drawing will be achieved. The repulsive force, , exists between any different two vertices and . is inversely proportional to the distance between and . The attractive force, , just exists between linked vertices. is proportional to the square of the distance:where .
In (3), is optimal length [24], or natural spring length [33]. It is calculated by . The constant is found experimentally and restricts the field of moving vertices. And is the distance between vertices and .
Then combined force on a vertex and the total energy of the system are given in (4) and (5), respectively.
where means vertices and are neighboring vertices.
In [17], the author has proved theoretically that changing of parameters does not actually change the minimal energy drawing of the graph but merely scales the drawing from a mathematical point of view.
3. A Symmetric Metric for Graph Drawing
In this section, a new objective symmetric metric based on vertex coordinate calculation is proposed to measure the extent to which the drawings produced by graph drawing algorithms can be considered symmetrical.
Definition 5. Let be a digraph, with the set of vertices and the set of edges, where . In the drawing of , the coordinate of vertex is denoted as (). Vertex and its neighbors can be grouped into a subset of . The barycenter of is denoted as . The center of minimum circumscribed circle, min-circumcenter, of is denoted as . The radius of minimum circumscribed circle, min-circumradius, of is denoted as . Locally, the metric in (6) is used to measure the extent to which the drawing of related to vertex can be considered symmetrical. Note that smaller is better. Globally, the metrics and in (7) are used to measure the extent to which overall drawing can be considered symmetrical. Note that is the primary metric in contrast to . For and , the smaller values are better.
In (6), is the Euclidean distance between and which is easy to be obtained. Firstly, it is needed to explain how the minimum circumscribed circle of a set of several vertices can be determined. The convex hull of the drawing of is found by Graham’s scan [25]. Then three vertices on convex hull are chosen via exhaustive search to determine the minimum circumscribed circle of the drawing of . For the three chosen vertices , the coordinate of min-circumcenter () and the size of min-circumradius of can be determined by
Example 6 is designed to explain how (6) and (7) measure the symmetry of every vertex and overall drawing.
Example 6. Given a digraph , with and , , two different drawings of are shown in Figure 1. And coordinates of vertices in the drawings are also shown.
For vertex , its neighbors and itself can be grouped into a subset of . In drawing 1 (Figure 1(a)) of , one can use computed by (6) to measure the symmetry of vertex . In fact, the computing of is based on the computing of barycenter and the determination of the minimum circumscribed circles. The two operations for drawings 1 and 2 are also shown in Figure 2.
The barycenter of , (), is calculated by

(a) Drawing 1

(b) Drawing 2

(a) Drawing 1

(b) Drawing 2
By exhaustive search, are chosen to determine the minimum circumscribed circles of . Then according to (8), the coordinate of and the size of are calculated by
By (6), one can get . () can also be calculated in a similar way. As vertex () has only one neighbor, the minimum circumscribed circle of is the circle with diameter of the line segment between and its only neighbor. Thus for , the coordinate of its min-circumcenter is identical to the coordinate of its barycenter. As a result, . Finally, one can get that and by (7).
In drawing 2 (Figure 1(b)) of , because the coordinate of min-circumcenter is identical to the coordinate of barycenter for . Similarly, . Finally, one can get and for drawing 2.
The comparison of indicates that drawing 2 (Figure 1(b)) can be considered more symmetric than drawing 1 (Figure 1(a)). This result is in accord with human intuition.
According to Example 6, the proposed metric seems to be effective for measuring the symmetry displayed in different drawings. For a drawing, if a metric is used to measure how symmetric the drawing is, then how do the metric values change with drawing’s rotation and scaling up or down? An example of drawing named is shown in Figure 3(a). Then the rotated and scaled up are shown in Figures 3(b) and 3(c), respectively. From the viewpoint of human intuitive impression on the three drawings in Figure 3, the values of symmetric metric on them should be identical. By computing, the values of and for three drawings in Figure 3 are listed in Table 1. It can be seen that the values of and for three drawings are equal. Furthermore, Proposition 7 proves theoretically that the proposed symmetric metric is robust for rotation and scaled change of drawings.

(a) Original X

(b) Rotated X

(c) Scaled up X
Proposition 7. Let be a digraph and be a drawing of . For an arbitrary vertex in , (6) is used to measure the extent to which neighbors of can be considered to be distributed symmetrically around . And and (7) are used to measure the extent to which can be considered symmetrically. Then, (1) and for would not change if is scaled up or down.(2) and for would not change if is rotated at any angle.
Proof. For arbitrary vertex , its coordinate in is . and its neighbors can be grouped into a subset of . Then . (1)After is scaled up () or down () times, the coordinate of in the scaled changes to be . By algebraic simplification, the coordinates of all vertices and auxiliary points (barycenter and min-circumcenter) change in the same way. Let us calculate the value of for in the scaled according to (6) and (8). It is straightforward that and . Thus, This indicates that is robust for scaled drawings. Finally, according to (7), robustness of decides the robustness of and . In a word, and for would not change if is scaled up or down.(2)After is rotated at angle , the coordinate of in the rotated changes to be . By algebraic simplification, the coordinates of all vertices and auxiliary points (barycenter and min-circumcenter) change in the same way. Let us calculate the value of for in the rotated according to (6) and (8). By algebraic simplification again, it can be got that and . Thus, This means that is robust for drawing’s rotation at any angle. Globally, robustness of decides the robustness of and . In a word, and for would not change if is rotated at any angle.
4. Proposed Approach
In this section, a force-directed algorithm called FDS is proposed to draw digraphs containing cycles and subgraphs symmetrically and conspicuously. The key term of FDS algorithm is “circle” which is the most symmetrical geometric figure and can be eye-catching from overall drawings. Thus FDS algorithm tries to draw cycle vertices and leaf vertices belonging to star-subgraphs as various kinds of circles which can display most of symmetry from the two structures. The basic idea of FDS is as follows: firstly, use HL-DPC algorithm [23] to discover cycles of digraphs, and a cycle drawing algorithm based on circle placement (CD-CP) is proposed as a subalgorithm of FDS. CD-CP algorithm can fix the cycle vertices on equal amount of highlighted circles which provide a fixed scaffolding to overall drawings. Secondly, a standard force-directed algorithm, FR algorithm [24], is taken to deal with non-leaf vertices. Thirdly, a leaf vertices distribution algorithm (LD) is proposed as a subalgorithm of FDS. LD algorithm can distribute leaf vertices evenly around the centers of star-subgraphs, star vertices, so that the drawings of star-subgraphs are symmetrical. The advantages of FDS algorithm on drawing cycles and star-subgraphs symmetrically are mainly from three aspects: CD-CP algorithm can not only distribute cycle as circles but also highlight them so that cycles are displayed symmetrically and conspicuously; the scaffolding strategy is utilized in FDS algorithm for maintaining the symmetry of cycles displayed in overall drawings; LD algorithm can distribute leaf vertices belonging star-subgraphs most symmetrically by cost of few time.
4.1. A Cycle Drawing Algorithm Based on Circle Placement (CD-CP)
In Table 2, two different drawings of a cycle are listed. By comparing and of one drawing with that of another drawing, it is found that the drawing in which four cycle vertices are arranged on a circle displays more symmetry of the cycle and is more appealing than another. Therefore, in this paper, all cycle vertices are fixed on the same amount as circles with cycle edges being highlighted.
Cycles must be detected before displaying. Thus HL-DPC algorithm [23] is used to detect cycles in digraphs. In the next, it should be elaborated how to place cycle vertices on circles and determined what sizes and location of circles are. If there is only one cycle , vertices belonging to are placed evenly on a circle centered at coordinate (0,0), e.g., the cycle in Figure 4(a). If there are () cycles, points are selected evenly on the circle centered at coordinate (0,0), then cycle vertices are placed evenly on the circle centered at points selected, e.g., the three cycles in Figure 4(b). It is noteworthy that all of cycle edges are set to be 3 times thick of original size so that cycle can be distinguished easily from overall drawing. According to the above description, CD-CP algorithm is proposed as Algorithm 1.
| ||||||||||||||||||||||||||||||||||||||||||||||

(a) To draw a digraph containing 1 cycle by placing cycle vertices on a circle

(b) To draw a digraph containing 3 cycles by placing cycle vertices on 3 circles. Blue circle and dots are aides for understanding the placement
4.2. Leaf Vertices Distribution Algorithm (LD)
In order to display star-subgraphs symmetrically, a leaf vertices distribution algorithm (LD) is designed to provide concentric circles on which leaf vertices belonging to star-subgraphs can be placed. LD algorithm is proposed based on three calculation steps.
Given a star vertex connecting several leaf vertices, then,(1)count the number of leaf vertices for ;(2)calculate the number of leaf vertices that can be placed on every layer of concentric circle around ;(3)calculate the number of concentric circles needed by .
The first step is to count the number of leaf vertices for : that is, .
The second step is to calculate the number of leaf vertices that can be placed on every layer of concentric circle around .
At first, three notations are introduced. In a drawing, every vertex is drawn to be a solid circle. The radius of the solid circle of is denoted as . The radius of every leaf vertex is . The distance between borders of leaf vertex and is . Generally, the values of and are known already. And can be set artificially to be equal to . Consequently, the radius of 1st layer circle is .
In Figure 5(a), it can be seen that one leaf vertex occupies angle of 2 in . Then the number of leaf vertices that can be placed on the 1st layer circle around , , can be calculated by (13a). Analogously, the radius of the 2nd layer circle is as Figure 5(b). And the number of leaf vertices that can be placed on 2nd layer circle around is . Thus, it can be induced that ( is a positive integer) leaf vertices can be placed on the lth circle. And can be calculated by (13b). Generally, is an integer multiple of in practical drawings. Therefore, a more simplified (13c) is proposed to replace (13b).where is the largest integer not greater than .

(a) The number of leaf vertices can be placed on 1st layer circle around

(b) The number of leaf vertices can be placed on 2nd layer circle around
The third step is to calculate the number of concentric circles needed by .
The number of concentric circles needed by is actually the maximum value of , denoted as . Considering the condition of known and leaf_number(i), and the fact that the number of leaf vertices on every concentric circle can form an arithmetic sequence, can be calculated by (14) based on the fact that is less than or equal to the total number of leaf vertices that can be placed on concentric circles.where is the least integer greater than .
It is noteworthy that the number of leaf vertices needed to be placed on the last layer circle may not be equal to the number leaf vertices that can be placed on the last layer circle. After placement of leaf vertices on the th layer circle, the number of leaf vertices not placed yet can be calculated by
These three calculation steps bring up LD algorithm as Algorithm 2.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4.3. Proposed FDS Algorithm
The proposed CD-CP and LD algorithms can draw cycles and star-subgraphs symmetrically locally. However, there are probably other vertices which are neither cycle vertices nor leaf vertices in practical datasets. For these vertices, FR [24] algorithm is taken as its good performance on aesthetics balance. Finally, HL-DPC [23], CD-CP, FR, and LD algorithms are integrated into a whole algorithm called FDS which can draw digraphs symmetrically globally.
Related definitions and propositions needed for introducing FDS algorithm are given below.
Definition 8. Let be a digraph, with the set of vertices and the set of edges. is the force-subgraph of . The mathematical descriptions of and are as (16a) and (16b), respectively. Let be the proportion of vertices belonging to in and be the proportion of edges belonging to in . and can be calculated by (16c) and (16d), respectively.where deg() is degree of vertex , is source vertex of edge , and is target vertex of edge .
Proposition 9. Let be a digraph, with the set of vertices and the set of edges. Then .
Proof. It is easy to get that according to (16b). Then one can also get by (1) and by (16c). Finally, .
FDS algorithm applies forces only on non-leaf vertices. Note that cycle vertices always hold positions even though they are pulled or pushed by forces as cycle vertices must be non-leaf vertices. Finally, FDS algorithm is shown as Algorithm 3.
| ||||||||||||||
The time complexity of FDS algorithm is contributed by all five steps. For every cycle vertex, its coordinate needs to be calculated only once in Step 2. For every star vertex, its coordinate also needs to be calculated only once in Step 5. The function of Step 3 is to find the force-subgraph according to the vertex degree. Thus, Steps 2, 3, and 5 are linear, and the worst time complexity of them is . According to [23], at best the time complexity of Step 1 (HL-DPC algorithm) would be ; at worst it would be . is given in (17). In (17), the direction parameter is defined in Definition 4. The time complexity of Step 4 (FR algorithm) would be . Thus, the time complexity of FDS algorithm would be between and . For a digraph , besides the size of , practical time cost of FDS algorithm is also influenced by three indexes, the proportions of cycle, leaf, and non-leaf vertices.
5. Experimental Results
In total, 26 different relational datasets containing 6-50001 vertices are chosen to test related algorithms. 14 man-made datasets are used to test the proposed FDS algorithm when it is dominated by LD and CD-CP algorithms, respectively. 2 datasets are from the Gephi Chinese Tutorial [41], labeled as GCT; 1 dataset is collected by us in practical network, labeled as collected; 9 datasets are from the University of Florida Sparse Matrix Collection [42], labeled as sociology, biology, citation, sport, genealogy, response, and voting. Details of 26 datasets are listed in Table 3. The relational data used to support the findings of this study have been deposited in the Figshare repository (https://figshare.com/s/3cc5b3449b334aba2461) and are also available from the corresponding author upon request.
All algorithms are implemented in NetBeans IDE 8.0.1, under the Gephi 0.8.2 development kit. The configuration of experiments is operating system, WIN7, CPU, Intel(R) Core(TM) i5-4590 Quad CPU 3.30GHZ, Memory, 4G. In this section, three algorithms are chosen to compare to the FDS algorithm proposed in this paper, which are the classical FR algorithm (FR) [24], the recent ForceAtlas2 algorithm (FA2) [29], and multilevel YifanHu algorithm (YFHu) [17].
About the parameter settings, firstly, the parameter is used in HL-DPC which is a subalgorithm of FDS algorithm. The parameter works only if there exists (SCC with 3 vertices at least) in digraphs. For the digraphs in Table 3, only 12 digraphs of them contain so that it is required to set parameter for them experimentally. The values of for the 12 datasets are listed in Table 4. The role of parameter is to provide the threshold for the procedure of heuristic DFS in HL-DPC algorithm. The threshold is calculated by . If is set too large, then the threshold is larger than the number of vertices belonging to the cycle in , which would cause that the cycle can not be found. If is set too small, then the threshold is smaller than the number of vertices belonging to the cycle in , which might cause that the size of the found cycle is smaller than the size of the cycle in . In general, we need to set the value of for every because it is nearly impossible that there are two that are isomorphic. For example, there are two in the digraph of dataset Ooof-email, and we set to be 0.38 for first and 0.7 for second . In Table 4, if the value of is , that means the value of has no impact on finding cycles of corresponding . In addition, FDS algorithm proposed in this paper is a force-directed method, and one part of FDS is FR algorithm. Thus some parameters related to force-directed algorithms also should be considered. In this paper, all algorithms are implemented in the software of Gephi 0.8.2. In order to compare FDS algorithm fairly to other algorithms, default parameter settings in Gephi 0.8.2 are used for FA2, YFHu, and FR algorithms. In particular, FDS takes same value of parameter “speed” as that of other two algorithms (FA2 and FR) because “speed” affects the efficiency of these force-directed algorithms.
16 drawings of 4 datasets (O, Stranke94, Cage3, and Cage4) are listed in Table 5, which are produced by FA2, YFHu, FR, and FDS algorithms, respectively. For the 4 datasets, all vertices belong to cycles. Thus the main goal of drawing these 4 datasets is to display cycles symmetrically. The symmetric measurement and time consumption of these 16 drawings are then listed in Table 6. In Table 6, optimal values of , , and time are bold conspicuously. According to human perception and the values of in Table 6, drawings produced by FDS are more symmetrical than those produced by other 3 algorithms. In addition, FDS spends less time than other 3 algorithms. In a word, FDS can produce more symmetrical drawings with less time consumption than other 3 algorithms for these 4 datasets.
12 datasets (Twitter07 and B, C, , L) are also used to test these four algorithms. There are only two kinds of vertices, leaf and star vertices, in these 12 datasets. Thus the main goal of drawing these 12 datasets is to display star-subgraphs symmetrically. 4 drawings of the typical dataset Twitter07 are listed in Table 7, which are produced by FA2, YFHu, FR, and FDS algorithms, respectively. The symmetric measurement and time consumption of these 4 drawings are listed in Table 7. In Table 7, optimal values of , , and time are bold conspicuously. No matter from the viewpoint of human intuition or according to the values of , it can be seen that the drawing produced by FDS is most symmetrical. FDS spent so few time that can even be ignored.
Except for dataset Twitter07, changes of and time consumption of 43 drawings for other 11 datasets (B, C, , L) are shown in Figures 6(a) and 6(b), respectively. It can be seen that the drawings produced by FDS show their undoubted advantages on displaying symmetry () and efficiency (time). In a word, FDS can produce very symmetrical drawings within much less time than other 3 algorithms when datasets contain large proportion of leaf vertices.

(a) Changes of

(b) Changes of time consumption
Unlike dataset Twitter07 drawn in Table 7 and datasets B-L involved in Figure 6, in many practical datasets, not all vertices belong to star-subgraphs. For dataset 1, for example, forces on many vertices have to be calculated although it contains many leaf vertices. 4 drawings produced by FA2, YFHu, FR, and FDS algorithms for dataset 1 are listed in Table 8. The symmetric measurement and time consumption of them are also listed. It can be seen that FDS provided best drawing for dataset 1 within shortest time. Compared to the drawing produced by FDS, the drawings produced by FA2 and YFHu did not display relationships between non-leaf vertices clearly enough although they displayed star-subgraphs symmetrically. And in the drawing produced by FR, star-subgraphs take up oversized area although relationships between vertices are displayed clearly.
In datasets M, Tina_DisCal, GD01_b, and Ragusa18, there are only a few vertices to which attractive and repulsive forces need to be calculated besides cycle vertices. Their drawings produced by the 4 algorithms are listed in Table 9. The symmetric measurement and time spent of the 16 drawings are listed in Table 10. It can be seen that the drawings produced by FDS have displayed cycles conspicuously and symmetrically. In addition, FDS algorithm provides performance comparable to YFHu algorithm [17] according to time consumption listed in Table 10.
In datasets N, Ooof-email, EPA, and EVA, there are both cycles and star-subgraphs. 16 drawings produced by 4 algorithms for the 4 datasets are listed in Table 11. The symmetric measurement and time spent of them are listed in Table 12. It can be seen that cycles in the 4 datasets are drawn symmetrically and conspicuously by FDS. As the directed edges are displayed as straight line, thus cycles are displayed as regular polygons. For example, there are two cycles in dataset Ooof-email and one cycle in dataset EVA, which are displayed as the regular triangle, the regular heptagon, and the square in corresponding drawings of Table 11. Compared to other 3 algorithms, star-subgraphs in the 4 datasets are drawn symmetrically by FDS with taking moderate-size area. The values of listed in Table 12 also show the advantage of FDS on display of symmetry. According to time consumption recorded in Table 12, FDS can produce symmetrical drawings with taking comparable time to YFHu algorithm.
There may be a concern that FDS algorithm would force nonsymmetric digraphs into symmetric drawings. The experiments on dataset football (Table 13) can be used to clarify it. There is neither cycles nor star-subgraphs in dataset football so no much symmetry is needed to be drawn. In contrast to earlier experiments, it is the drawing produced by FR not the drawing produced by FDS which achieves the best value of . Furthermore, the drawing produced by FDS spends least time maybe because there are 3 leaf vertices on which FDS does not have to calculate forces.
Furthermore, the comparisons of time consumption of these 4 algorithms on 12 practical datasets (Cage3, Cage4, Stranke94, Tina_DisCal, GD01_b, Ragusa18, football, Ooof-email, 1, Twitter07, EPA, and EVA) are also shown in Figure 7. It can be seen that FDS (blue line) provides performance comparable to YFHu (cyan line) algorithm with time complexity .

6. Conclusion and Future Work
In this paper, an objective symmetric metric is proposed based on vertex coordinate calculation to measure the extent to which drawings can be considered symmetric. The results of measurement by the proposed metric are consistent with human intuition. In addition, the metric can measure symmetries rapidly because it does not involve automorphisms which is computational hardly. Furthermore, the metric is proven theoretically and experimentally to be robust for rotation and scaled change of drawings. And the robustness conforms to human perception of symmetry.
In order to display star-subgraphs and cycles symmetrically, a force-directed algorithm called FDS is proposed. The ability of FDS algorithm to display symmetry is validated by several groups of experimental tests. FDS algorithm’s time consumption is comparable to YFHu algorithm with time complexity . In some special datasets of which displaying of star-subgraphs is main goal, FDS spends much less time than YFHu algorithm. Note that FDS algorithm can only perform its advantage to the digraphs containing star-subgraphs and cycles because FDS algorithm is committed to display the symmetry of star-subgraphs and cycles in drawings. If one applies FDS algorithm to the digraphs which do not contain star-subgraphs and cycles, FDS algorithm would degenerate into FR algorithm without negative impact, which means FDS algorithm would not force nonsymmetric digraphs into symmetric drawings. Corresponding experimental results also verified this conclusion. Thus, the applicable conditions of FDS algorithm are the existence of star-subgraphs or cycles in digraphs.
In future, we may try to use other methods (e.g., distribution entropy) to construct another objective metric on symmetry. Although the FDS algorithm proposed in this paper only focus on drawing two structures, cycles and star-subgraphs, symmetrically, FDS algorithm has impossible impact. It can provide reference and guidance for designing other similar methods for drawing other graph structures, having inherent symmetry, symmetrically. Besides, it should be noted that FR algorithm is used in FDS algorithm because its good performance on aesthetics balance, though it requires calculations. One may speed up FDS algorithm by replacing FR with other methods without sacrifice of aesthetics.
Data Availability
The relational data used to support the findings of this study have been deposited in the Figshare repository (https://figshare.com/s/3cc5b3449b334aba2461) and are also available from the corresponding author upon request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
Acknowledgments
The authors would like to thank LiuYong for providing two datasets Ooof-email and Twitter07, Wang Fei for the help on programme. This work was supported by the Qian Education Cooperation (KY No. 318), Qian Science and Technology Cooperation (LH No. 7011), and Chongqing Research Program of Basic Research and Frontier Technology (cstc2017jcyjAX0144).