## 4 EGCIR Protocol
### Graph-Based Clustering with Supervised System  
This section presents the algorithm that was developed to classify the network nodes in different boundaries, i.e., clusters. In the EGCIR protocol, the BS supervises the whole cluster formation mechanism and also creates a generalized table to hold the network information. Table 1 contains all information about sensor nodes regarding their identifier ID, energy, position, time edge, status and public and secret keys. Sensor nodes send their information to neighbors and BS to create tables both at the node and BS levels. In the EGCIR protocol, the cluster formation is based on a centralized manner and the BS acts as an organizer for such activities. The centralized mechanism offers a balance sized cluster in an efficient and orderly manner with uniform energy consumption between sensor nodes. Upon receiving the position information of the nodes, the BS determines various centroids. Afterward, the BS exploits a supervised machine learning, a K-NN algorithm [39, 40] to part the dense neighbors into a particular cluster. Such a mechanism guarantees that the cluster members are closely interconnected to each other with nominal transmission distance. Furthermore, a single sensor node is belonged to only a particular cluster at a time based on the least Received Signal Strength Interference (RSSI). In the EGCIR protocol, the Manhattan distance function [41, 42] is used to determine the distance between sensor nodes and centroid. This function utilizes the absolute value and provides robust results. Let us consider that \(x_{i},y_{i}\) are the positioning coordinates of the sensor node \(i\) and \((x_{n},y_{n})\) are the positioning coordinates of the centroid, then Manhattan distance \(f(d)\) can be determined using Equation (1). \[f(d)= |x_{i}-x_{n}|+|y_{i}-y_{n}| \tag{1}\]  
Figure 1: Research design of energy-aware graph clustering and intelligent routing using a supervised system. Subsequently computing the distance of sensor nodes for centroid points using Equation (1), the BS formulates the \(k\) number of nearest nodes in a specific cluster, whereas the value of \(k\) depends on the external input. The BS slightly increases its transmission power to \(t_{r}(p)\) by particular length \(l_{o}\) to locate the other centroid point as given in Equation (2), and accordingly, the \(k\) number of nearest neighbors is divided into another cluster. \[t_{r}(p)^{\prime}=t_{r}(p)+l_{o} \tag{2}\]  
Afterward, the bounded nodes determine the time edge that is taken in transmitting the packets to neighbors over the transmission links. The time edge is the ratio of distance measurement using equation 1 from \(n_{1}\) to \(n_{2}\) and velocity of data transmission for a particular link. Let us consider that node \(n_{1}\) floods the probe packets to neighbor \(n_{2}\) on a transmission link at a prefixed time interval. Accordingly, the source node \(n_{1}\) computes the time edge \(E_{t0}\), \(E_{t1}\dots,\ E_{tn}\) for probe packets \(P_{0}\), \(P_{1}\), \(\dots\), \(P_{n}\) and determines the weighted value as \(E_{t0}+E_{t1}+\dots,+E_{tn}\). Accordingly, the bounded nodes \(n_{1},\ n_{2},\dots,\ n_{k}\) within the clusters compute their time edges towards neighbors and forwards the values to the BS. Based on the weighted value of time edge and residual energy, the BS selects the most suitable node as a starting cluster head and announces its status among the particular cluster members. All the cluster members mark the entry of selected cluster head ID in their node level table. On the other hand, the BS also updates its generalized table and makes an entry in front of each sensor node regarding its status, i.e., the node is either cluster head or member. In this way, the BS keeps track of all selected cluster heads and exactly only one cluster head will be allocated to its nearest neighbors.