Research Article

Routing and Clustering of Sensor Nodes in the Honeycomb Architecture

Algorithm 2

The hop index of the cells in the honeycomb cluster.
Notation:
V, F: integer
Input
[i, j]: Address of a cell
[H, J]: Address of the CH cell
Result: The hop index cell (L)
Begin
(1)If (j DIV i) < (J DIV H) then
(2)V ⟵ (J DIV H) − 1;
(3)LJ − (j + (( − i) ∗ V));
(4)Else
(5)V ⟵ (J DIV H) + 1;
(6)L ⟵ (j + (( − i) ∗ V)) − J;
(7)End if
(8)If L >  + i then /∗the cells cannot have L greater than  + i ∗/
(9)  F ⟵ (L DIV  + i);
(10)  If F > 1 then
(11)   j ⟵ j + 6 ∗ i;
(12)   Repeat the instructions from 1 to 7 to find L of the new value of [i, j];
(13)  Else L + i;
(14)  End if
(15)End if
(16)Return L;
End