Realization Of Swarm Behavior In Wireless Communication Systems And Ad Hoc Sensor Networks