## 4 Hybrid Trust-Based Congestion-Aware Cluster Routing (HTCCR)
### CH Selection Phase
#### 4.1.2 KHM Clustering  
This clustering method is widely used because it is simple and can be directly implemented involving a lower number of iterations. The K-means (KM) clustering method strives to identify the cluster centers (\(\text{ccn}_{1}\), \(\text{ccn}_{2}\), \(\text{ccn}_{3}\),..., \(\text{ccn}_{n}\)), in which the total squared distances of every data point \(\text{dp}_{i}\) to the cluster center \(\text{ccn}_{j}\), which is too close, are curtailed. The performance of the KHM method depends on cluster center initialization. The reason behind this problem is that the KHM method utilizes partitioning plans that lead to the robust integration of the closest data center and data points, forbidding data centers from moving away from the localized data density. The KM method utilizes the shortest distance from data points to data centers, and KHM clustering substitutes this with the HM of distances from data points to every data center. The KHM method provides the best and lowest score for data points when they are very near to a data center. This is considered a significant feature of the KHM method, which similar to like that of the minimum function employed in the KM method. The KHM clustering method is designed as shown below.  
Assume \(CC=(\text{cc}_{1},\text{cc}_{2},\ldots,\text{cc}_{n})\) as the cluster center set, and \(D=(d_{1},d_{2},\ldots,d_{m})\) as the data considered for clustering, \(\text{mem}(\text{cc}_{j}|d_{i})\) as a membership function that defines the number of data points that are part of the data center \(\text{cc}_{j}\), and \(\text{wei}(d_{i})\) as the weight function that defines the number of data points \(d_{i}\) present in recalculating the data center parameters in the upcoming iteration.  
**Algorithm:** KHM Clustering Method  
1. Initialize m by arbitrarily selecting data centers **CC**.
2. Compute the value of the objective function depending on \[KHM(D,CC)=\sum_{i=1}^{m}\frac{n}{\sum_{j=1}^{n}\frac{1}{\|d_{i}-\text{cc}_{j }\|^{\tau}}}\] (14) where \(r\geq 2\) is an input parameter.  
* For every data point \(d_{i}\), calculate the membership function \(\text{mem}(cc_{j}|d_{i})\) for each data center \(cc_{j}\) depending on \[\text{mem}(cc_{j}|d_{i})=-\frac{\|d_{i}-cc_{j}\|^{-(r+2)}}{\sum_{j=1}^{n}\|d_{i} -cc_{j}\|^{-(r+2)}}\] (15) iv. For every data point \(d_{i}\), calculate the weight function \(\text{wei}(d_{i})\) depending on \[\text{wei}(d_{i})=\frac{\sum_{j=1}^{n}\|d_{i}-cc_{j}\|^{-(r+2)}}{\left(\sum_{ j=1}^{n}\|d_{i}-cc_{j}\|^{-(r+2)}\right)^{2}}\] (16) v. For every data center \(cc_{j}\), recalculate their location from all the data points \(d_{i}\) depending on their weight and membership values: \[cc_{j}=\frac{\sum_{i=1}^{n}\text{mem}(cc_{j}|d_{i})\,\text{wei}(d_{i})\,d_{i} }{\sum_{i=1}^{n}\text{mem}(cc_{j}|d_{i})\,\text{wei}(d_{i})}\] (17)
* Repeat Step 2 to Step 5 until \(KHM(D,CC)\) does not experience any significant variation or for a fixed number of iterations.
* Allocate a data point '\(d_{i}\)' to cluster '\(j\)' with the largest membership value '\(\text{mem}(cc_{j}|d_{i})\). KHM has been found to be insensitive to the initialization of data centers when it is prone to local optima convergence [27].