## 4 Trusted Network Secure Routing Algorithm
### Node Reputation
#### 4.1.1 Indirect Reputation Value  
Wireless sensor networks show high randomness in the deployment of nodes; there will thus be large overlaps in the perceptual ranges of the nodes. As shown in the figure below, in Figure 4a, the three nodes cover the entire area, whereas in Figure 4b, the scope of the fourth node is completely coincident with those of the other nodes. If this node is filtered out, then the energy consumption of the network can be reduced without affecting the node credibility evaluation.  
To filter out such nodes, this paper introduces the concept of the coincidence rate to measure the contact ratio of information between nodes. The nodes are grouped according to a certain distance.  
Figure 4: Overlap among deployed nodes. (**a**) Three nodes cover the entire area; (**b**) four nodes cover the entire area.  
Figure 3: The framework for calculating node reputation values.  
If the number of nodes in a group is 1, there is no need to filter; otherwise, the coincidence rate of each packet is calculated.  
The joint information entropy can be used to characterize the relationships among multiple data sources, but its calculation formula is difficult to realize. Therefore, this paper adopts the method for the approximate calculation of the relative joint information entropy between information sources presented in [23]. [PERSON] and others believe that the distance between two information sources can be used to measure the degree of correlation between those sources; the specific formula is as follows:  
\[H_{n}\bigg{(}\overline{d}\bigg{)}=H_{1}+(n-1)\left[1-\frac{1}{\left(\frac{d}{ c}+1\right)}\right]H_{1} \tag{7}\]  
where \(H_{n}\left(\overline{d}\right)\) represents the approximate joint information entropy among \(n\) sources, \(\overline{d}\) represents the average distance between the sources, and \(c\) is a constant that reflects the degree of spatial correlation among the information sources.  
From the above formula, we can obtain the coincidence rate \(D_{n}\left(\overline{d}\right)\), which is defined as the approximate joint information entropy \(H_{n}\left(\overline{d}\right)\) divided by the node information entropy as a standard reference:  
\[D_{n}\bigg{(}\overline{d}\bigg{)}=1+(n-1)\left[1-\frac{1}{\left(\frac{\overline {d}}{c}+1\right)}\right] \tag{8}\]  
Finally, when the coincidence rate among the nodes is lower than a specified coincidence rate threshold, the group retains only those nodes with the maximum residual energies, and all other nodes are filtered out. This threshold should be set in accordance with the size of the network. After filtering, the indirect credit value parameters of the remaining packet nodes are determined based on the Josang trust principle [24]:  
\[\left\{\begin{array}{l}\alpha_{ij\_in}^{k}=\frac{2\alpha_{ik}\alpha_{ij}}{( \beta_{ik}+2)(\alpha_{kj}+\beta_{ij}+2)+2\alpha_{ik}}\\ \beta_{ij\_in}^{k}=\frac{2\alpha_{ik}\beta_{ij}}{(\beta_{ik}+2)(\alpha_{kj}+ \beta_{ij}+2)+2\alpha_{ik}}\end{array}\right. \tag{9}\]  
where \(\alpha_{ij\_in}^{k}\left(\beta_{ij\_in}^{k}\right)\) indicates that node \(i\) obtains the normal (abnormal) communication times of nodes \(j\) from other nodes, and \(\alpha_{ik}\) (\(\beta_{ik}\)) indicates that node \(i\) obtains normal (abnormal) communication times of nodes \(k\). Equation (9) can be substituted into Equation (6) to obtain the indirect reputation value \(R_{ij\_in}\) of the node.