# Multi-Gateway-Based Energy Holes Avoidance Routing Protocol for WSN
## 6 Proposed Algorithm
The energy (\(E_{\text{TX}}\)) consumed in the transmission of a packet along a route of \(s\) intermediate sensor nodes, is given by: \[E_{t}\left(\mid\mid\right)=k(E_{elec}+\varepsilon_{\text{amp}}\times d_{\mid \mid}^{\lambda})\] (7) where, \(d^{\lambda}\mid\mid\) is the distance between a transmitting and receiving node and value of the \(\lambda\) lies between 2 and 4. Here \(\lambda\) is a path loss component and its value depends on the power loss model. If the value of \(d<d_{0}\), value of \(\lambda\) is 2 (free space: \(\varepsilon_{\text{fs}}\)) otherwise value of \(\lambda\) is 4 (\(\varepsilon_{\text{two-ray-amp}}\)) and \(k\) is the number of bits in a packet. 2. The sensor network is denoted as an undirected graph \(G(V,E)\), such that \(V\) represents the set of all nodes and E represents the set of edges as follows: \[E_{k}=\left\{(v^{i},v^{j})\middle|\left(v^{i},v^{j}\in V\right)\wedge\left(L_{ xy}^{\text{min}}\leq\left[L_{xy}\left(v^{i}\right),L_{xy}\left(v^{j}\right) \right]\leq L_{xy}^{\text{max}}\right)\wedge\left(E_{t}^{\text{min}}\leq E_{ t}\left(v^{i},v^{j}\right)\right)\right\}\] (8) where \(L_{xy}\) is the location information of the sensor node and \(L_{xy}^{\text{min}}\) and \(L_{xy}^{\text{max}}\) are the minimum and the maximum boundary value of the area. The minimum transmission energy threshold is given by \(E_{t}^{\text{min}}\). If node transmission energy falls below the threshold value, it can't transmit. 3. After the division of area into multiple regions, the network graph is also partitioned into the R sub graphs. The \(m\)th region of the area is represented by \(G_{m}\left(V_{m},E_{m}\right)\) and the complete area can be represented as the union of all the regions as follows: \[G=\cup_{m=1}^{R}G_{m}\quad\text{And}\quad\cap_{m=1}^{R}G_{m}=\varnothing\] (9)
4. The vertex set \(V_{m}\) of the region is given by: \[V_{m}=\left\{v_{m}^{i}\middle|\left(v_{m}^{i}\in V\right)\wedge\left(L_{mxy}^{ \text{min}}\leq\left(L_{mxy}\left(v_{m}^{i}\right)\right)\leq L_{mxy}^{\text{ max}}\right)\right.\] (10) where, \(v_{m}^{i}\) is the \(i\)th node of the \(m\)th region and the edge set is given by: \[E_{m}=\left\{\left(v_{m}^{i},v_{m}^{j}\right)\middle|\left(v_{m}^{i},v_{m}^{j }\in V_{m}\right)\wedge\left(E_{t}^{\text{min}}\leq E_{t}\left(v_{m}^{i},v_{m}^ {j}\right)\right)\right\}\] (11) where, \(L_{mxy}^{\text{min}}\) and \(L_{mxy}^{\text{max}}\) are the minimum and maximum location values of the \(m\)th region excluding the sink and gateway regions. * After the clustering process, few nodes of the \(m\)th region, work as the cluster head node of different clusters in the region. The vertex set \(V_{k}^{m}\), represents the set of nodes of the \(k\)th cluster of the \(m\)th region as follows: \[V_{k}^{m}=\left\{v_{k}^{i}|\left(v_{k}^{i}\in V_{m}\right)\wedge\left(1\leq(v_{ k}^{i}c\_ID)\right)\right\}\] (12) where, the node \(v_{k}^{i}\) is a node of the \(k\)th cluster and there should be at least one cluster in the \(m\)th region. However, if the node \(v_{k}^{i}\) is a cluster head node, then: \[v_{k}^{i}.c\_ID=v_{k}^{ch}.c\_ID\] (13) where, \(v_{k}^{\text{ch}}\) is the cluster head of the \(k\)th cluster. * The cluster head node of the \(k\)th cluster is the destination node for all the cluster members and the members are considered as the source nodes within the cluster. The set of source nodes is given by: \[\mathcal{S}_{k}=V_{k}^{m}-\left\{v_{k}^{\text{ch}}\right\}\] (14)
* The cluster members and the head form a spanning tree like structure where the CH is a root and members are leaf nodes. * If the \(m\)th region has total \(\mathcal{C}\) clusters than it can be represented as: \[G_{m}=\cup_{k=1}^{\mathcal{C}}G_{k}\] (15)

where \(G_{k}\) represents the \(k\)th cluster.