# Multivariate Network Layout Using Force-Directed Method with Attribute Constraints
## 3 Methods
### Attribute Community Layout
#### 3.1.4 Central Force  
The central force refers to the force received by each attribute community from the center of the layout area. It makes the center point of the entire network layout close to or even coincides with the center point of the layout area, ensuring that the network is drawn in the center of the layout area. Define the coordinates of the center point of the layout area as \((x_{o},y_{o})\), and the coordinates of the center point of the network as \((x^{\prime}_{o},y^{\prime}_{o})\), the formula is as follows:  
\[x_{o}=\frac{W}{2} \tag{22}\]  
\[y_{o}=\frac{H}{2} \tag{23}\]  
\[x^{\prime}_{o}=\frac{\sum_{i=1}^{c_{n}}{n_{c_{i}}}\cdot x_{i}}{n} \tag{24}\]  
\[y^{\prime}_{o}=\frac{\sum_{i=1}^{c_{n}}{n_{c_{i}}}\cdot y_{i}}{n} \tag{25}\]  
where \((x_{i},y_{i})\) is the coordinates of the center of the \(i\)-th attribute community, \(n_{c_{i}}\) is the number of nodes in the \(i\)-th attribute community. This makes it possible to consider the influence of communities with more nodes on the central location when calculating the central location of the network. The formula of the central force is as follows:  
\[F_{o}(p)=\sqrt{(x^{\prime}_{o}-x_{o})^{2}+(y^{\prime}_{o}-y_{o})^{2}}\cdot strength _{o} \tag{26}\]  
where \(strength_{o}\) is the strength of the central force. Therefore, the velocity change of the attribute community \(p\) in the horizontal and vertical directions under the action of the central force is as follows:  
\[\Delta v_{ox}(p)=(x^{\prime}_{o}-x_{o})\cdot F_{o} \tag{27}\]  
\[\Delta v_{oy}(p)=(y^{\prime}_{o}-y_{o})\cdot F_{o} \tag{28}\]  
Since the expression of the result of the force in each attribute community is the speed in the horizontal and vertical directions, in the process of each iteration, these speeds can be accumulated, and at the end of each iteration, the location of the attribute community is moved. Therefore, combining the effects of the above four forces on the community center, the total speed change is as follows:  
\[\Delta v_{x}(p)=\sum_{a}\Delta v_{ax}(p)+\sum_{r}\Delta v_{rx}(p)+\sum_{c} \Delta v_{cx}(p)+\Delta v_{ox}(p) \tag{29}\]  
\[\Delta v_{y}(p)=\sum_{a}\Delta v_{ay}(p)+\sum_{r}\Delta v_{ry}(p)+\sum_{c} \Delta v_{cy}(p)+\Delta v_{oy}(p) \tag{30}\]  
where \(\sum_{a}\Delta v_{ay}(p)\) is the total amount of velocity change in the horizontal direction of the attribute community \(p\) under the attractive action, and the formulas of repulsive and collision forces are similar. Finally, the update formula of the velocity change to the location of the center \((x_{c_{p}},y_{c_{p}})\) of the attribute community \(p\) is as follows:  
\[x_{c_{p}}=x^{\prime}_{c_{p}}+(v^{\prime}_{x}(p)+\Delta v_{x}(p))\cdot\beta \tag{31}\]  
\[y_{c_{p}}=y^{\prime}_{c_{p}}+(v^{\prime}_{y}(p)+\Delta v_{y}(p))\cdot\beta \tag{32}\]where \((x^{\prime}_{c_{p}},Y^{\prime}_{c_{p}})\) is the position of the center of the attribute community \(p\) in the previous iteration, \(v^{\prime}_{x}(p)\) and \(v^{\prime}_{y}(p)\) are the speed of the previous iteration, and \(\beta\) is the decay rate of speed, and the default value of \(\beta\) is 0.5, which is used to control the severity of changes in node position.  
Therefore, as the algorithm runs and the number of iterations increases, the global temperature \(\alpha\) of the simulated annealing algorithm continues to decrease, thereby gradually achieving the convergence of the algorithm, and finally obtaining the ideal location of the center of each attribute community.