#### Abstract

The network is a concept that can be seen a lot in many areas of research. It is used to describe and interpret datasets in various fields such as social network, biological network, and metabolic regulation network. As a result, network diagrams appeared in various forms, and methods for visualizing the network information are being developed. In this article, we present a simple method with a weight of information data to visualize the network diagram for the three-dimensional (3D) network. The generic method of network visualization is a circular representation with many intersections. When dealing with a lot of data, the three-dimensional network graphics, which can be rotated, are easier to analyze than the two-dimensional (2D) network. The proposed algorithm focuses on visualizing three factors: the position and size of the nodes and the thickness of the edge between linked nodes. In the proposed method, an objective function is defined, which consists of two parts to locate the nodes: (i) a constraint for given distance, which is the weight of the relationship among all the data, and (ii) the mutual repulsive force among the given nodes. We apply the gradient descent method to minimize the objective function. The size of the nodes and the thickness of the edges are defined by using the weight of each node and the weight between other nodes associated with it, respectively. To demonstrate the performance of the proposed algorithm, the relationships of the characters in the two novels are visualized using 3D network diagram.

#### 1. Introduction

The network is a vital concept to understand modern society structure and components of the society. The concept of the network has been applied not only to people but also to social network [1–7], biological network [8–12], metabolic regulation network [13], online social network [14, 15], sports social network [16, 17], structure of neural network [18–20], etc. As a result, the data for storing network information has become complex and diverse. In addition, the need to make complex data more recognizable has been essential, and efforts to meet such demands continue to this day. Therefore, a medium called a network diagram has emerged, which has become essential to understand network information. Network diagrams have appeared in various forms in two-dimensional (2D) and three-dimensional (3D) space. In addition, various methods and programs for drawing such diagrams or visualizing network information have appeared and developed.

In 2D space, the classical algorithm to draw the network automatically is the force-directed algorithm using the straight edges as springs [21]. This algorithm draws aesthetic graphs using only the information of a given graph. Teja and Yemula [22] modified and improved the force-directed algorithm to solve the limitation of the algorithm. Another algorithm for drawing graphs is stress majorization [23], which is widely used. Recently, the authors in [24] proposed an improved stress majorization method. Moreover, this method has an advantage that there is no need to solve the optimization problem with constraints. However, it is not easy to grasp the network in 2D space, and there are needs for the network plot in 3D space.

There are various tools and techniques for network visualization in 3D space. The author in [25] used a Java-based tool called CAVALIER (Communication and Activity VisuALIsation for the EnterRprise) to analyze the social network. In addition, the spring-embedding and alternative layout algorithm was introduced for network visualization. Ho et al. [26] studied the interactions between proteins in 3D diagrams. These visualizations help users to understand the biological process and relationships easily. In [27], the authors proposed a novel visualization tool named Arena3D that could address large scale and complex networks. They demonstrated the utility of Arena3D using network data relevant to Huntington disease. Paananen and Wong [28] presented a new visualization method based on real-time 3D force-directed graphs that can be used to discover new knowledge in the data. They also created and used a software tool which is called FORG3D. By using the given genomic data, they proved the functionality of FORG3D to visualize and explore unified genome-scale data. In [29], the authors developed the evidence network visualization algorithm with the exploration of covariate distribution for network meta-analysis (NMA) in 3D. This algorithm extended the *z*-axis to the generic 2D network to display the covariate bars for each trial, placing the covariate bars for each information data at the edge between the nodes involved.

In this article, we present a simple method with weight of information data to visualize the network diagram for 3D, and the rotatable 3D network diagram can be obtained to analyze data more easily. While the proposed method is an extension of the method applied in 2D [30], it is further improved in terms of the simplicity of the algorithm. In general, the problem is solved in a regular structure [31–36]; however, we visualized the network using the importance of information and concept of distance in the unstructured place. Furthermore, the position of nodes is relocated by minimizing an objective function which consists of repulsive and attractive energies. The gradient descent method is applied to minimize the objective function. Therefore, an optimal network diagram to the given data is obtained. The proposed method has advantages over other methods for visualizing networks in terms of simplicity.

The composition of this paper consists of the following order. Section 2 describes the proposed algorithm in detail. In Section 3, to demonstrate the performance of the proposed algorithm, 3D network diagram visualizations of the relationship of characters in two novels are presented. Finally, conclusions are made in Section 4.

#### 2. Numerical Algorithm

##### 2.1. Simple Network Visualization Algorithm

The purpose of the proposed algorithm for network visualization in 3D is to find optimal node positions which minimize the following objective function:where is the normalized weight of the relationship between nodes and and is defined as if ; otherwise, . In addition, is the strength parameter that keeps and away from each other. For the simplicity, is assumed. The distance function for can be used as follows [30]:where is a nonnegative constant, and then, . Let and be the maximum and minimum distances, respectively. Then, by the definition of the normalized weight, , and for a given value, the nonnegative constant is defined as follows:where is the minimum positive value of , i.e.,

