## 3 The Clustering Protocol
### Inter-Cluster Routing Mechanism  
In this section, we optimize the Dijkstra algorithm: when defining the weights, we ignore the consideration of the nonessential paths, thus reducing the computational complexity and achieving the selection of optimal information transmission paths among the CHs. (1) The Definition of Weights: First, based on the energy consumption of the nodes in the network during data transmission, we propose formulas for calculating the weight between the end-to-end and the path weight. Figure 9: The representation of _dis._  
The calculation formula for the weight between the end-to-end is as shown in (18):  
\[W(i,j)=E_{T}(l,d(i,j))=\left\{ \begin{array}{ll}l\cdot E_{elex}+l\cdot\varepsilon_ {fs}\cdot d(i,j)^{2},&d(i,j)<d_{0}\\ l\cdot E_{elex}+l\cdot\varepsilon_{mp}\cdot d(i,j)^{4},&d(i,j)\geq d_{0}\end{array} \right. \tag{18}\]  
In the above formula, \(d(i,j)\) represents the distance between node \(i\) and node \(j\), and the weight between the two is directly represented by the required energy consumption for transmitting information between the two. The calculation formula for the path weight is as shown in (19):  
\[W(Path(M_{1},M_{n+1}))=\frac{1}{n}\cdot\sum_{i=1}^{n}W(M_{i},M_{i+1}), \tag{19}\]  
In the above formula, we can obtain the weight of the path \(W(Path(M_{1},M_{n+1}))\), in which the information starting point is node \(M_{1}\), which passes through \(M_{2}\), \(M_{3}\)... in order and finally reaches node \(M_{n+1}\). Because in the WSN applications information ultimately needs to be transmitted to the BS, the path is the information transmission path from a CH to the BS in the area. Thus, (19) can be modified to:  
\[W(Path(M_{1},BS))=\frac{1}{n}\cdot\left(\sum_{i=1}^{n-1}W(M_{i},M_{i+1})+W(M_{ n},BS)\right), \tag{20}\]  
(2) The Neglect Consideration of Non-Essential Paths: As described in Section 3.4, the Dijkstra algorithm mainly selects the optimal path by focusing on the starting point and expanding the outer layer. However, when the optimal path traverses the set \(Q\), it often generates some unnecessary weight calculations. As an example of a WSN, as shown in Figure 10, it is obvious that the distance \(d(i,x)\) from node \(i\) to node \(x\) is larger than the distance \(d(i,BS)\) from node \(i\) to the BS. If node \(x\) acts as the relay node of node \(i\), unnecessary energy consumption will be generated. When the path of node \(i\) to the BS is selected by the Dijkstra algorithm, the BS serves as the source point s. When the BS selects the node with the smallest weight from itself, once \(x\) is selected, the values of \(W(BS,i)\) and \(W(BS,x)+W(x,i)\) are inevitably compared. As mentioned above, \(x\) must not act as the relay node between node \(i\) and the BS, which inevitably causes redundant calculations. Based on this, we could ignore this situation in the process of optimizing Dijkstra, thus reducing the computational complexity. In addition, the Dijkstra algorithm selects the node \(x\) closest to the source point \(s\) from the set \(Q\) as a multi-hops relay node, and then whether other nodes in the set \(Q\) have a better multi-hops effect through the node \(x\) is determined, thereby continuously updating the  
Figure 10: Schematic diagram of information transmission between nodes. BS—base station. weights and selecting the optimal information transmission paths. From another point of view, in the process of optimizing Dijkstra, we order all the CHs according to distance from the BS to form an ordered set of CHs, then we traverse the CHs, and each CH is respectively judged with the previous CHs by the path weights until all the CHs in the area find the optimal information transmission paths to the BS. The detailed procedure of the Optimized Dijkstra algorithm in the WSN is given by the pseudocode in Algorithm 2.