# Trust-Aware Routing Mechanism through an Edge Node for IoT-Enabled Sensor Networks
## 4 Proposed Trust-Aware Routing Mechanism
### Trust-Value-Based Route Path Selection
#### 4.2.1 Trust Values Evaluation  
To ensure data trustworthiness, nodes are at first checked whether they are trustworthy or not. The mobile edge node, which gathers information, evaluates the node trust, thereby reducing the distance and mobile delays. Let \(I_{t}\) be the initial trustworthiness of nodes, \(T\) be the threshold for trustworthiness, and \(I_{c}\) be the trust value of a node. Keeping the storage space of all nodes in consideration, the space for memory can be taken in [0, 10] intervals. Let 5 be the initial trust value of the node. If \(I_{c}=0\), the node is untrustworthy. If \(I_{c}=10\), it shows complete trustworthiness. To avoid the biased performance of nodes, a multi-dimensional model for evaluating trust is employed. The trust calculation exhibits direct and indirect trusts, which is discussed as follows:  
**DIRECT TRUST**: Manifest s a trust relationship between directly communicating nodes. The direct trust values can be determined using the below parameters [21]:  
1. Communication trust value: \[I_{com}^{dir}=v_{old}\times I_{old}^{dir}+v_{new}\times I_{new}^{dir}\] (13) \[I_{new}^{dir}=\frac{SC}{N}\] (14) \(I_{com}^{dir}\) is the communication trust value; \(v_{old}\) and \(v_{new}\) are the weight variables of old and new trust values, respectively; \(I_{old}^{dir}\) and\(I_{new}^{dir}\) are old and new trust values, respectively. SC is the number of successful communications and \(N\) is the total communications. 2. Positional intimacy: The measure of successful delivery of messages when a node is very close to CH. \[I_{c}^{dir}=1-\frac{dist(c,\,CH)}{R}\] (15) \(I_{c}^{dir}\) indicates trust value of the node with location, \(\text{dist}(c,\,CH)\) is the distance between the node and CH, \(R\) is the range of communication for that node. 3. Loss of packets: \[I_{p}^{dir}=\frac{S_{p}-R_{p}}{S_{p}}\] (16) \(S_{p}\) is the number of packets sent and \(R_{p}\) expresses the number of packets received. 4. Energy: Determines the lifetime of nodes. Trust value of a node in terms of energy is the ratio of its residual energy to its initial energy \[I_{i,j}^{dir}=v_{com}\times I_{c}+v_{l}\times I_{l}+v_{e}\times I_{e}+v_{p} \times I_{p}\] (17)  
Figure 4: \(\alpha\), \(\beta\), \(\delta\), and candidate wolves with reference to the position of the prey. \(I_{i,j}^{dir}\) shows the total trust values of \(i\) and \(j\); \(v_{com}\), \(v_{l}\), \(v_{e}\), and \(v_{p}\) are the weights of communication trust; and \(v_{com}+v_{l}+v_{e}+v_{p}=1\). INDIRECT TRUST: When two nodes communicate via a recommendation of a third node adjacent to one of the two nodes, the indirect trust value has to be calculated. For example, \(A\) and \(B\) nodes interact via intermediary nodes \(x\), \(y\), and \(z\), which are the neighborhood nodes to \(A\). Then, A projects indirect trust at \(B\), and the trust is transferred from \(A\) to \(B\) through nodes \(x\), \(y\), and \(z\). The indirect trust of node \(A\) at \(B\) can be expressed as  
\[\left(I_{A,B}\right)_{x}=I_{A,\ x}\times I_{x,B} \tag{18}\]  
\(\left(I_{A,B}\right)_{x}\) is the trust of A after passing through x to B. The indirect trust of \(A\) at \(B\) is expressed as  
\[I_{i,j}^{indir}=I_{A,\ B}=\sum_{x=1}^{m}\partial_{x}\times\left(I_{A,\ B} \right)_{x} \tag{19}\]  
\[\partial_{x}=\left[\frac{\left(I_{x,B}\right)}{\sum_{m=1}^{m}I_{x,n}}\right] \tag{20}\]  
where \(n\) is the counter representing \(m\) adjacent nodes to \(A\). The total trust is given by the sum of direct trust (\(I^{dir}\)) and indirect trust (\(I^{indir}\)), which is calculated as  
\[\mathit{Tot\_trust}=I^{dir}+I^{indir} \tag{21}\]  
To identify the faulty node and trustworthy node, the following measure should be considered:  
\[\mathit{Trust}= \begin{cases}\mathit{trusted\_node}&\text{if }\mathit{Tot\_trust}=1\\ \mathit{faulty\_node}&\text{if }\mathit{Tot\_trust}=0\end{cases}  \tag{22}\]  
Algorithm 2 shows how nodes are evaluated based on trust values and how untrustworthy nodes are identified.