| Algorithm 5. Conditional Global Re-clustering with Persistent Tail-Hop Detection |
| Function ConditionalGlobalReclustering(round t) Construct Creach(t) from CHs whose route/status reports successfully reach the BS If ∣Creach(t)∣ = 0 Set ρtail(t) = 0 for numerical safety Mark this observation as a severe backbone reachability failure Store ρtail(t) for persistence evaluation Maintain the current topology Exit End if Calculate ρtail(t) from Creach(t) Store ρtail(t) for persistence evaluation Set persistenceFlag = false If ρtail(t − 1) ≥ θtail AND ρtail(t) ≥ θtail Set persistenceFlag = true End if If persistenceFlag = false Maintain the current topology Exit End if If t − lastReclusterRound < Trecluster_min Do not execute global re-clustering at this observation Maintain the current topology and keep the stored ρtail(t) Exit End if If ongoing local repair, handover, or CH-HELP control procedures are active Defer the global re-clustering request until the next global-maintenance entry point Exit End if Trigger global re-clustering Reset active node roles, including CH and member states. Clear routing tables and hop levels. Execute CH selection to select new cluster heads. Execute backbone route setup to rebuild the backbone routing topology. Update lastReclusterRound = t. End Function |