Architecting a Sensor Network: Analysis and Implementation of the Algorithm for the Cluster Building