## 3 Vehicle Clustering Algorithms
### Vehicle Clustering Method Based on DBSCAN Algorithm
The location distribution of cluster heads remained unchanged throughout the simulation process. #### 4.2.1 Analysis of the Effectiveness of the Improved LEACH Protocol

(1) Power

Power is the total energy consumed by all nodes in the network. Lower power indicates better network performance when the network operates for the same duration. In Figure 4, we present the relationship between power and the number of cycles for a vehicle-to-road communication network consisting of 30 CAV vehicle nodes and one Roadside Unit (RSU). After 4000 cycles, it can be observed that the improved LEACH wireless routing algorithm exhibits lower power compared with the traditional LEACH protocol. This indicates that the improved clustering network and the distribution of cluster heads are more reasonable. Figure 3: Comparison of the DBSCAN clustering algorithm before and after clustering. (2) Death

Death refers to the number of nodes that become inactive due to energy depletion. The network's lifespan is closely related to the distribution of network nodes. If the clustering algorithm is ineffective, nodes may experience uneven energy consumption, leading to the death of some nodes. Lower death indicates a more balanced energy consumption and a longer network lifespan. Figure 5 shows the relationship between death and the number of cycles for the network. Compared with the classical LEACH protocol, for the same number of cycles, the improved algorithm in this study has a higher number of surviving nodes, and the classical LEACH protocol nodes die faster, indicating that the distribution of nodes within the clusters of this algorithm is more balanced. This ensures that the entire network maintains a consistent structure until the end of its lifespan and reduces the energy consumed by the constant cluster establishment and cluster-head election, effectively improving the network's lifespan and stability. Figure 4: Comparison of power. Figure 5: Comparison of death. #### 4.2.2 Analysis of Network Performance under Different Permeabilities

To analyze the network performance at different permeabilities, we randomly selected subsets of 6, 9, 12, 15, 18, and 21 CAV nodes from the previously simulated 30 mixed vehicle nodes to simulate the heterogeneous traffic flow scenario on the highway when the CAV permeability is 20%, 30%, 40%, 50%, 60%, and 70%, respectively, and used the improved algorithm proposed in this study to conduct the clustering simulation. The distribution of some of the mixed vehicle nodes and the clustering results for each permeability are shown in Figure 6. The solid circle \"\(\bullet\)\" in the figure represents the vehicles with network connection function randomly selected in the mixed traffic flow. These vehicles are clustered into clusters through the algorithm in this paper and represented by solid circles of different colors. Solid circles of the same color are in the same cluster. The red five-pointed star \"\(\diamond\)\" in the figure indicates the location of the roadside unit. Through the performance analysis of the network's lifecycle in heterogeneous traffic flow with CAV permeability ranging from 20% to 70% using the proposed algorithm in this study, we investigated the variations in the death and power as the simulation rounds increased. As shown in Figure 7, it can be observed that as the permeability increases, both the death and power generally increase. This can be attributed to the fact that, under the same mixed traffic density, the number of CAVs in the heterogeneous traffic flow also increases. Notably, when the permeability reaches 60%, the clustering effect becomes more reasonable and uniform, resulting in relatively lower death and power in the early stages. Figure 6: Clustering diagram of vehicle nodes with different permeabilities. Analysis of Roadside Unit Deployment at Different CAV Permeabilities on Highways 4.3.1.