|
Algorithm 1 Tree Formation. |
-
1:
= ∅ ▹ initially parent is empty
-
2:
= ∅ ▹ initially buffer for parent is empty
-
3:
for each Node do ▹ is the set of all neighbor nodes of u in G
-
4:
if
is empty then
-
5:
if
<
then
-
6:
=i ▹ Assign current node as parent
-
7:
add i in
-
8:
end if
-
9:
else
-
10:
if ( < && <) && ≤
then
-
11:
=i
-
12:
add i in ▹ Add current node into the parent queue
-
13:
end if
-
14:
end if
-
15:
end for
-
16:
Sort according to distance and hop count
-
17:
for∀ each element in buffer do
-
18:
= Dequeue()
-
19:
Ack ←GetAcknowledgement()
-
20:
if (Ack ≠ Overflow) then
-
21:
Exit from loop and is the parent of u
-
22:
end if
-
23:
end for
|