## 4 Algorithm Description
### Static Configuration in Clustered Networking  
In the application scenario of the urban rail network, due to the high speed of trains, the network topology is highly dynamic. In the AODV routing protocol, each node in a network only discovers routing on demand. On the one hand, due to the continuous changes in network topology, routing discovery needs to be initiated continuously, resulting in a large amount of routing overhead. On the other hand, the delay in the routing discovery process cannot be ignored. Therefore, this paper separates the whole network into clusters. Whenever the train runs into a cluster, the train is transmitted with a fixed node in the cluster to avoid routes interrupted by changes in network topology. Regarding the selection of fixed nodes in the cluster, this paper uses the concept of residual link lifetime (RLL) to calculate the lifetime between the train and the fixed nodes in the cluster, then chooses the nodes with a longer residual link lifetime to ensure the stability of the link. Because the trackside nodes in the urban rail scenario are fixed, and when a fixed node within the cluster is selected, the routing table of the fixed node can be statically configured in advance, eliminating the delay of route discovery. The network in the hierarchical structure is divided into several clusters composed of cluster heads and clusters. Unlike all nodes in a flat structure that need to maintain routing information for all other nodes in the network, cluster members only need to save routing information within the cluster, reducing overhead and making it more flexible. In hierarchical structures, different clustering algorithms are used depending on the requirements of the optimization criteria for the scenario. Reducing cluster maintenance and computing overhead, rationalizing the cluster structure, extending network lifetime, and maximizing cluster head distribution are common cluster optimization criteria. In the urban rail application scenario in this article, nodes are clustered. The role of cluster heads is to uniformly manage the location and routing information of nodes within the cluster and dynamically monitor the link status between nodes in the cluster. The communication requirements between cluster heads are not high. In addition, the location of trackside nodes in urban rail scenarios is fixed, so the requirements for cluster structure are not high. Therefore, clustering based on the geographical location of nodes is considered. Among numerous clustering algorithms, the geographical adaptive fidelity (GAF) [29] clustering algorithm is a typical adaptive clustering algorithm based on the geographical location of nodes, which divides the entire area of node distribution into small virtual grids. The definition of virtual grids is that any two nodes within two adjacent cells can communicate directly, and nodes are divided into corresponding virtual networks based on their geographical location information. The GAF algorithm makes the network evenly clustered and has a stable topology. This paper uses the GAF algorithm for clustering, combining the characteristics of fixed location of urban rail nodes. When selecting the node in the cluster that communicates with the train, this article introduces the concept of the residual link lifetime [20]. The train node moves in a fixed direction and speed on the track. Assuming that the current position of the training node \(\mathrm{N_{i}}\) is \((x_{i}y_{i})\), the speed is \((u_{i}v_{i})\), and the current position of the node in \(\mathrm{N_{j}}\) is \((x_{j}y_{j})\), and the speed is \((uj,j)\), define \(x_{ij}\), \(y_{ij}\), \(u_{ij}\), and \(v_{ij}\) as  
\[ \begin{cases}x_{ij}=x_{i}-x_{j}\\ y_{ij}=y_{i}-y_{j}\\ u_{ij}=u_{i}-u_{j}\\ v_{ij}=v_{i}-v_{j}\end{cases} . \tag{3}\]  
The distance between two nodes after t seconds is computed as  
\[D(t)=\sqrt{(x_{ij}+u_{ij}t)^{2}+(y_{ij}+v_{ij}t)^{2}}. \tag{4}\]  
Two nodes move independently.