# Fuzzy-Logic Dijkstra-Based Energy-Efficient Algorithm for Data Transmission in WSNs
## 4 Proposed Fuzzy Logic Dijkstra-based Routing Algorithm
### Data Transmission Phase  
In the data transmission phase, the nodes stay idle until an event occurs. On detection of the event, the sensor node located in the close vicinity senses the information and transmits it to the CH using a multi-hop path. This multi-hop path selection is done on the basis of the fuzzy logic Dijkstra-based algorithm described as follows. Suppose the nodes within a cluster along the CH are represented by a directed graph \(D_{g}=(S,L)\), where \(S\) is the number of \(m\) sensor nodes in the cluster, i.e., \(S_{i}\)\((i=1,\ 2,\ 3,\ldots\ldots,m)\) and \(L\) represents the set of links or edges between these nodes. Each edge \(\left(S_{i},S_{j}\right)\in L\) has a weight such that \(W\left(L_{ij}\right)\) is the weight of the link between the \(i\)th and the \(j\)th node. An edge \(\left(S_{i},S_{j}\right)\) between the two nodes is defined to exist only if \(S_{i}\)_and_\(S_{j}\) are within the radio transmission range of each other, i.e., if \(d_{ij}\leq r_{t}\), where \(d_{ij}\) is the distance between the \(i\)th and the \(j\)th node. The weight function for each link is influenced by two parameters: the residual energy of the neighbor node and distance of the neighbor node to the CH. This approach results in the increased energy efficiency of the network and eliminates the early death of the nodes due to node isolation. Once the weight for each neighboring node is computed, the node with the maximum energy and minimum intra-cluster communication cost, i.e., minimum weight, is selected as a data relay node through [PERSON]'s algorithm, as illustrated in Figure 4.  
Figure 4: Multi-hop weighted path within a cluster: (**a**) directed graph with weights for each link between origin node (\(S_{0}\)) and destination node (\(S_{f}\)); (**b**) path with minimum weights selected from \(S_{0}\) to \(S_{f}\). Execution of the abovementioned process involved several steps described below:  
Step I: Initialize set \(SL\) to store the neighbor nodes and corresponding links which will participate in the data transmission. Initially, the set \(SL\) consists of only the origin node \((S_{o})\). \[SL=\{S_{o}\} \tag{13}\]  
Step II: Identify the nodes located at the distance less than the transmission radius \(r_{t}\) to the origin node \((S_{o})\) as its neighbor nodes. Step III: Determine the weight \(W(L_{ij})\) of the link incident on each neighboring node by using Equation (14):  
\[W(L_{ij})=\frac{1}{\gamma_{j}\cdot ICCC_{x}} \tag{14}\]  
where \(\gamma_{j}\) represents the fuzzy membership function [24] and \(ICCC_{x}\) symbolizes the intra-cluster communication cost function [2] of cluster \(x\). They are given by Equations (15) and (16), respectively, as:  
\[\gamma_{j}= \begin{Bmatrix}1:&if\;\;E_{r}\big{(}S_{j}\big{)}=E_{init}\\ 1-\Big{(}\frac{1-\mu}{1-\delta}\Big{)}.\Big{(}1-\frac{E_{r}(S_{j})}{E_{init}} \Big{)}:&if\;\;E_{th}\leq\;E_{r}\big{(}S_{j}\big{)}<E_{init}\\ \frac{\mu}{E_{th}-E_{TX}}.\big{(}E_{r}\big{(}S_{j}\big{)}-E_{TX}\big{)}:&if\;\;E _{TX}\leq E_{r}\big{(}S_{j}\big{)}<E_{th}\\ 0:&if\;\;E_{r}\big{(}S_{j}\big{)}<E_{TX}\end{Bmatrix} \Bigg{\}}. \tag{15}\]  
\[ICCC_{x}=\frac{2.ASD_{CH}-d_{j}}{d_{j}} \tag{16}\]  
where \(E_{r}\big{(}S_{j}\big{)}\) represents the residual energy of the \(j\)th neighbor node, which is defined in Equation (17). Here, \(E_{th}\) represents the threshold energy value computed as \(\delta\cdot E_{init}\), where \(\delta\) and \(\mu\) are the algorithmic parameters, each ranging from (0, 1) [24]. Additionally, \(ASD_{CH}\) is the average sensor node distance to the CH, and \(d_{j}\) represents the distance of \(j\)th neighbor node to the CH. \[E_{r}\big{(}S_{j}\big{)}=E_{c}\big{(}S_{j}\big{)}-E_{TX} \tag{17}\]  
where \(E_{c}\big{(}S_{j}\big{)}\) represents the current energy of the \(j\)th neighbor node. The multiplicand part of Equation (14) ensures the next-hop node to be energy-rich, whereas the multiplier part assures the selection of a node that will reduce the communication cost within the cluster among other neighbor nodes.