To address the electromagnetic interference problems faced by swarm UAVs in complex environments and the clustering needs of swarm UAV networks in dynamic scenarios, this paper proposes a weighted clustering algorithm for wireless UV cooperative swarm UAVs, which combines the advantages of UV anti-interference and high secrecy to provide a reliable communication method for swarm UAVs. By introducing adaptive node degree, UAV energy efficiency, and distance stability parameters to improve the cluster head election formula, the algorithm is made more applicable to dynamic scenarios. Simulation results show that this algorithm can improve the network survival period by 16%, while reducing the average number of cluster heads by 37% and nearly doubling the data transmission volume.