# PDTR: Probabilistic and Deterministic Tree-based Routing for Wireless Sensor Networks
## 4 Proposed Method PDTR
### Updating the Probabilistic Routing Phase
#### 4.3.1 Definitions  
**Definition 1**. : _Path Links and Path Nodes: Let \(p_{n_{s}}^{k}\) be the path transmitting a packet of size \(k\) from the source node \(n_{s}\) to the sink node \(n_{r}\), such that the path links \(p_{n_{s}}^{k}L=\{\langle n_{s},n_{v}\rangle,\langle n_{v},n_{w}\rangle,\ldots, \langle n_{l},n_{r}\rangle\}\) are defined as the sequence of all links between each node and its parent, starting from the link \(\langle n_{s},n_{v}\rangle\) between the source node \(n_{s}\) and its selected forwarder \(n_{v}\), to the last link \(\langle n_{l},n_{r}\rangle\) relaying the last node \(n_{l}\) to the sink node \(n_{r}\). The associated path nodes are defined as \(p_{n_{s}}^{k}N\), such that: \(p_{n_{s}}^{k}N=\left\{n_{s},n_{v},n_{w},\ldots,n_{q},n_{f},\ldots,n_{l},n_{r} \right\}=\left\{n_{s},n_{v},n_{w},\ldots,n_{q}\right\}\bigcup\left\{n_{f}, \ldots,n_{r}\right\}\), such that the node \(n_{f}\) is the forwarder node of the node \(n_{q}\) and \(p_{n_{s}}^{k}N\) is expressed in Equation (15)._  
\[p_{n_{s}}^{k}N=\left\{\overline{n_{s}-n_{q}}\right\}\bigcup\left|\overline{n_ {f}-n_{r}}\right\rangle=p_{n_{s}}^{k}\overline{n_{s}-n_{q}}\ \bigcup\ p_{n_{s}}^{k}\overline{n_{f}-n_{r}} \tag{15}\]  
**Definition 2**. : _Sub-tree (\(n_{q}\)) Nodes: Let \(\mathit{Sbt}_{N}^{n_{q}}\) be the Sub-tree (\(n_{q}\)) Nodes, defined as the nodes of the Sub-tree (\(n_{q}\)). \(\mathit{Sbt}_{N}^{n_{q}}\) consists of all paths starting from the source node \(n_{s}\), and passing by the node \(n_{q}\) toward the sink node \(n_{r}\), such that \(n_{s}\in\mathbb{S}\) and \(\mathbb{S}\) is the set of all source nodes sending data, through paths passing by the node \(n_{q}\) toward the root (sink) node \(n_{r}\),\(|\mathbb{S}|=v\), as explained in Equation (16), by using Equation (15)._  
\[\mathit{Sbt}_{N}^{n_{q}}=\bigcup_{s=1}^{v}\ p_{n_{s}}^{k}\overline{n_{s}-n_{q}} \tag{16}\]  
**Definition 3**. : _Node Need New-Parent Selection: It is clear that the residual energy distribution changes by sending data, which requests an update. Let the node \(n_{h}\) be the node that loses \(\ell_{e}\) of its energy, it broadcasts the current energy state to the sink node and to all its children as well. It is declared that \(n_{h}\) is the node that needs a help, the neighboring nodes (children nodes) as well, send a feedback to \(n_{h}\) about the current residual energy, then \(n_{h}\) selects the child with the lowest residual energy to be removed; the cost of this process is very low and can be negligible. The selected child node is defined as the node needing new-parent, defined as \(n_{np}\)._  
**Definition 4**. : _Candidate Parents: The selected child node \(n_{np}\) broadcasts its current energy state to its neighboring nodes. Then, the neighboring nodes update their residual energy. The residual energy is already updated, once receiving a packet by the node \(n_{np}\), then \(n_{np}\) selects probabilistically a new-parent node \(n_{p}\) among the set of its candidate parents \(CP_{np}\) based on its updated probabilistic routing table. The \(CP_{np}\) is defined as the set of \(n_{np}\) neighboring nodes that do not belong to the Sub-tree (\(n_{th}\)) nodes ( \(St_{N}^{n_{th}}\)), and have a higher residual energy than the residual energy of the node \(n_{th}\)._  
_The candidate parents for \(n_{np}\) \(\left(CP_{np}\right)\) are a set of neighboring nodes of \(n_{np}\), such that they satisfy the conditions (1,2), such that: \(\forall\;n_{i}\;\in\;\mathbb{N}_{np},\;\exists n_{p}\;\in\;CP_{np}\)_  
1. \(n_{p}\
otin\;St_{N}^{n_{th}}\) _(The candidate parent should not be a node in the Sub-tree ( \(n_{th}\)) nodes, such that nodes in \(St_{N}^{n_{th}}\) are defined by Equation (_16_)_
2. \(E_{n_{p}}>E_{n_{th}}\) _(The residual energy of the candidate parent of the node need new-parent \(n_{p}\) should be greater than the residual energy of its current parent (\(n_{th}\))). The candidate parents set for \(n_{np}\) is denoted by \(CP_{np}\), and defined by Equation (17)._ \[CP_{np}=\left\{