## 4 K-Anonymity-Based SHFL
### Secure Hierarchical Distributed Architecture
#### 4.1.2 K-Anonymity-Based Regrouping of Anonymous Clusters of SHFL  
In the SHFL architecture, we integrate the K-anonymous central server, which ensures the anonymity of LBS-enabled smart devices. This K-anonymous architecture also contains a GPS server and database server, where the global network model operates throughout the network operation. Figure 2 shows the detailed process of the integrated K-anonymous central server. The communication between the LCs and K-anonymous central server is protected through encryption technology. The following five-step process performs this anonymity query, which is formalized in Algorithm 1:  
1. The directly connected LCs \(M_{j}\) transmit the initial dialogue with a trusted anonymous server and deliver their demand of anonymity with the degree of \(PPV\) and its corresponding \(CS\) cluster size. 2. For anonymous re-clustering of the devices, the anonymous server computes the anonymous results for the set \(M_{j}\) using the K-Anonymity algorithm and sends the results to the LBS server. 3. According to the position information provided by \(M_{j}\) and the recommendation of the K-anonymous algorithm, the LBS and database server continue the anonymous query procedure. The LBS server regroups the nodes and formulates the set \(U_{j}\). Similarly, the LBS processes the re-clustering demand of the intra-local devices connected to \(M_{j}\) in the form of \(V_{i}\). 4. The outcome of the LBS server and database server is delivered to the K-anonymous server. 5. Finally, the K-anonymous server re-checks the sets \(U_{j}\) and \(V_{i}\) according to the actual locations. It transmits the K-anonymous replies to the network devices. ``` Input :Adapted sets of results, \(V^{\prime}=\{V^{\prime}_{1},V^{\prime}_{2},...,V^{\prime}_{m}\}\), \(|V^{\prime}_{i}|\geq k_{min}\), i = 1,..., m Output :Anonymous result sets, \(V^{\prime\prime}=\{V^{\prime\prime}_{1},V^{\prime\prime}_{2},...,V^{\prime \prime}_{m}\}\), \(|V^{\prime\prime}_{i}|\geq k_{min}\), i = 1,..., m
1 Initialization Steps for\(V^{\prime\prime}_{i}\)do
2\(V^{\prime\prime}_{i}\) obtains a set of client identifications \(m_{i}\) and a set of queries in the anonymous group \(C^{\prime}_{i}\) by determining the highest value \(A_{min}\) to compare and obtain \(r\) as \(A_{min}=\pi\times r2\);
3\(e=Get\_Head\_Item\)\((V^{\prime\prime}_{i})\);
4 if(\(r>e.radius\)) e.radius = r; // Adjust the radius;
5 The object e identifier is included in \(m_{i}\); the query information is included in \(S_{i}\), and \(S_{i}\) is fixed to the area of a circle having a radius equivalent to e.radius. 6. Now, e can be anchored to the construct \(V^{\prime\prime}\);After ensuring privacy preservation using the K-anonymity method, the following anonymous set \(U_{j}=u_{j}ID\), \(LOC\), \(AS\) of the local models appears as the available network statistics. \(u_{j}ID\) is the anonymous ID, \(LOC\) is the updated location, and \(AS\) is the area of K-anonymity. Similarly, \(V_{i}=u_{i}ID\), \(LOC\), \(AS\) is a set of intra-local models that updates the anonymous profile to save the privacy of the client device. The K-anonymity algorithm performs significantly better once the clustered and corresponding anonymous groups contain minimum outliers. The outliers are devices with different query statistics that make the anchor device selection process of the cluster complex. The elimination of outliers simplifies the anonymous grouping process. To detect outliers, we represent the client space as \(ZT\). \(d\) is the radial distance of \(x\) from the corresponding \(y\), which can be denoted as \(K-dist\) (\(d\)). Similarly, \(K-dist\) (\(r\)) neighborhood of the object d is denoted by \(V_{i}K(r)\). Any other device within the radius \(d\) of \(k\) is denoted as \(dist\) (\(x,y\)). 1. **Reachability distance** (ReachDist) is calculated by the following equation: \[ReachDist_{K}d(x,y)=Max(K-dist(x),d(x,y).\] (19)
2. **K-nearest neighbor (K-NN) distance** in the space \(ZT\) can be defined as follows: \[DistKN(x,ZT)=\frac{\sum_{l=K}^{K}DistK(i)}{k}.\] (20)
3.