Skip to main content
. 2020 Feb 14;20(4):1025. doi: 10.3390/s20041025
Algorithm 3 Candidate Set Coordination
Input: CS (ni) //candidate set of node ni
Output: broadcast or drop the packet
  • 1:

    for each node in CS (ni) denoted by nj do

  • 2:

     calculate its Q-value according to Equations (5)–(10)

  • 3:

     Set its holding time according to Equations (11)–(12)

  • 4:

     RelayFlag = True // indicates that whether or not a node overhears a packet within its

         // holding time

  • 5:

    while (timer is not expired) and (RelayFlag) do

  • 6:

      if overhear that packet p has been sent by any neighbor then

  • 7:

       RelayFlag = False

  • 8:

      end if

  • 9:

    end while

  • 10:

    if (RelayFlag) then

  • 11:

     broadcast the packet

  • 12:

    else

  • 13:

     drop the packet

  • 14:

    end if

  • 15:

    end for