For every node in the network
(1)   
(2)   if  
(3)   
(4)   end if
(5)   if  
(6)   compute and following (8) and (9)
(7)   ,
(8)   else
(9)   sleep
(10) end if
      For every candidate node
(11)  receiving a from candicate
(12) if   OR
(13)  add to neighbor set
(14) end if
      For every candicate node
(15) if  
(16)   give up the competition and become a normal node
(17) end if
      For every normal node
(18) if   is in one cluster_coverage
(19)     apply to join into the cluster
(19)     pay reputation value to the cluster head
(20) else
(21)    select cluster following (10)
(22)    pay reputation value to the cluster head
(23) end if
Algorithm 1: Cluster establishment.