# A Method of Node Layout of a Complex Network Based on Community Compression
## 3 Method  
### Multi-Granularity Community Structure Detection  
Compared with other community structure detection algorithms, the Louvain algorithm [25] has a faster operation speed and can quickly process a network with hundreds of millions of nodes [26; 27]. In addition, hierarchical clustering can output different granularities of the community structure partition results. Therefore, this paper adopts the Louvain algorithm to realize multi-granularity community structure detection. Modularity is one of the important indicators to describe the quality of community division in the network. It can be calculated by the following formula [25]:  
\[Q=\frac{1}{2m}{\sum_{i}\sum_{j}{(A_{ij}-\frac{k_{i}k_{j}}{2m})\delta(c_{v_{i}}, c_{v_{j}})}}. \tag{1}\]In the formula: \(m\) is the total number of edges in the network; \(A_{ij}\) is the weight of the edge between certain node pairs; \(k_{i}\) is the degree of node \(v_{i}\); \(c_{v_{j}}\) is the community to which the node \(v_{i}\) belongs; and \(\delta(c_{v_{j}},c_{v_{j}})\) is the Dirac function, which will be \(1\) if the nodes \(v_{i}\) and \(v_{j}\) belong to the same community and will otherwise be \(0\). The community structure detection algorithm based on modularity optimization is a kind of aggregation algorithm, which continuously aggregates nodes by optimizing the modularity gain function, and finally obtains the result of community structure partition when the modularity gains stops increasing. In [25], the authors define the modularity gain as:  
\[\Delta Q=[\frac{C_{in}+K_{i,in}}{2m}-(\frac{C_{out}+K_{i}}{2m})^{2}]-[\frac{C _{in}}{2m}-(\frac{C_{out}}{2m})^{2}-(\frac{K_{i}}{2m})^{2}]. \tag{2}\]  
In the formula: \(C_{in}\) is the sum of all internal edge weights in the community \(C\); \(C_{out}\) is the sum of all edge weights adjacent to the nodes in the community \(C\); \(K_{i}\) is the sum of edge weights of all adjacent nodes \(v_{i}\); and \(K_{i,in}\) is the sum of the weights of the edges to which all nodes (\(v_{i}\)) and the nodes in the community are adjacent. As shown in Figure 1, the Louvain algorithm can be divided into two stages. Firstly, each node is initialized as one community, and all nodes are traversed continuously in the network. The generated modularity gains are calculated by adding the node to each community. If the modularity gain is greater than \(0\), the community with the largest gain of corresponding modules is selected from these corresponding communities and merged with them. The process is repeated until the two communities in the network are no longer merged. Then, based on the results of community division in the first stage, each community is abstracted as a \"node\" and a new network is constructed. The weights between new nodes are the sum of the weights between communities in the original network. The process of the previous stage is repeated until the communities can no  
In the formula: \(|V_{C}|\) is the number of nodes in the community \(C\); the larger \(k_{j}\) is, the greater is the effect on the nodes; \(d_{ij}\) is the shortest path length from node \(v_{i}\) to node \(v_{j}\); and \(\delta\) is the influence factor, indicating the range of interactions between nodes. Formula (3) shows that the potential of any node in a community is actually equal to the sum of the forces exerted on it by all other nodes in the community, and the forces gradually decay with an increase in the distance from the node. The more nodes around a certain node in the community and the shorter the distance is, the greater is the potential of the node. Therefore, it can be judged that the node with the highest potential value is the node at the center of the community, which can be regarded as the center of the community; conversely, the node at the fringe of the community usually has fewer edges and relatively low potential value.