# An Information Entropy Based Event Boundary Detection Algorithm in Wireless Sensor Networks
## 4 Proposed Algorithm  
### The Statistical Boundary Detection Model  
Our goal is to design a distributed algorithm for a single node to decide whether it is a boundary sensor by comparing the sensing information with its neighbour sensor nodes. Without loss of generality let us maximize the local boundary region of a single boundary node in Figure 1, where the actual boundary can be considered a straight line. We use the nearest boundary tangent of the boundary node instead of the actual boundary of a single node. Because the event region is generally much larger than the neighbour area of a given node, the neighbour area refers to the area that a node can cover within its communication radius.  
As illustrated in Figure 2, \(r\) is the boundary width and if an only if \(S_{i}\) lies within \(r\), can it be considered as a boundary sensor. Let \(\rho\) denote the expected number of sensor nodes deployed per neighbour area of \(S_{i}\), called network node density. Let \(\mathbb{N}_{S_{i}}\) denote the neighbour nodes set of sensor node \(S_{i}\). The sensors in the event area are denoted as affected nodes and the remaining nodes as normal nodes.  
If a node is located exactly on the actual boundary, its neighbour nodes would have half nodes as affected nodes while the other half as normal nodes under the condition of large-scale dense sensor node deployment. In other words, such a node has a high probability of being a boundary node. However, there is a need for a determination rule to figure out whether a node belongs to \(B(S_{i},r)\). Thus, a proper range of proportion is needed to measure how close a node is to the actual boundary. In order to formulate this problem, let us introduce an entropy function \(H(p)\) to evaluate the probability of a sensor node is a boundary sensor node. The entropy is used as a sort of probability variable that evaluates the distribution of the sensors in the neighbourhood of a given sensor. According to Reference [20], \(H(p)\) is computed as  
\[H(p)=-\sum_{i}p_{i}\log p_{i} \tag{1}\]  
where \(p_{i}\) denotes the categories of nodes among the neighbour nodes with \(i=0,1\). Let \(i=0\) represent the category of normal nodes, while \(i=1\) represents the affected nodes, respectively. Then \(p_{i}\) is computed as  
\[p_{i}=k_{i}/(p_{i}-1) \tag{2}\]  
Figure 2: An illustration of Boundary Detection Model.  
where \(k_{i}\) is the number of \(i\) status nodes and \(\rho_{i}\) is the network node \(i\) density. In our case, there are total two possibilities with \(p\) and \(q=1-p\), where \(p\) denotes the ratio of affected nodes among total neighbour nodes, while \(q\) denotes the normal ones. So \(H\) can be reduced by  
\[H=-(p\log p+q\log q) \tag{3}\]  
which is schematized in Figure 3 as a function of \(p\).  
It appears that the derived values of the entropy as denoted in (3) play an important role in calculating the probability that a sensor node can be defined as a boundary node:  
1. \(H=0\) if and only if all the \(p_{i}\) but one are null. This means that all the neighbours of \(S_{i}\) are entirely affected or absolutely normal. Otherwise, if \(H\) is positive, that is, node \(S_{i}\) has the probability to be a boundary node. The higher the value of \(H\) is, the closer the node is to the actual boundary.
2. When all the \(p_{i}\) are equal (i.e., \(p=q\)), the value of \(H\) is the largest and is \(\log 2\). This is also intuitively the higher probability a node to be a boundary node.
3. Any change towards equalization of the probabilities \(p\), \(q\) increases \(H\).  
Figure 4 is a relationship diagram of the value of H and the number of neighbour nodes. Figure 4 shows that entropy \(H\) and the number of neighbour nodes are positively correlated.  
Figure 3: The characteristics of the H function.