Ad hoc networks consist of a number of devices equipped with one or more wireless interfaces, which cooperate to provide wireless communications among them. Nodes which are not in the radio range of each other use other intermediate nodes as relays to find multi-hop paths towards a destination.
Unlike ad hoc networks, in sensor networks the devices are usually static. However, the way they work based on off, on and idle states, makes the topology variable. In addition, usually available resources are lesser, and the scalability of the solutions becomes a very important factor. This creates the need for localized algorithms rather than global or centralized ones.