# Efficient Next-Hop Selection in Multi-Hop Routing for IoT Enabled Wireless Sensor Networks
## 4 Proposed Solution
### Proposed Next-Hop Selection Scheme  
In the proposed mechanism for next-hop selection, we considered the residual battery and the distance from the BS. In cases where the distance is minimum but the residual energy is less than the threshold value \(\text{TV}_{0}\), we then opted to select another neighboring node. In this top-down approach that holds centralized control, therefore, the BS contains information about the status of all the nodes in the cluster. To organizes all member nodes, the BS periodically checks the ranks of nodes for better communication and accessibility to BS. The BS and child nodes set data connections to develop a suitable network formation. The network configurations for \(N=2^{p}\) and \(N=2^{1}\) are small due to a smaller number of nodes. For \(N=2^{p}\) nodes, the network is assumed to be completely connected. In this context, the completely connected network means the presence of a data link among two consecutive nodes. Moreover, if there is no direct link among two consecutive devices, then intermediaries are involved as next-hop neighbors. The link degree among two sensor devices shows the number of data connections connected to a node. In this context, if a connection level of a node is 3, that means a node has established three connections with other sensors. For \(N=2^{p}\) nodes in the network, every node starts with \(N-1\) level. Sensors are elected from the set where \(b=N/2\). In this context, the algorithm can remove all connections (data links) among nodes that are not suitable or if the battery is expired. In direct routing, the root node directly forwards information to the \(CH\). Calculating the remaining energy periodically, every node of this routing protocol can share its remaining energy with other nodes of the network. THV denotes the threshold value specified at the initial stage, and RE is the remaining energy of each node. If the RE is less than the threshold value, then the protocol initializes multi-hop-based routing, otherwise data are transmitted to the \(CH\) through direct routing. In case the number of nodes in the next hop is only 1, then the data are directly transmitted to the node. Conversely, the mechanism chooses the next-hop node on the basis of the remaining battery power and selects the node with maximum energy. Algorithm 1 is explored step by step as follows. Figure 3: Rank-based network model for N = 16. Initially, the required variables are assigned initial values in steps 1 to 3. Next, the sensor nodes forward the messages to \(CH\), which calculates the residual energy RE and the distance \(Di\) between neighbor and BS, as illustrated in steps 9 and 10. The distance to BS should be a minimum to choose the best suitable next hop. The algorithm should also consider the residual energy RE of that node. We check in step 7 whether the node status is not expired, that is, whether its energy is zero. In steps 11 to 15, the algorithm checks whether the distance to neighboring node \(Di\) is less than the minimum distance \(mDi\). If the condition is true, then the new lower distance is reassigned as the minimum distance. The algorithm also sets a next-hop flag _NhFlag_ to identify that this node may be the next hop for transmission. In step 14, the distance value of that node is saved in the array Arr_D_NG_ to be used later for further decision if needed. In steps 16 to 21, the algorithm first checks that the RE is greater than the threshold value \(\text{TV}_{0}\) to be selected as next-hop. Next, it checks that the rank \(k\_N_{Gi}\) of the node \(N_{Gi}\) must be larger than or equal to the rank of the previous next hop \(k\_Prev_{hop}\). This ensures that the next hop is near to the BS, as its rank \(k\) value is higher. The algorithm also checks the limit of rank value k of the next hop \(k\_Nxt_{hop}\), which should be less than the upper limit of \(Log_{2}^{N}+1\). For example, for a network of \(N=16\) nodes, its value will be 04. This means that all member nodes may have maximum rank of \(k=4\) when \(N=16\).