Input: The least number of neighbors
Output: Connected -Neighborhood Network
 (1) Get the current residual energy ;
 (2) Broadcast and receive the residual energy of its neighbors . Let be the set of the residual energy of nodes in .
 (3) Broadcast and receive from each node where .
 (4) If or for any , remain awake.
   Return.
 (5) Compute ;
 (6) Go to sleep if both the following conditions hold. Remain awake otherwise.
  (i) Any two nodes in are connected either directly or indirectly through nodes that are the ’s 2-hop neighbors that have larger than ;
  (ii) Any node in has at least neighbors from .
 (7) Return.
Algorithm 1: Energy-consumption-based CKN (*run the following at each node *).