A Simple Method for Network Visualization

: In this article, we present a simple method for network visualization. The proposed method is based on distmesh [P.O. Persson and G. Strang, A simple mesh generator in MATLAB, SIAM Review 46 (2004) pp. 329–345], which is a simple unstructured triangular mesh generator for geometries represented by a signed distance function. We demonstrate a good performance of the proposed algorithm through several network visualization examples.


Introduction
Since the formation of society, the relationships between its components have been significant. These relationships become more complex as society progresses; in addition, the components of society have also diversified. In sociology, a bundle of relationships is referred to as a network, which became a central concept in sociology in the 1970s. In a modern society called an information society, we have information regarding networks that has been transformed into concrete data. With a vast amount of information, information visualization has been used to analyze network and is gaining popularity. Techniques for information visualization have evolved, and they vary depending on the type of data [1][2][3][4]. Among the methods, visualization using graphs is one of the most helpful for understanding data and their relationships. The authors in [5] showed various graphs used in information visualization including tree layouts, H-tree layouts, balloon layout, radial layout, hyperbolic trees, fisheye graphs, and animated radial layouts (see Figure 1 as an example of network plot). Furthermore, toolkits for information visualization such as Prefuse, Protovis, and GUESS have been developed and widely used [1,[6][7][8]. In several studies, nodes represent subjects, such as people and businesses, whereas edges represent relationships, such as friendships and partnerships. The scope of a network is not limited to people and institutions: if something is in an interactive relationship, we can call it a network, and networks can be also graphically identified by data. Network visualization is therefore being used in a variety of fields. For example, analysis for social and personal networks [9], pharmacological networks [10], biological networks [11,12], financial networks [13], and street networks [14] have been actively conducted. Automatically drawing a network diagram requires algorithms. One of such algorithms is a classical force-directed algorithm that employs straight-edges. The force-directed algorithm treats edges as springs [16]. This algorithm turned the graph representation problem into a mathematical optimization problem. In other words, by reducing the energy generated by the spring system, we can find the equilibrium of the graph. The force-directed method has advantages such as simplicity to use and a good theoretical basis. As a result, many new methods of graph representation have been developed based on the method. As a typical example, Kamada and Kawai introduced an ideal distance for drawing graphs [17]. Let {X 1 , X 2 , . . . , X n } be n-vertices and assume that they are spring-connected. The total energy of the spring is then expressed as follows: where l ij is the desirable length of the spring between X i and X j , k ij is a parameter representing the strength of this spring, and | · | is the Euclidean norm. The desirable length represents the final length after executing the algorithm, and the strength of the spring refers to the tension of the spring keeping certain distance. The best graph is determined by minimizing E . Please refer to [17] for more details about the algorithm and parameter definition. Another approach for automatically drawing a network diagram is based on the algorithm presented by Hall [18]. The main idea of this algorithm is to find the position of nodes {X 1 , X 2 , . . . , where a ij ≥ 0 is the connection weight between X i and X j . This algorithm is suitable for application to a structured data such as polyhedron [19]. However, it may not work well on actual data [20]. Rücker and Schwarzer et al. [20] introduced a method of automatically drawing network diagrams using graph theory and studied network meta-analysis. Furthermore, the algorithm was applied to a variety of examples from the literature. Another representative method for drawing network diagrams is the stress majorization [21]. The objective function is defined as follows: where w ij is the weight between X i and X j , and d ij is an ideal distance. For additional details about the algorithm, please refer to [21]. This algorithm was applied to real networks related to diseases and implemented by using the function netgraph in the R package netmeta [20]. We propose a simple algorithm for network visualization based on the distmesh algorithm [22] in this paper. The proposed method employs a distance d ij , which is given by a reciprocal of weight w ij , hence the computing process is essentially simple. Furthermore, the position of nodes is renewed proportionally by the net force, which is based on the gradient, therefore one can obtain an optimal diagram to the given data. A two-step stopping criterion is applied to further maximize the visual effect of the network diagram. Compared to other methods based on the gradient to optimize total level of movements, for instance, the force-directed method, the stress majorization method, etc., our proposed algorithm is simple to implement.
The contents of this article are organized as follows. In Section 2, the proposed algorithm is described. In Section 3, specific examples of network visualization are presented. Conclusions are presented in Section 4.

Distmesh Algorithm
A brief introduction to the distmesh algorithm [22], which is employed to generate the triangular mesh in domain with the level set representation, is presented in this section. We define the level set representation in the two-dimensional domain which imposes that the interface structure is treated as the zero-level set. The following procedure depicts the whole algorithm of the distmesh. A function ψ(x, y) = x 2 + y 2 − 1 is adopted to a sample level set description. Figure 2 depicts the overall process of distmesh algorithm quite in detail.
Step 1. Generate the random nodes X 0 in domain.
Step 2. Generate a level set function ψ in the bounding box which includes the domain. The boundary of domain is regarded as the zero-level set.
Step 3. Perform the Delaunay triangulation with X n if the maximal arrangement of nodes is greater than certain level. If n = 0, an initial Delaunay triangulation is accomplished. For the next step, compute the net force F in order to update the position of nodes.
Step 4. Renew the position of nodes to X n+1/2 by adding ∆tF.
Step 5. Push back the nodes that are pushed out to the boundary into the interface using the following equation where i is placed outside of the boundary; otherwise 0. Step 6. Repeat Step 3-5 until the level of the total movement of nodes is less than a given tolerance. Using the distmesh algorithm, triangular mesh generation can be performed nonuniformly on domain of various shapes. The following Figure 3 is an example of such generated mesh.

Proposed Algorithm for Network Visualization
The proposed algorithm for network visualization seeks to find {X 1 , X 2 , . . . , X N } that minimize the objective function where w ij and d ij are the weighting value and the desired distance between nodes X i and X j , respectively. The proposed algorithm is based on distmesh [22], which is a simple unstructured triangular mesh generator for geometries represented by a signed distance function. Let {X n 1 , X n 2 , . . . , X n N } be given node positions at iteration n. For simplicity of exposition, we assume 0 ≤ w ij ≤ 1. We then propose the following distance function: where p is a constant. Let minW be the minimum positive value of w ij , i.e., As shown in Figure 4, by setting the minimum distance minD = 1 when w ij = 1 and the maximum distance maxD when w ij = minW, we obtain  Figure 5a and b show repulsive and attractive forces at nodes X n i and X n j when |X n i − X n j | < d ij and |X n i − X n j | > d ij , respectively.
(a) (b) We loop over all the line segments connecting two nodes and compute the net force vector F n i at each node point X n i : Then, we update the position of the node points as where ∆t is an artificial time step. Upon updating the position of the node points, the network diagram is drawn automatically. The iterative algorithm has reached an equilibrium state if after k iterations. As a concrete example, we consider three points X 1 , X 2 , and X 3 . Assume that the weighting matrix between X i and X j is given as We scale the matrix W by dividing the elements by the maximum value among elements and redefine W as , and X 0 3 = ( 3 2 , 0), where the superscript 0 denotes the starting index. Here, we use ∆t = 0.3, minD= 1, maxD= 2, minW= 0.25, and tol 1 = 0.01. Consequently, we get p = 0.5 and    Figure 6a indicates the position of the three points with red markers, and the non-zero elements of W are represented by gray lines. In particular, the values of each element is expressed by the thickness of the line. The red arrows are net force vectors F 0 1 , F 0 2 and F 0 3 . Using these net force vectors, we update the positions as which are shown in Figure 6b. Figure 6c, d, and e show the network diagrams after 2, 3, and 6 iterations, respectively. The equilibrium state of the network diagram is obtained after 10 iterations as shown in Figure 6f. Even though the nodes are initially arranged in an equilateral triangle with sides of length 1.5, the network diagram in equilibrium is drawn according to the given weights.

Numerical Results
In this section, we present the generation of a network diagram with more data to confirm the efficiency and robustness of the proposed method. Specifically, we select 19 nodes and 19 × 19 matrix W, which are given in Appendix A. The matrix is created based on the dialogue between the characters in William Shakespeare's play, 'The Venice Merchant'. Each element w ij of the matrix is the cumulative number of conversations between person i and person j. The parameters used are ∆t = 0.01, minD = 1, maxD = 2, and tol 1 = 0.01. The value of p is then approximately 0.1879. Figure 7 shows process of the network visualization by our proposed method. The equilibrium state of the network diagram appears after 1985 iterations.
After 1985 iterations, each node is appropriately located according to the weights between the nodes in the network. This means that even if the nodes are initially randomly arranged, the network diagram is well drawn by our distance function. While the network plot is drawn, we can see that the objective function E is decreasing. As shown in Figure 8, E decreases and converges as time goes by. This shows that our proposed method has a mathematical basis for drawing the network diagram.  However, the equilibrium state network diagram is not visually good. This is due to the nodes (9,13,15,16,17,18) that have only one connection. Therefore, we further update the location of the nodes that have only one connection while fixing the other nodes. Let Ω s be the index set of the nodes having only one connection. We compute the net force vector F n i at each node point i ∈ Ω s as follows: Then, we temporally update the node points as where ∆t = 10 is used. Finally, we set where X n j is the unique node connecting X * i . We define that the equilibrium state of the second step has been attained if after k iterations, where |Ω s | is the counting measure. Here, tol 2 = 0.002 is used. Therefore, the second step effectively rotates the node that has only one connection around the connecting node so that the overall distribution of the nodes is scattered. Figure 9 illustrates the process of updating the position of nodes (red makers) that have only one connection. Figure 9a-d shows the network in the equilibrium state of the first step, after 1 iteration of the second step, after 2 iterations of the second step, and in the equilibrium state of the second step after 75 iterations.  Next, we consider another example 'Romeo and Juliet' which is a play written by William Shakespeare. Matrix W is defined by counting the number of conversations between 27 characters. The parameters used are minD = 1, maxD = 3, and tol 1 = tol 2 = 0.002, and then the value of p is approximately 0.2493. In particular, time step ∆t = 0.2 and ∆t = 10 are used in the first step and the second step, respectively. Figure 10a-c illustrate the character network at the initial condition, after the first step, and after the second step, respectively. From the results, we can find the main characters and relatively small parts.

Conclusions
In this paper, we have proposed a simple method based on distmesh for network visualization. We have demonstrated the good performance of the proposed algorithm through network visualization examples. We can provide the MATLAB source code of this method for the interested readers. In future work, we plan to investigate effective network diagrams for character networks from novels and movies. We may further speed up the computation of the proposed method by using a Gauss-Newton-secant type method [23].
Author Contributions: All authors contributed equally to this work; J.P., S.Y., C.L. and J.K. critically reviewed the manuscript. All authors have read and agree to the published version of the manuscript.

Funding:
The corresponding author (J. Kim) expresses thanks for the support from the BK21 PLUS program.

Acknowledgments:
The authors thank the editor and the reviewers for their constructive and helpful comments on the revision of this article.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A
In this appendix, we provide the MATLAB source codes for network visualization. The following code is for 'The Merchant of Venice'. The code for 'Romeo and Juliet' is available on the following website: