# A Proposal for IoT Dynamic Routes Selection Based on Contextual Information
## 3 Proposed Approach
### The RPL Protocol  
RPL is a network layer protocol and specifically designed to be used along with 6 LoWPAN. It operates under several mechanisms of the connection layer, including the IEEE 802.15.4 MAC and PHY layers [17]. Please refer to Table 1 for a description of the symbols used in the remainder of this section. \begin{table}
\begin{tabular}{c c} \hline \hline
**Symbol** & **Meaning** \\ \hline \(n\) & nodes connected to network \\ _Ns_ & set of network nodes \\ \(L\) & set links between nodes \\ _ni_ & node enabled to have a parent \\ _A(n)_ & set of progenitor nodes \\ _ns_ & root node \\ \(1\) & number of connections of _ni_ \\ _L(n)_ & set of connections to candidate nodes \\ _aj_ & node selected as parent \\ _ap_ & node selected as child \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Symbols definition. An IoT scenario with RPL can be modeled as a graph \(G=(N,L)\), where \(N\) is the set of \(n\) network nodes (excluding the root node) and \(L\) is the set of connections that link such nodes. The graph \(G\) represents the creation of the network topology including the created routes and sent messages. For each \(ni\in N\) (\(i=1,2,...,n\)) there is a set \(A\) that contains nodes enabled to be candidates to become the parent node of another node. This process is performed based on the rank of each node. The rank is a number that identifies the position of a node in the topology relative to the other nodes and to the root of the graph. The use of ranks makes it possible for a node to differentiate its position from the parent nodes and sibling nodes. It consolidates a mechanism where a node decides its parent node according to the smaller rank, which is defined as an integer representing the individual position of the node within the graph \(G\). This parameter increases its value as it descends in the network topology. The nodes involved in the creation of this topology are represented by Expressions (2) and (3):  
\[N\ =\ \{n1,\ n2,\ \ldots,\ nn\} \tag{2}\]  
\[A(ni)\ =\ \{a1,\ a2,\ \ldots,\ am\} \tag{3}\]  
where:  
\(\bullet\)\(N\) is the set of nodes of a network;  
\(\bullet\)\(A(ni)\) is the set of progenitor nodes of a given node. Considering that \(A\) is a subset of the total number of nodes, then, \(A(ni)\subset N\). The root node represented as \(ns\), is the only node from the network which has no list of candidates because sent messages only downward direction; that means its subset is empty, Equation (4):  
\[A(ns)=\emptyset \tag{4}\]  
For each \(ni\) node there is a set of \(m\) connections \(l\) equal to the number of candidate nodes, as demonstrated in Equation (5). This means that each node has a number of connections (edges) corresponding to the number of nodes that are candidates to be progenitors. For example, if a node has a connection to six other nodes, there are six candidates to be progenitors. In a set \(L\) there is an \(l\) connection that belongs to \(L(ni)\). Therefore, the conclusion is that \(aj\) belongs to \(A(ni)\), where \(aj\) is the candidate node selected to be the parent node of \(ni\). \[L(ni)=\{l1,l2,\ldots,\ln\} \tag{5}\]  
In Equation (6), each connection (represented by \"\(l\)\") has a rank, which equals the rank calculated in the \(ni\) node in relation to a selected parent node \(aj\) (\(j=1,2,\ldots,m\)). The rank is obtained based on the position of a node in the topology regarding the other network nodes. In this case, a node decides who is its parent node according to the lowest rank. \[l(ni,aj)=rank \tag{6}\]  
Equation (7) must be followed because a candidate node can be selected as a parent node. In this case, when the rank of a node \(ap\) (receiver node) is greater than the rank of \(aj\) (sender), the \(ap\) accepts \(aj\) as its parent node, creating through it a path to \(ns\) (root node). Otherwise, it rejects the transmitter as its parent node.