# Blockchain-Assisted Adaptive Reconfiguration Method for Trusted UAV Network
## 4 Recommended Scheme
### Trusted Network Reconfiguration
#### 4.3.2 Zone Center Node Elections  
The dynamic nature of the UAV network requires the upper layer management network to be time-varying, and the nodes that make up the upper layer network need to be not only trusted but also regionally representative. The upper layer network constructed by the trusted central nodes of each sub-region of the UAV network at each stage minimizes redundant routes. This solution uses clustering algorithms to regionally delineate the UAV network and find the regional centers. The clustering feature is a list of neighboring addresses of the UAV nodes. The feature UAV node i is represented as: \(\overrightarrow{N_{i}}=[ID_{i1},ID_{i2},\ldots,ID_{im}]\), m is the number of its neighboring nodes, and if the number of neighbors is less than m, the missing part is filled with zeros. The UAV network is represented by a feature vector as \(\overrightarrow{U}=\left[\overrightarrow{N_{1}},\overrightarrow{N_{2}}, \ldots,\overrightarrow{N_{n}}\right]\), with n being the number of UAVs in the current mission network. The feature vectors used for clustering are not of numerical type, but are lists used for classification. Therefore a fuzzy K-modes clustering algorithm [33] is used, replacing the mean with the mode as the central node of the zone (cluster) and adapting to the situation of overlapping regions. Clustering makes use of simple matching dissimilarity, i.e., the dissimilarity between two UAV nodes is expressed in terms of the cumulative number of m neighbors of the feature vector, the fewer the mismatches, the closer the two nodes are. The mathematical expression (7) shows the proximity of two UAV nodes.  
\[d(\overrightarrow{N_{i}},\overrightarrow{N_{j}})=\sum_{x=1}^{m}\sum_{y=1}^{m} \delta(ID_{ix},ID_{iy}) \tag{7}\]  
where \(\delta(ID_{ix},ID_{iy})=0\), if \(ID_{ix}\
eq ID_{iy}\) ; \(\delta(ID_{ix},ID_{iy})=0\), if \(ID_{ix}=ID_{iy}\)  
Let \(U^{k}=[\overrightarrow{N_{k1}},\overrightarrow{N_{k2}},\ldots,\overrightarrow {N_{kn}}]\) be a sub-zone of the UAV network, and the mode in the UAV network denotes the feature vector of the central node of the zone.  
**Definition 1**.: _The feature vector \(Q=[ID_{1},ID_{2},\ldots,ID_{m}]\) is the mode of the UAV network \(U^{k}\), if it makes the function (8),_  
\[D(Q,\overrightarrow{N_{i}})=\sum_{i=1}^{m}d(\overrightarrow{N_{i}},Q) \tag{8}\]  
_take the minimum value and \(Q\in U^{k}\)._  
Let \(n_{ID_{x}}\) be the times the neighbor node \(ID_{x}\) appears in all lists of neighbors, the frequency of \(ID_{x}\) in the zone \(U^{k}\):  
\[f(ID=ID_{x}|U^{k})=\frac{n_{ID_{x}}}{m} \tag{9}\]  
**Theorem 1**.: _Mode update method for k-modes of UAV networks, the function \(D(Q,N_{i})\) reaches a minimum when and only when the following inequality holds:_  
\[f(ID=ID_{x}|U^{k})\geq f(ID=ID_{j}|U^{k}) \tag{10}\]  
_where \(ID_{x}\
eq ID_{j}\), \(\forall j=(1,2,\ldots,m)\). The relevant proofs of the theorem refer to Algorithm 4._  
```
1:while\((m--)\)do
2:if\(f(ID=ID_{x}|U^{k})\geq f(ID=ID_{j}|U^{k})\)then
3:if\(n_{ID_{x}}>n_{ID_{j}}\), \(j\
eq x,\forall j=(1,2,\ldots,m)\)then
4:\(Q\cup ID_{x}\)
5:endif
6:endif
7:endwhile
8:\(D(Q,N_{i})\) reaches a minimum.
```  
**Algorithm 4** Poof of updating method for k-Modes of UAV networks