For example, if and , then is obtained approximately as follows:

Figure 1 shows the distance function using given normalized weight and maximum distance values.

Let be the set of positions of given nodes at iteration . Figure 2 shows the effect of the first term of the objective function . There are two possible cases of forces at nodes and : repulsive force when and attractive force when .

**(a)**

**(b)**

The second term of the objective function produces the mutual repulsive forces between and , see Figure 3. The effect of this force places nodes with low weight outward in the network. In other words, nodes with small weights are positioned outside the main network diagram.

**(a)**

**(b)**

**(c)**

Then, we relocate the position of the node points aswhere is an artificial temporal step and is the differentiation of equation (1) with respect to , i.e.,

Once the positions of the nodes are renewed, then the network diagram is plotted automatically. The iterative process will be terminated if the process reaches an equilibrium state, i.e.,for and for some . For example, let us consider four points , , , and . Furthermore, assume that the weighting matrix between and is given as

Let the matrix be redefined by dividing all the elements of by the largest value among the elements of the given . That is,

We take and get because :

Let , , , and be the initial positions of four nodes, where the superscript 0 denotes the starting index. We use , , and . In Figure 4, the node markers and edges are depicted by sphere and gray lines, respectively. Here, the red and blue spheres mean initial and after 1 iteration positions, respectively. Figure 4(a) shows the initial state consisting of four points with red spheres and gray edges of linked nodes using scaled . Note that the values of each element of are represented by the thickness of connecting lines in the diagram. In Figure 4(b), black arrows indicate the force direction acting on each node. The red arrows in Figure 4(c) are net force vectors , and . Using net force vectors, we update the positions of nodes as follows:

**(a)**

**(b)**

**(c)**

**(d)**

Figure 4(d) shows the network diagrams after 1 iteration. The nodes are initially located in a tetrahedron, and the network diagram is drawn according to the given weights.

So far we have only considered the positions of nodes, now we discuss the visualization of nodes and edges. In general, nodes and edges are visualized as unit sphere shape and straight lines with a fixed thickness. We visualize the size of the nodes and the thickness of edges according to the weight of each node as follows:where and are positive constants. Characters with relatively high activity are indicated by larger nodes; meanwhile, relatively intimate relationships are depicted by thicker edges.

#### 3. Numerical Results

Numerical simulations are conducted to demonstrate the performance of the proposed algorithm and to visualize the relationship examples of characters in two novels in the 3D network diagram. The first example is “The Venice Merchant” and the second example is “Romeo and Juliet,” which are William Shakespeare’s representative plays. The elements of the weighting matrix are set based on the number of conversations between the characters in each novel.

In the first novel, let of the characters to make the weighting matrix , which is provided in Appendix. Each element of means the cumulative number of dialogues between characters and . The parameters are given as , , , and . Then, is obtained. As shown in Figure 5, the motion of nodes and edges can be observed from the initial state where the nodes are randomly located until the optimal network diagram is found by applying the proposed algorithm repeatedly. The proposed algorithm for “The Venice Merchant” data reached the equilibrium state at 828 iterations.

**(a)**

**(b)**

**(c)**

**(d)**

Figure 6 shows a diagram of the network in the equilibrium of the iterative algorithm for “The Venice Merchant” dataset. The equilibrium state means that all nodes are properly located according to the weights of a given network. Assortativity refers to the tendency of nodes in a network being connected with similar sized nodes. Therefore, highly assortativity networks are clearly shown to have a core periphery structure between nodes with large and small sizes. These characteristics mean that the basic structure of the interaction that makes up the story of the novel is centered on the main characters. Figure 6, therefore, shows that “The Venice Merchant” has a high assortativity, that is, a novel property that revolves around the main character. As the nodes move, we can confirm that the objective function decreases, as shown in Figure 7.

As a second example, let of the characters to set the weighting matrix which is based on the number of conversations between 26 characters in “Romeo and Juliet.” This data is provided in Appendix. The parameters are given as and , and then, the value of is about 0.3652. In addition, time step and are used. Figure 8 shows the process of finding the optimal network plot by applying the proposed algorithm. The proposed algorithm for “Romeo and Juliet” data reached the equilibrium state at 617 iterations.

**(a)**

**(b)**

**(c)**

**(d)**

Figure 9 shows the network plot of the equilibrium state of the iterative algorithm for the “Romeo and Juliet” dataset. From the results, we can quickly and easily grasp the relationship among characters and see the high assortativity. Furthermore, we can confirm that the objective function decreases and converges during the process of finding the optimal position for all nodes. Figure 10 depicts the decreasing of the objective function.

#### 4. Conclusion

