# A Simple Method for Network Visualization

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Numerical Algorithm

#### 2.1. Distmesh Algorithm

**Step 1.**- Generate the random nodes ${\mathbf{X}}^{0}$ in domain.
**Step 2.**- Generate a level set function $\psi $ 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 ${\mathbf{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 $\mathbf{F}$ in order to update the position of nodes.
**Step 4.**- Renew the position of nodes to ${\mathbf{X}}^{n+1/2}$ by adding $\Delta t\mathbf{F}$.
**Step 5.**- Push back the nodes that are pushed out to the boundary into the interface using the following equation$$\begin{array}{c}\hfill {\mathbf{X}}_{i}^{n+1}=\chi \left({\mathbf{X}}_{i}^{n+1/2}\right)\left({\mathbf{X}}_{i}^{n+1/2}-\frac{\nabla \psi \left({\mathbf{X}}_{i}^{n+1/2}\right)}{|\nabla \psi \left({\mathbf{X}}_{i}^{n+1/2}\right){|}^{2}}\psi \left({\mathbf{X}}_{i}^{n+1/2}\right)\right)\phantom{\rule{0.166667em}{0ex}},\end{array}$$
**Step 6.**- Repeat
**Step 3–5**until the level of the total movement of nodes is less than a given tolerance.

#### 2.2. Proposed Algorithm for Network Visualization

## 3. Numerical Results

## 4. Conclusions

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## Appendix A

**Listing A1.**Matlab Code for the network visualization.

% The first step clear; W=[ 0 21 24 16 0 0 0 2 0 7 4 5 0 0 0 0 0 0 1 21 0 27 32 0 0 0 0 0 2 0 11 2 3 2 0 0 0 0 24 27 0 40 0 0 7 0 12 6 0 2 0 5 0 0 0 0 2 16 32 40 0 36 3 0 7 0 0 0 10 0 0 0 3 13 2 0 0 0 0 36 0 2 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 3 2 0 15 0 0 0 0 4 0 0 0 0 0 0 0 0 0 7 0 0 15 0 0 0 0 0 0 0 3 0 0 0 0 0 2 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 2 6 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 5 11 2 10 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 5 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; N=size(W,1); rand("seed",3773); t=rand(N,1); xy=[cos(2*pi*t),sin(2*pi*t)]; W=W/max(max(W)); minW=min(min(W(W>0))); minD=1; maxD=2; p=-log(maxD)/log(minW); for i=1:N for j=1:N if W(i,j)>0 d(i,j)=1/W(i,j)^p; end end end dt=0.01; tol=0.01; n=0; error=2*tol; while error≥tol n=n+1; F = zeros(N,2); for i=1:N for j=i+1:N if W(i,j)>0 vt = xy(j,:)-xy(i,:); 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 xy = xy + dt*F; error=norm(F)/sqrt(N); if n==1 || mod(n,10)==0 || error<tol figure(1); DrawNetwork(xy,W); pause(0.1) end end % The second step z=find(sum(W>0)==1); M=length(z); for k=1:M s(k)=find(W(z(k),:)>0); end xy0=xy; n=0; dt=10.0; tol=0.002; error=2*tol; while error≥=tol n=n+1; F = zeros(N,2); for k=1:M v=[0 0]; for j=1:N vt = xy(z(k),:)-xy(j,:); if norm(vt)>0 v=v+vt/norm(vt); end end F(z(k),:)=v/norm(v); end xy = xy + dt*F; error=0; for k=1:M v=xy(z(k),:)-xy(s(k),:); xy(z(k),:)=xy(s(k),:)+d(z(k),s(k))*v/norm(v); error=error+norm(xy(z(k),:)-xy0(z(k),:))^2; end error=sqrt(error/M); xy0=xy; figure(2); DrawNetwork(xy,W); pause(0.1) end

**Listing A2.**Function code for DrawNetwork.

function DrawNetwork(xy,W) N=length(xy); clf; hold on for i=1:N for j=i+1:N if W(i,j)>0 plot(xy([i,j],1),xy([i,j],2),"b","linewidth",15*W(i,j)^2+1); end end end scatter(xy(:,1),xy(:,2),400,"g","filled"); for i = 1:N text(xy(i,1)-0.04,xy(i,2),num2str(i)); end axis off; axis image; end

## References

- Heer, J.; Card, S.K.; Landay, J.A. Prefuse: A toolkit for interactive information visualization. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, Portland, OR, USA, 2–7 April 2005; pp. 421–430. [Google Scholar]
- Keim, D.A. Information visualization and visual data mining. IEEE Trans. Vis. Comput. Graph.
**2002**, 8, 1–8. [Google Scholar] [CrossRef] - McGuffin, M.J. Simple algorithms for network visualization: A tutorial. Tsinghua Sci. Technol.
**2012**, 17, 383–398. [Google Scholar] [CrossRef] - Van Wijk, J.J.; Van de Wetering, H. Cushion treemaps: Visualization of hierarchical information. In Proceedings of the 1999 IEEE Symposium on Information Visualization (InfoVis’ 99), San Francisco, CA, USA, 24–29 October 1999; pp. 73–78. [Google Scholar]
- Herman, I.; Melançon, G.; Marshall, M.S. Graph visualization and navigation in information visualization: A survey. IEEE Trans. Vis. Comput. Graph.
**2000**, 6, 24–43. [Google Scholar] [CrossRef] [Green Version] - Adar, E. GUESS: A language and interface for graph exploration. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, Montréal, QC, Cananda, 22–27 April 2006; pp. 791–800. [Google Scholar]
- Bostock, M.; Heer, J. Protovis: A graphical toolkit for visualization. IEEE Trans. Vis. Comput. Graph.
**2009**, 15, 1121–1128. [Google Scholar] [CrossRef] [PubMed] - Wylie, B.; Baumes, J. A unified toolkit for information and scientific visualization. In Visualization and Data Analysis 2009; SPIE: San Jose, CA, USA, 2009; p. 72430H. [Google Scholar]
- McCarty, C.; Molina, J.L.; Aguilar, C.; Rota, L. A comparison of social network mapping and personal network visualization. Field Methods
**2007**, 19, 145–162. [Google Scholar] [CrossRef] [Green Version] - Nüesch, E.; Häuser, W.; Bernardy, K.; Barth, J.; Jüni, P. Comparative efficacy of pharmacological and non-pharmacological interventions in fibromyalgia syndrome: Network meta-analysis. Ann. Rheum. Dis.
**2013**, 72, 955–962. [Google Scholar] [CrossRef] [PubMed] - Wu, L.; Li, M.; Wang, J.X.; Wu, F.X. Controllability and Its Applications to Biological Networks. J. Comput. Sci. Technol.
**2019**, 34, 16–34. [Google Scholar] [CrossRef] - Xia, M.; Wang, J.; He, Y. BrainNet Viewer: A network visualization tool for human brain connectomics. PLoS ONE
**2013**, 8, e68910. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Dolfin, M.; Knopoff, D.; Limosani, M.; Xibilia, M.G. Credit Risk Contagion and Systemic Risk on Networks. Mathematics
**2019**, 7, 713. [Google Scholar] [CrossRef] [Green Version] - Pueyo, O.; Pueyo, X.; Patow, G. An overview of generalization techniques for street networks. Graph. Models
**2019**, 106, 101049. [Google Scholar] [CrossRef] - Chaimani, A.; Higgins, J.P.; Mavridis, D.; Spyridonos, P.; Salanti, G. Graphical tools for network meta-analysis in STATA. PLoS ONE
**2013**, 8, e76654. [Google Scholar] [CrossRef] [PubMed] - Eades, P. A heuristic for graph drawing. Congr. Numer.
**1984**, 42, 149–160. [Google Scholar] - Kamada, T.; Kawai, S. An algorithm for drawing general undirected graphs. Inf. Process. Lett.
**1989**, 31, 7–15. [Google Scholar] [CrossRef] - Hall, K.M. An r-dimensional quadratic placement algorithm. Manag. Sci.
**1970**, 17, 219–229. [Google Scholar] [CrossRef] - Spielman, D. Spectral Graph Theory. In Combinatorial Scientific Computing (No. 18); CRC Press: Boca Raton, FL, USA, 2012. [Google Scholar]
- Rücker, G.; Schwarzer, G. Automated drawing of network plots in network meta-analysis. Res. Synth. Methods
**2016**, 7, 94–107. [Google Scholar] [CrossRef] [PubMed] - Gansner, E.R.; Koren, Y.; North, S. Graph drawing by stress majorization. In International Symposium on Graph Drawing; Springer: Berlin/Heidelberg, Germany, 2004; pp. 239–250. [Google Scholar]
- Persson, P.O.; Strang, G. A simple mesh generator in MATLAB. SIAM Rev. Soc. Ind. Appl. Math.
**2004**, 46, 329–345. [Google Scholar] [CrossRef] [Green Version] - Argyros, I.; Shakhno, S.; Shunkin, Y. Improved Convergence Analysis of Gauss-Newton-Secant Method for Solving Nonlinear Least Squares Problems. Mathematics
**2019**, 7, 99. [Google Scholar] [CrossRef] [Green Version]

**Figure 1.**Example of a circular network. Reprinted from Salanti et al. [15] with permission from PLoS ONE.

**Figure 2.**Schematic illustration of generating the distmesh. (

**a**) Generated random nodes in the domain. (

**b**) Signed distance function $\psi $ in bounding box. The boundary of domain is regarded as the zero-level set. (

**c**) Net force $\mathbf{F}$ in current triangulation. (

**d**) Arrangement of nodes via $\Delta t\mathbf{F}$. (

**e**) Projection of the nodes located outside $\psi >0$ into the boundary $\psi \approx 0$ using Equation (3). (

**f**) Final result of unstructured mesh by using the distmesh algorithm.

**Figure 4.**Illustration of distance function ${d}_{ij}$ related to weighting value ${w}_{ij}$. minD $=1$ and maxD are set to appear when ${w}_{ij}=1$ and ${w}_{ij}=\mathrm{minW}$, respectively.

**Figure 5.**Two possible forces at nodes ${\mathbf{X}}_{i}^{n}$ and ${\mathbf{X}}_{j}^{n}$: (

**a**) repulsive force and (

**b**) attractive force.

**Figure 6.**Schematic of the proposed algorithm. (

**a**) initial condition, (

**b**) after 1 iteration, (

**c**) after 2 iterations, (

**d**) after 3 iterations, (

**e**) after 6 iterations, and (

**f**) equilibrium state after 10 iterations.

**Figure 7.**Snapshots of the network visualization process for ‘The Venice Merchant’: (

**a**) initial condition, (

**b**) after 20 iteration, (

**c**) after 40 iterations, and (

**d**) equilibrium state after 1985 iterations.

**Figure 9.**Updating the position of nodes with only one connection: (

**a**) Equilibrium state of the first step, (

**b**) after 1 iteration, (

**c**) after 2 iterations, and (

**d**) equilibrium state of the second step after 75 iterations.

**Figure 10.**Snapshots of network visualization for ‘Romeo and Juliet’: (

**a**) the initial condition, (

**b**) after 230 iterations of the first step, and (

**c**) after 20 iterations of the second step.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Park, J.; Yoon, S.; Lee, C.; Kim, J.
A Simple Method for Network Visualization. *Mathematics* **2020**, *8*, 1020.
https://doi.org/10.3390/math8061020

**AMA Style**

Park J, Yoon S, Lee C, Kim J.
A Simple Method for Network Visualization. *Mathematics*. 2020; 8(6):1020.
https://doi.org/10.3390/math8061020

**Chicago/Turabian Style**

Park, Jintae, Sungha Yoon, Chaeyoung Lee, and Junseok Kim.
2020. "A Simple Method for Network Visualization" *Mathematics* 8, no. 6: 1020.
https://doi.org/10.3390/math8061020