## 3 DV-Hop and Error Analysis  
### DV-Hop Localization Algorithm  
The DV-Hop algorithm is a localization algorithm designed using the principle of distance vector routing. Overall, the DV-Hop algorithm is divided into three phases, which are described in detail below. Phase 1: The minimum number of hops is determined between the unknown node and each anchor node. The anchor node floods its information grouping to the neighbor nodes, including the location information of the anchor node and the initial hop count of 0 [36; 37]. Groups with larger hops of the same anchor node are ignored. Upon receiving a packet of the anchor node, the neighbor node attaches a hop value to the packet [38]. Then add 1 to the hop value and forward it to the neighbor node [39; 40]. As shown in Figure 1, the packet broadcast by the anchor node is propagated through the network in approximately concentric circles. Phase 2: The actual distance between unknown nodes and anchor nodes is accurately and quickly estimated. Consequently, given the total number of hops recorded and the coordinates of the locations of the other anchor nodes, we estimate the average valid distance per hop [41]. \[\text{Hopsize}_{i}=\frac{\sum_{i\
eq j}\left\|\mathbf{X}_{i}-\mathbf{X}_{j} \right\|_{2}}{\sum_{i\
eq j}\text{Hop}_{ij}} \tag{1}\]  
In the above formula, \(\mathbf{X}_{i}=\left[x_{i},y_{i}\right]^{T}\), \(x_{i}\) and \(y_{i}\) are the horizontal and vertical coordinates of the anchor node, individually. \(\text{Hop}_{ij}\) is the hop count for the respectively shortest path of anchor nodes \(i\) and \(j\)[42]. Subsequently, while the anchor node broadcasts the calculated average distance, each unknown node merely stores the initial average distance it receives. In a network with numerous nodes or a wide node deployment, unnecessary communication between nodes can be reduced by setting a time to live for the packets. Consequently, the distance from anchor node \(i\) to the unknown node is more precisely obtained [39]. \[d_{i,k}=h_{i,k}\cdot\text{Hopsize}_{i} \tag{2}\]  
where \(h_{i,k}\) is the hop value of the anchor node \(i\) and the unknown node \(k\). Phase 3: The trilateral localization method, or multilateral localization method, is an essential mechanism to acquire the complete information in more detail. The diagram of the multi-edge positioning method is legibly illustrated in Figure 2.  
Figure 1: Propagation process of anchor node broadcast group. There are n anchor nodes in the deployment environment. The equation is formed as shown below. \[\left\{ \begin{aligned} (x_{1}-x)^{2}+(y_{1}-y)^{2}&=r_{1}^{2}\\ \vdots\\ (x_{n}-x)^{2}+(y_{n}-y)^{2}&=r_{n}^{2}\end{aligned} \right. \tag{3}\]  
The anchor node position is \((x_{i},y_{i}),i=1,2,3,\cdots\). \(r_{i}\) is the measured distance value from the unknown node to each anchor node. Subtract from the 1 st equation in sequence with the nth equation. \[\left\{ \begin{aligned} x_{1}^{2}-x_{n}^{2}-2(x_{1}-x_{n})x+y_{1}^{2}- y_{n}^{2}-2(y_{1}-y_{n})y=r_{1}^{2}-r_{n}^{2}\\ \vdots\\ x_{n-1}^{2}-x_{n}^{2}-2(x_{n-1}-x_{n})x+y_{n-1}^{2}-y_{n}^{2}-2(y_{n-1} -y_{n})y=r_{n-1}^{2}-r_{n}^{2}\end{aligned} \right. \tag{4}\]  
The square term is eliminated to obtain a system of simultaneous equations in n \(-\) 1 dimensions. \[\mathbf{A}X=b \tag{5}\]  
The matrices \(\mathbf{A}\) and \(b\) are concerned. \[\mathbf{A}=2\left[ \begin{aligned} x_{n}-x_{1}& y_{n}-y_{1}\\ \vdots&\vdots\\ x_{n}-x_{n-1}& y_{n}-y_{n-1}\end{aligned} \right] \tag{6}\]  
\[b=\left[ \begin{aligned} r_{1}^{2}-r_{n}^{2}-x_{1}^{2}+x_{n}^{2}-y_{1 }^{2}+y_{n}^{2}\\ \vdots\\ r_{n-1}^{2}-r_{n}^{2}-x_{n-1}^{2}+x_{n}^{2}-y_{n-1}^{2}+y_{n}^{2} \end{aligned} \right] \tag{7}\]  
Since there is a predetermined error in the actual measurement and \(E\) is an n\(-\)1 dimensional error vector, the system of (5) should be expressed as:  
\[\mathbf{A}X+E=b \tag{8}\]  
To ensure that the ranging error has minimal effect on the localization results of the network, the least-squares principle is used to minimize the square of the random error vectors in \(E\) mode.