We proposed a simple method for 3D network diagrams in this article. The proposed method had the advantage of being drawn only with information from a given network. We used the distance function based on the network information and objective function. To minimize the proposed objective function, we used the gradient descent method and confirmed the energy dissipation. According to the given relationship, the network diagrams own various characteristics: (i) different sizes of nodes and (ii) different thickness of edges. Through specific examples, we have known that these features help us to grasp network information at a glance. Furthermore, our algorithm is simple to understand and implement. Finally, the MATLAB source code of our algorithm is provided for the interested readers to try.

Social distancing and contact tracing can contribute to curbing the spread of the COVID-19 virus. Research on SARS-COV-2 transmission control strategies in actual social networks using GPS or mobile data is actively being conducted. In future works, we plan to use the proposed algorithm to present a contact network diagram. Using this diagram, we can visualize the contact network for the dynamics of the COVID-19 spreading.

#### Appendix

In this appendix, we provide the MATLAB source codes of the proposed algorithm for novel data as “The Merchant of Venice” and “Romeo and Juliet,” and Table 1 describes each character name and corresponding node number. The source code is available on the following website: http://elie.Korea.ac.kr/∼cfdkim/codes/.

Here, the weights of each novel data were presented as and in the source code.

clear; flag = 1; if flag = = 1 = ; else if flag = = 2 = ; end = *W*/max (max(*W*)); min*W* = min(min(*W*(*W* > 0))); *N* = size(*W*,1); lbD = 1; ubD = 5; *q* = −log (ubD)/log(min*W*); rand(“seed”,3773); *t*1 = rand(*N*,1); *t*2 = rand(*N*,1); xy = ubD [sin(pi *t*1) cos (2 pi *t*2), sin (pi *t*1) sin (2 pi *t*2), cos (pi *t*1)]; for *i* = 1:*N* for *j* = 1:*N* if *W*(*i, j*) > 0 *d* (*i*, *j*) = 1/*W*(*i*, *j*)^*q*; end end end dt = 0.2; gam = 0.01; tol = 0.001; error = 2tol; *n* = 0; while error ≥ tol *n* = *n* + 1; *F* = zeros(*N*, 3); for *i* = 1 : *N* for *j* = *i* + 1 : *N* if *W*(*i*, *j*) > 0 *vt* = *xy* (*i*, :)-*xy* (*j*, :); *F* (*i*, :) = *F*(*i*, :) - (norm(vt)-*d*(*i*, *j*)) vt/norm (vt); *F* (*j*, :) = *F*(*j*, :) + (norm(vt)-*d*(*i*, *j*)) vt/norm (vt); end end end for *i* = 1:*N* for *j* = 1:*N* if *j*∼ = *i* vt = *xy* (*i*, :)-*xy*(*j*, :); *F*(*i*, :) = *F*(*i*, :) + gamvt/norm(vt); end end end xy = xy + dt*F*; error = norm(dt*F*)/sqrt(*N*); if mod(*n*, 30) = = 0 \Vert error < tol DrawNetwork(xy, *W*); pause(0.1) end end function DrawNetwork(*xy*,*W*) *n* = 20; *x* = linspace(−1.1, 1.1, *n*); *y* = *x*; *z* = *x*; [*xx, yy, zz*] = meshgrid(*x*, *y*, *z*); *u*(1:*n*, 1:*n*, 1:*n*) = 0; for *i* = 1:*n* for *j* = 1:*n* for *k* = 1:*n* *u*(*i*, *j*, *k*) = 1-sqrt(*x*(*i*)^2*y*(*j*)^2*z*(*k*)^2); end end end *N* = length (*xy*); clf; for *i* = 1 : *N* *s* = 0.2sum (W(i,:))^0.5 + 0.1; isosurface (*s**xx* + xy(*i*,1),*s*yy + xy(*i*,2),szz + xy(*i*,3),*u*,0); hold on end camlight; lighting phong; for *i* = 1:*N* for *j* = *i*+1:*N* if *W*(*i*, *j*) > 0.4 plot3 (*xy* ([*i*, *j*], 1), *xy* ([*i*, *j*], 2), *xy* ([*i*, *j*], 3), “r”, “linewidth,” 15*W* (*i*, *j*)^2 + 1); elseif *W* (*i*, *j*) > 0 plot3 (*xy* ([*i*, *j*], 1), *xy* ([*i*, *j*], 2), *xy* ([*i*, *j*], 3), “*b*”, “linewidth”, 15*W*(*i*, *j*)^2 + 1); end end end for *i* = 1:*N* *s* = 0.2sum (*W*(*i* , :))^0.5 + 0.4; *a* = 0.15; *b* = 0; text (*xy*(*i*, 1)-*a*,*xy*(*i*, 2)-*b*, *xy* (*i*, 3) + *s*, num2str (*i*), “fontsize,”10); end axis off; axis image; end

#### Data Availability

We have released the code and data of this paper in the Appendix and the corresponding author’s homepage.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

The corresponding author (J.S. Kim) expresses thanks for the support from the BK21 FOUR Program.