# A Robust Routing Protocol in Cognitive Unmanned Aerial Vehicular Networks
## 4 Proposed Routing Protocol
### Cluster Formation
#### 4.4.1 Node Move-In
Then it checks if the leaving Central Node belongs to neighboring UAVs then it checks if the number of nodes is more than one, and the leaving UAV informs the leaving central node about the leaving information. While the \(CN_{l}\) leaves, it checks if the non-leaving members (\(CM_{nl}\)) do not belong to the leaving central node's subset and non-leaving cluster members belong to the neighboring central node. If the channel of a non-leaving node is higher than one, the non-leaving cluster members are selected by its CNRF and the leaving central node requests the non-leaving member to be its Nearest Node. The non-leaving members then forward this message to the non-leaving central node (\(CN_{nl}\)) and the \(CM_{nl}\) becomes the NN to maintain the connectivity. ```
START: \(UAV_{l}\) broadcasts LEAVING DECISION to \(UAV_{n}\); if(\(CN_{l}\in UAV_{n}\))then if(\(l>1\))then \(UAV_{l}\) informs \(CN_{l}\) regarding leaving; while\(CN_{l}\)do if(\((CM_{nl}\
otin CN_{l})\)and(\(CM_{nl}\in CN_{n}\)))then if(\(nl>1\))then \(CM_{nl}\) with highest CNRF is selected; \(CN_{l}\) requests \(CM_{nl}\) to be NN; \(CM_{nl}\) forwards request message to \(CN_{nl}\); \(CM_{nl}\) becomes NN; else  goto 10; else \(CN_{l}\) sends message to \(CM_{l}\) for other cluster in \(CM_{n}\); if(\(CN_{nl}\in CM_{n}\))then \(CM_{l}\) forwards request message to \(CN_{nl}\); \(CM_{l}\) becomes NN; elseif(\(CM_{nl}\in CM_{n}\))then \(CM_{nl}\) forwards message request to \(CN_{nl}\); \(CM_{l}\) becomes NN; \(CM_{nl}\) becomes NN; continue;  end;  end; else if(\(NN_{l}<UAV_{n}\))then goto 6; else if\(UAV_{l}\) is \(SCN\)then \(UAV_{l}\) selects a new SCN from CM; else \(UAV_{l}\) leaves the cluster;  end; else \(UAV_{l}\) informs all CM; SCN becomes CN;  New SCN is selected based on CNRF from CMs. END
```
**Algorithm 4**Node Move-Out

Otherwise, leaving the Central node sends a message to the leaving cluster member for the neighboring member list. if the leaving central node belongs to the neighboring cluster member, then the cluster member forwards the request message to the leaving central node. The leaving member then becomes the Nearest Node (NN). Otherwise, if the non-leaving cluster member forwards a message request to the non-leaving central node the leaving cluster member then becomes the NN along with the non-leaving cluster member for safer connectivity. If the \(NN_{l}\) is less than the number of \(UAV_{n}\) then it follow the same procedure from line 6. Otherwise, it checks if the leaving UAV node is the cluster's secondary Central node or not, if it is then a new SCN is selected from the cluster members, or else the node leaves the cluster. If the leaving cluster node not belong to the neighboring UAVs, the leaving UAV simply informs all the cluster members and the SCN becomes the new central node and a new SCN is selected based on the CNRF from the CMs. ## 5 Route Selection and Maintenance Process

In cognitive radio ad-hoc networks (CRAHN), routing protocols face unique challenges due to the unpredictable nature of primary user (PU) activity, which influences spectrum availability. Unlike traditional ad-hoc networks, CRAHNs require routing protocols tailored to handle these challenges effectively. In our network, PUs hold priority in spectrum usage, compelling secondary users (SUs) to swiftly switch channels upon detecting PU transmissions. Additionally, SU radios may need to switch channels during communication due to spatial spectrum variations. Therefore, routing protocols must account for channel switching time, which is the time needed to tune radios to new channels. Moreover, protocols should consider delays caused by queuing and back-off, where back-off delay arises from interference and queuing delay stems from node transmission capacity on specific channels. A crucial task of cognitive radios is to analyze nearby spectrum and predict PU activity to minimize route interruptions. Consequently, routing protocols must factor in spectrum availability to gauge route stability effectively.