# A Method of Node Layout of a Complex Network Based on Community Compression
## 3 Method
### Compression Layout Algorithm  
When the community structure is compressed, as few nodes as possible are selected to maximize the community structure. The right subfigure in Figure 2 is a schematic diagram for compressing communities on the basis of classification of the community nodes. The community representative point \(V_{CA}\) and the relatively important node set \(V_{CB}\) are taken as the community structure representative point set \(V^{\prime}_{CA}\). Community compression is mainly to set up alternative nodes for the fringe node \(V_{CC}\). It merges fringe nodes and community structure representative points and compresses them into the network, only leaving community structure representative points.  
For any node \(v_{i}\in V_{CC}\), \(V_{N}(v_{i})\) is used to represent the neighbor nodes set of node \(v_{i}\). When node \(v_{i}\) satisfies Formula (4), node \(v_{i}\) and the community structure representative node \(v_{j}\) are compressed into one node, and \(v_{j}\) is set as an alternative node of \(v_{i}\).  
\[v_{j}=V_{N}(v_{i})\cap V^{\prime}_{CA}. \tag{4}\]  
The breadth-first algorithm is used to find and set the replacement nodes for the nodes in the set \(V_{CC}\). The specific method is shown in Algorithm 1, where \(lfReplaced(v_{i})\) is used to mark whether node \(v_{i}\) is replaced by a node in \(V^{\prime}_{CA}\), and \(replace(v_{i})\) is used to represent the replacement point of node \(v_{i}\).  
Figure 2: Schematic diagram of community node classification and community compression.  
Set up substitution nodes for all nodes in \(V_{CC}\), and generate a new community structure representing node set \(V^{\prime}_{C}\). As shown in Algorithm 1, the alternative node settings for any node \(v_{i}\) in \(V_{CC}\) can be divided into two steps:  
(1) If the neighbor node \(v_{j}\) of node \(v_{i}\) belongs to the community structure representative node set \(V^{\prime}_{CA}\), then the node \(v_{j}\) is set as the substitution of node \(v_{i}\).  
(2) If node \(v_{j}\) is not a representative node of community structure, then all neighbor nodes of node \(v_{j}\) are added to the access list and searched until the replacement node of node \(v_{i}\) is found.  
After compressing all fringe nodes in all communities, the new network node firstly sets \(V^{\prime}\) as constructed by merging all the new community structure representative nodes. Then, all the edges in the original network are traversed, the nodes of the edges are replaced by replacement nodes, and the duplicate edges are deleted to obtain the compressed network \(G^{\prime}=(V^{\prime},\,E^{\prime})\). Finally, the classical FR algorithm [28; 29; 30] is used to lay out the nodes in the compressed network, resulting in the topology view of the complex network.  
```
Input: original node \(v_{i}\), neighbor node set \(V_{N}(v_{i})\), community structure representative node set \(V^{\prime}_{CA}\). Output: Replacement node \(replace(v_{i})\)
1 Create a breadth-first access list \(L(v_{i})\)
2 WHILE \(L(v_{i})\). size=\(0\)DO
3\(v_{j}=L(v_{i})\).pop()
4 IF (\(v_{j}\in V^{\prime}_{CA}\))
5 replace(\(v_{i}\))=\(v_{j}\)
6\(IfReplaced(v_{i})=\)1
7 BREAK WHILE
8 END IF
9 ELSE IF
10\(L(v_{i})\).PUSH(\(V_{N}(v_{j})\))
11 END ELSE IF
12 END WHILE
```  
**Algorithm 1** Breadth-first traversal instead of node setting algorithm