## 4 Simulation Analysis of Switching Topology Formation  
In this part, we validate the effectiveness of our proposed distributed control laws in the above sections. We carry out the simulation for the agents with the double integrator model (14) and the corresponding parameters are shown below. Firstly, we consider the formation system with seven agents, where there exist four followers labeled 4, 5, 6, 7 and 3 leaders labeled 1, 2, 3. The initial positions of the seven agents are  
\[q^{*}= \begin{bmatrix}4&2&2&0&0&-2&-2\\ 0&2&-2&2&-2&2&-2\end{bmatrix}  \tag{23}\]  
In addition, set the initial velocity of the multi-agent systems to 0. Let the control parameter be chosen as \(k_{p}=0.5\) and \(k_{p}=2\), respectively. The step size and the simulation time are constructed as 0.01 s and 80 s. It is very clear to see that the three leaders are not collinear in the formation, therefore they can affinely span in the plane. For simulations in a 2D plane, the required configuration is given in the figure below. According to the theorems and arguments given above, we calculate the weights of the formation configuration of the six agents, as shown below. It can be proven to be universal rigidity. \[ \begin{array}{l}k_{11}=k_{66}=-0.4339,\\ k_{22}=k_{33}=k_{44}=k_{55}=-0.6508\\ k_{25}=k_{52}=k_{34}=k_{43}=0.4881\\ k_{12}=k_{21}=k_{13}=k_{31}=k_{46}=k_{64}=0.3254\\ k_{16}=k_{61}=-0.2169,k_{24}=k_{42}=-0.1627\end{array}  \tag{24}\]  
In practice, the prescribed formation shapes at different times are depicted in Figure 5. Different numbers in the figure represent different agents, with red and blue being the leader and follower respectively. It can be clearly found that after a single agent is disabled, the leader-follower algorithms [19] need three agents to form the given configuration in the graph library, and the paths appear to cross. After the Improved Hungarian algorithm is added in this paper, there are some trade-offs in the calculation time of the whole algorithm. However, in terms of effectiveness, the method adopted in this paper makes the formation move from multiple agents to only a single one. A comparison of the tracking errors of the two algorithms is shown in Figure 6. The algorithm used in this paper has a shorter convergence time and the peak error is reduced by 3.826. Table 2 shows that the total path consumption is reduced by 8.06 m, the time to reach the steady state is reduced by 8 s, and the peak tracking error is reduced by 66.6%, which greatly improves the efficiency of formation reconstruction. In a more complex environment, this algorithm can save more fuel and improve the efficiency of large-scale formation reconstruction. In order to simulate the damage of agents, the number of agents is gradually reduced from seven to only four. From zero to forty seconds, there exists seven agents. The followers are disconnected at 40, 70, and 100 s respectively. Assuming that in the ideal state, the leader will not be failed, and the remaining agents continue to complete the task. The various nominal formations in Figure 2b are constructed according to the second part of the article. Furthermore, the given graphs are fixed during the piecewise maneuvering process. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Different Strategies** & **Total Path Cost** & **Steady-State Time** &
\begin{tabular}{c} **Tracking Error Peak** \\ **Comparison** \\ \end{tabular} \\ \hline Using the Leader-Follower algorithms & 68.15 & 63 s & 5.742 \\ Using the Improved & 60.09 & 55 s & 1.916 \\ Hungarian Algorithm & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Data comparison of different strategies. Figure 5: Comparison of path curves of the two strategies. Figure 6: Comparison of tracking errors of two strategies. The corresponding stress matrixes can be calculated in advance by using the method in [21]. Moreover, the stress matrixes are all positive semidefinite and satisfy \(rank(\Omega_{\mathrm{s}})=n-d-1\).