# Routing Selection Algorithm for Mobile Ad Hoc Networks Based on Neighbor Node Density
## 3 Node-Density-Based Routing Method  
### Aodv  
Ad hoc network protocols are protocols used to manage and control ad hoc networks, which are composed of many distributed nodes that can automatically discover and establish connections. These protocols facilitate data transmission and routing within the network. Depending on the discovery strategy, ad hoc network protocols can be categorized into proactive routing protocols, such as destination-sequenced distance vector (DSDV) [16] and optimized link state routing (OLSR) [17], and reactive (on-demand) routing protocols, such as ad hoc on-demand distance vector (AODV) [18; 19] and dynamic source routing (DSR) [20]. Due to the large amount of information that needs to be maintained in the node routing table, proactive routing protocols are not suitable for highly dynamic mobile ad hoc networks with frequent topology changes. Therefore, in this paper, the optimization of mobile ad hoc networks is based on the reactive (on-demand) routing protocol AODV. AODV can be seen as a combination of the DSR and DSDV protocols and consists of two main processes: route discovery and route maintenance. The entire routing process is primarily determined by the routing table, route request (RREQ), route response (RREP), route error (RERR), and HELLO messages. Route discovery: The source node initiates the route discovery process by broadcasting a route request (RREQ) message to its neighbor nodes. Each neighbor node checks its own routing table to determine if it has a route to the destination node. If it does, it unicasts a route response (RREP) message back to the source node, following the original path. If the neighbor node does not have a route to the destination, it continues broadcasting the RREQ message to its own neighbor nodes, and the process continues until the destination node is discovered. This process is illustrated in Figure 1. \begin{table}
\begin{tabular}{l l} \hline \(Nb_{i}\) & Number of neighbor nodes of node \(i\) \\ \(p_{i}\) & Probability \(p_{i}\) of the forwarding RREQ of node \(i\) \\ \(p_{r}\) & Randomly generated probability, used to compare with \(p_{i}\) \\ \(k\) & Constant threshold, for congestion detection \\ \(N_{ij}\) & Number of common neighbor nodes between node \(j\) and node \(i\) \\ \(N_{j}\) & Mean of the number of common neighbor nodes between sender \(j\) and its neighbor nodes \\ \(S_{i}\) & The set of neighbor nodes of node \(i\) \\ \(F(x_{i})\) & Theoretical cumulative probability distribution function \\ \(S(x_{i})\) & Empirical or observed cumulative probability distribution function \\ \(D\) & Statistical measure for the maximum difference between two different cumulative distribution functions \\ \(\hat{D}\) & The threshold for the maximum difference statistic of D \\ \(z\) & The \(z\)-score, utilized as a statistical measure to assess the relative position or deviation of a data point within a dataset \\ \(X\) & The value of the data point, used to calculate \(z\) \\ \(\mu\) & Mean of the dataset, used to calculate \(z\) \\ \(\sigma\) & Standard deviation of the dataset, used to calculate \(z\) \\ \(\triangle c_{j}\) & Standard deviation of the number of common neighbor nodes \(N_{ij}\) between sender \(j\) and its neighbor nodes \\ \hline \end{tabular}
\end{table} 
Table 1: General variables and parameters. Route maintenance: During the data transmission phase, nodes periodically send HELLO control messages to their neighbor nodes to maintain the routing table information. If a node becomes unreachable, it sends a route error (RERR) message to the source node to initiate route repair. If a node detects a change in the network, it sends the information to the appropriate node to update the routing information and maintain the connectivity of the network. This process is depicted in Figure 2.  
In AODV, the route request (RREQ) is broadcast to neighbor nodes, which means that every neighbor node receives the RREQ and forwards it further.