View full-text article in PMC Sensors (Basel). 2021 Oct 29;21(21):7208. doi: 10.3390/s21217208 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm 2 Optimal Number of UDAP in a Wireless Network Step: 1 Inputdata: Initializevariables CapNodo=μ∀μ∈N Coverage=λ∀λ∈Q+ Step: 2 Minimumspanningtreegeneration: BM,N←zeros for i=1:M XY1=[XT(1:N),YT(1:N)] XY2=[XT(N+i),YT(N+i)] tmp←Prim(XY1,XY2,CapNodo,Coverage) B(i,temp)←ones endfor Step: 3 SCPresolutionandUDAPselection: s←sum(B);L=1:N ind←find(s=0) L(ind)←⌀;B(:,ind)←⌀;B=B′ [solC,solL]←GreedySCP(B) R←ordered(solL′,′rows′) Xel=Xd(R);Yel=Yd(R) Xd=Xel;Yd=Yel Step: 4 Calculationofdistances: G←⌀;M=length(Xel);D←⌀ XT=[Xu,Xd,Xeb,Xc];YT=[Yu,Yd,Yeb,Yc] for i=1:card(XT) for j=1:card(YT) D(i,j)←Haversine([YiXi],[YjXj]) endfor endfor D(D=0)←∞ Step: 5 Minimumroadsandroutecosts: Dmax←δ∀δ∈Q+ G←Assignweights(D,Dmax,N,M,K,P) [rpciai]←compresssparsematrix(G) A=[rpciai] pred←Dijkstra(A,α) CostT←RouteCost(α,pred)