(*For each node )
Pick a random rank .
Broadcast and receive the ranks of its currently awake neighbors . Let be the set of these ranks.
Broadcast and receive from each .
If < or < for any , remain awake.
 Return.
Compute and ;
Go to sleep if both the following conditions hold. Remain awake otherwise.
 (i) Any two nodes in are connected either directly themselves or indirectly through nodes within ’s
  2-hop neighbors that have larger than ;
 (ii) Any node in has at least neighbors from .
Return.
Algorithm 2: Connected K neighborhood (CKN).