# A Robust Routing Protocol in Cognitive Unmanned Aerial Vehicular Networks
## 4 Proposed Routing Protocol
### Cluster Formation
#### 4.4.1 Node Move-In
Upon detecting a failure, the source UAV receives an error notification indicating the issue, prompting it to update its routing table by removing the faulty node from the list of viable routes. This adaptive mechanism guarantees continuous connectivity and reliable data delivery between the source and destination nodes. To maintain a robust connection, the source UAV dynamically adjusts its routing strategy, utilizing newly discovered or alternative paths for data transmission to the destination UAV. This adjustment is crucial for mitigating disruptions caused by link failures and ensuring uninterrupted communication in UAV networks. The algorithm emphasizes the importance of responsiveness to network dynamics, leveraging real-time metrics to optimize routing decisions and promptly addressing failures through efficient route discovery and adaptation processes. This approach ensures that UAV-based communication systems maintain high reliability and performance even in challenging operational environments. The Route Discovery Algorithm 6 begins by checking if the source UAV (\(UAV_{s}\)) is a Cluster Member (CM). If it is, \(UAV_{s}\) forwards the Route Request (RREQ) to the Control Node (\(CN_{s}\)) which then broadcasts the RREQ. Otherwise, \(UAV_{s}\) broadcasts the RREQ directly and initializes Path-Delay to 0. As RREQ messages are processed, each UAV (\(UAV_{x}\)) that receives an RREQ and is not a CM checks if the destination UAV (\(UAV_{d}\)) is within its neighborhood (\(UAV_{n}\)). If the destination is found, \(UAV_{x}\) calculates Link-Delay and updates Path-Delay, then sends the updated RREQ to the next UAV in the path until \(UAV_{x}\) reaches \(UAV_{s}\) where the path and delay are stored. If the receiving UAV is a CM, it broadcasts the RREQ. After processing all RREQ messages, if multiple paths are available, a Route-selection Algorithm determines the optimal route. The source UAV then sends messages to the destination UAV using the selected or available path. Considering the number of Cluster (\(n\)) and the Possible routes (\(m\)), the algorithm begins by checking if \(UAV_{s}==CM\). The complexity for forwarding the RREQ message is \(O(n)\). The broadcasting and receiving operations also have a complexity of \(O(n)\). Calculating path delays has a complexity of \(O(n)\) as well. Sorting the path for single cluster runs in \(O(1)=O(n)\) time. For \(m\) number of possible routes, the overall complexity of the algorithm is \(O(logm*n)\). ```
Input :\(Value_{max}=Path[1,1]\) Input :\(flag=1\) Output :[flag, 2] while\((n=2:P_{s}>Value_{max})\)do if\((Path[n,1]>Value_{max})\)then \(Value_{max}=Path[n,1]\); \(flag=n\); else Break; return[flag, 2];
```
**Algorithm 6**Route Selection Algorithm

### Route Maintenance Process

In our proposed route maintenance Algorithm 7, we address two types of disruptions: link failure and destination failure. When a link in the routing path breaks, the node preceding the broken link sends a route error message to the sender node. Upon receiving this message, the sender node removes the affected route entry from the Path array. It then eliminates all routes containing the broken link from the Path array. Subsequently, the sender node selects a new routing path using the Route Selection Algorithm (Algorithm 5) and utilizes this new route for message transmission. If no alternative route is found in the Path array, the sender node initiates a route discovery process (Algorithm 4) to identify new routes to the destination node. In the event of destination failure, which could result from the destination node's movement or malfunction, the neighboring node of the destination sends a destination error message to the sender node. Upon receiving this message, the sender node begins the route discovery process (Algorithm 4) to find new routes to reach the destination node.