Skip to main content
. 2025 Aug 3;25(15):4773. doi: 10.3390/s25154773
Algorithm 3. Pseudocode of the binary label assignment procedure.
Procedure: AssignBinaryLabels(RootNode, MaxRings, K)
Input: RootNode: coordinator node, MaxRings: maximum number of rings, K: branching factor per node
Output: LabelMap: mapping from each node to its full binary label (InterID + IntraID)
Initialize Queue ← [RootNode]
Set LabelMap[RootNode] ← “000000”  // k bits InterID + 2 bits IntraID
Set RingLevel[RootNode] ← 0
While Queue is not empty:
   Parent ← Queue.dequeue()
   ParentLabel ← LabelMap[Parent]
   CurrentRing ← RingLevel[Parent] + 1
   If CurrentRing ≤ MaxRings then
      For i from 1 to K do
         Child ← GenerateChildNode(Parent, i)
          If Child ≠ null then
              InterID ← Binary(CurrentRing, k) // fixed k bits
              IntraID ← Binary(i, 2) // fixed 2 bits
                  Label ← InterID + IntraID
                  LabelMap[Child] ← Label
                  RingLevel[Child] ← CurrentRing
                  Queue.enqueue(Child)
          end if
      end for
   end if
end while
Return LabelMap