Research Article

Efficient Data Collection Method in Sensor Networks

Algorithm 1

The initial node selection in wireless sensor networks.
Function: Select the initial nodes of m random paths
Input: Amount of node n
 Amount of random path m
Output: Index set S
Algorithm Description:
(1)rand(1 ∗ n);  //Randomly generate 1 ∗ n element vectors
(2)sort(n);  //Sort the 1 ∗ n elements
(3)foreach p ≤ m
(4)  k = randSelect(p, n);  //Randomly choose node k form n nodes
(5)  while k exists in S do
(6)   k = randSelect(p, n);
(7)  end while
(8)  S.add(k);  //Add node k to the initial index set S
(9)end foreach
(10)return S;  //Return to set S