# Routing in Mobile Wireless Sensor Networks: A Leader-Based Approach+
## 3 A Leader-Based Routing Approach (LBR)
### Building the Communication Tree  
The goal of our approach is to provide an efficient communication route from any node \(p\) to the root node \(s\) in scenarios where sensor devices are mobile. To do so, our approach creates a spanning tree \(T(t)\) with the root in the sink node \(s\). The spanning tree is continuously maintained in order to represent the best routing options at time \(t\) on the basis of the link quality information, providing a foundation for efficient routing by maximising the probabilities of successful communications, and henceforth increasing message delivery rates and reducing communication costs.  
Figure 1a-f illustrate how a spanning tree is built in situations of node movement, the arrival of a new node (Figure 1d), or a disconnection (Figure 1f).  
We now describe the algorithmic details of the approach. First, we focus on the common features of the two alternative protocols we propose in this work. Then, we devote two specific subsections to describe the different mechanisms used in each of the protocols. Please refer, for example, to the first of the protocols (Algorithms 1 and 2) to check the details of the common description.  
Both protocols are based on a broadcast primitive. Note that, apart from providing energy-efficiency in the multi-hop information dissemination [18], broadcast is also useful to detect changes in the neighbourhood.  
The sink node \(s\) is in charge of generating new rounds in the spanning tree reconfiguration. The spanning tree is created from the sink node \(s\), which is the root of the tree, to the rest of nodes.  
In this regard, \(s\) sends leader messages with refreshed round numbers each \(\beta\) time (see Algorithm 2). Every node \(p_{i}\) is continuously listening to the communication channel.  
Every node \(p_{i}\in V\) proposes its leader, denoted \(sinkBy_{i}\). Leader election is executed at every node \(p_{i}\) at time \(t\) such that \(sinkBy_{i}\in N_{p_{i}}(t)\) and has the minimum distance to \(s\) in the spanning tree \(T(t)\). Ties are broken on the basis of the node identifier.  
The explicit perception that a node \(p_{i}\) has about its connection with \(s\) is another common feature of both protocols. This perception is represented by the variable \(active_{i}\), which is \(True\) when \(p_{i}\) is connected. This explicit knowledge of connectivity is provided by the monitorization of the sink node \(s\) using the timer \(timer\_connectivity_{i}\). Each time a node \(p_{i}\) receives a new round identifier, \(p_{i}\) re-sets again the timer, denoting \(p_{i}\) as connected. Otherwise, if \(timer\_connectivity_{i}\) expires, \(p_{i}\) will consider itself as not connected.  
Observe that, while the round identifiers created by \(s\) lower-bounds the interval between two consecutive reconfigurations, \(timer\_connectivity_{i}\) upper-bounds the interval between two consecutive reconfigurations.  
In the following subsections, we describe the two implementations of our leader-based routing (LBR) approach, namely the reactive, eager version (LBR1) and the synchronous, lazy version (LBR2).