|
|
Algorithm 4: EBF, non initiator node. |
|
| 1: |
parenti = null; Wi = ∞; APi = ∅ |
| 2: |
while node i receives < j, Wj > message from node j
|
| 3 |
: if
parenti = null
then
|
| 4: |
parenti = j
|
| 5: |
Wi = Wj + costi,j
|
| 6: |
broadcast < i, Wi > |
| 7: |
else |
| 8: |
if ∃(j, x) | x ∈ ℜ Λ (j, x) ∈ APi) then
|
| 9: |
APi = APi\{(j, x)} |
| 10: |
end if |
| 11: |
if (Wi − (Wj + costi,j))/Wj ≥ α then
|
| 12: |
if
parenti ≠ j
then
|
| 13: |
APi = APi U {(parenti, Wi)} |
| 14: |
parenti = j
|
| 15: |
end if
|
| 16: |
Wi = Wj + costi,j
|
| 17: |
broadcast < i, Wi > |
| 18: |
end if
|
| 19: |
if
parenti ≠ j
then
|
| 20: |
APi = APi U {(j, Wj + costi,j)} |
| 21: |
end if
|
| 22: |
end if |
| 23: |
end while |
|