## 3 Proposed Algorithm and Analysis
### First-Level Clustering: Uniform Energy Region  
To begin with, network was partitioned into little working region known as grid (matrix) and the number of nodes residing in each grid is calculated as shown in the Figure 1. The quantity of sensor nodes dwelling in each matrix was noted. The grid space was concatenated with the adjoining matrix until the number of grids (G) and the expected number of grids (\(p\)) were equivalent. The number of CHs (\(p\)) to be elected is known in prior. Number of grids solely depends upon the desired number of \(p\). The first phase network system is divided into p\({}^{2}\) number of girds. Figure 1 shows the grid network that consist of 100 number of nodes randomly scattered over the area \(100*100\) square units. The location of each node is acknowledged by BS (150, 50) upon deployment. Let count \(ci\) denotes the number of nodes present in the \(i\)th grid, then we combine the adjacent grid until the following is true:  
\[Count(ci)\geq p \tag{8}\]  
Equation (8) eliminates the probability of a node joining a cluster with a large number of nodes at any given number of \(r\) of information exchange. Due to the variation in number of nodes, concatenating the grid satisfied results in lowering the overhead for the CHs in adjacent cluster. Grid concatenating process of cluster formation maintains homogeneity in the whole network system. The number of nodes in a particular cluster is already known. The distance between these nodes within a cluster \(\left(d_{N}\right)_{ci}\) and distance between each node of the cluster and BS \(\left(d_{BS}\right)_{ci}\) are calculated using the Euclidean matrix. From each cluster, a node (\(N\))_i_ is elected as CH which satisfy the following condition:  
\[\left(N\right)_{i}=min \begin{cases}\left(d_{N}\right)_{ci}\\ \left(d_{BS}\right)_{ci}\end{cases}  \tag{9}\]  
Node (N)\({}_{\text{i}}\) which acts as an initial CH is discovered based on distance where energy level of each node is same upon the deployment. In such an incident, the proposed algorithm selects the node that satisfies the concluding fitness function \(\left\{\left(d_{BS}\right)_{ci}\right\}\), as energy is utilized more while transmitting data characterized by Equation (6). The selection of CH undergoes two rounds in the system. In the first round, CH selection based on LEACH convention. After the first round in the system, the remaining energy in the nodes \(\left(E_{N}\right)_{rem}\) and energy of the whole system \(\left(E_{T}\right)_{rem}\) are calculated as follows:  
\[\left(E_{N}\right)_{rem}=E_{N}-E_{tx} \tag{10}\]  
\[\left(E_{T}\right)_{rem}=E_{T}-\left(E_{N}\right)_{rem}-p*E_{rx}-\left(N-p \right)E_{DA} \tag{11}\]  
While transmitting data to the CH, ordinary nodes lose energy. The remaining energy of each node is calculated using Equation (10). CH, which receives these data, also drops energy. The term \(p*E_{rx}\) is used to calculate this drop energy where \(p\) being the number of CHs. For the data summation purpose, CH uses its energy. Since CH is aggregating data and at the same time receiving data, the last term \(p*\left(E_{DA}+E_{rx}\right)\) in Equation (11) computes the total data dissipating by the CH nodes. In the second round, the assortment of CH can be established by updating Equation (5) as follows:  
\[\left(N\right)_{i}= \begin{cases}min\begin{cases}\left(d_{N}\right)_{ci}\\ \left(d_{BS}\right)_{ci}\\ max\left\{\left(E_{N}\right)_{rem}\end{cases}\end{cases}  \tag{12}\]  
Figure 1: Deciding the number of nodes in the specified grid (Matrix). Blue diamond symbol indicates the number of nodes in each grid. CHs from this round are the function of both distance and remaining energy. CH will have a minimum distance with other nodes and bear a maximum energy level. In the second round, the energy burned through in the first round by each sensor node was accounted for. When CH is not elected, the system forces the sensors to perform direct transmission to BS, which consumes more energy, which will never be the case in this algorithm.