1. while network is not partitioned;
2.    for any 𝑐 𝑗 . C H 𝑐 𝑖 . 𝑁 F F _ C H
3.    𝑐 𝑘 .CH = min(dist( 𝑐 𝑗 . 𝑁 C H , BS));
4.    𝑐 𝑖 .CH.nextHop← 𝑐 𝑘 .CH;
5.   if dist( 𝑐 𝑗 .CH, BS) = dist( 𝑐 𝑘 .CH, BS) then
6.   if ( 𝑐 𝑖 .CH. 𝐸 R E > 𝑐 𝑘 .CH. 𝐸 R E ) then
7.     𝑐 𝑖 .CH.nextHop← 𝑐 𝑗 .CH;
8.   else
9.     𝑐 𝑖 .CH.nextHop← 𝑐 𝑘 .CH;
10. end while
Algorithm 3: Distributed multihop routing selection for cluster head 𝑐 𝑖 .CH.