## 4 The Proposed Routing Algorithm
### Forwarding Algorithm  
The proposed forwarding algorithm, based on packet delivery predictability and social strength, is presented in Algorithm 1. The notations used in the algorithm are defined in Table 2. \begin{table}
\begin{tabular}{c l} \hline \hline
**Notation** & **Meaning** \\ \hline \(DP(u,v)_{t}\) & The packet delivery predictability between node \(u\) and node \(v\) in time slot \(t\) \\ \(s(u,v)\) & The social strength between node \(u\) and node \(v\) \\ \(D_{u}\) & The degree centrality of node \(u\) \\ \(c_{u}^{p}\) & The forwarding token of node \(u\) for packet \(p\) \\ \(\mathbb{S}_{u}^{NB}\) & The set of neighboring nodes of node \(u\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Notations used in the proposed forwarding algorithm. Assume that node \(u\) wants to send packet \(p\) to edge node \(v\). First, the neighboring nodes of node \(u\) are checked. If the destination is listed in the neighboring nodes, the packet is delivered to the destination. Otherwise, the forwarding process is executed following Algorithm 1. In the forwarding algorithm, a forwarding token for packets is used to limit the number of copies of packets in the network similarly in [11; 15]. Specifically, when a node generates a packet, it also assigns a forwarding token to the packet. The forwarding token's initial value is \(C\). Let \(c_{u}^{p}\) represent the forwarding token for packet \(p\) of node \(u\). The forwarding algorithm is processed in two phases based on the value of \(c_{u}^{p}\). In phase 1, i.e., when \(c_{u}^{p}>1\), packets are quickly spread in the network, and degree centrality is used to update the forwarding token's value. In phase 2, when \(c_{u}^{p}=1\), relay nodes are selected based on packet delivery predictability and social strength. Specifically, in phase 1 when \(c_{u}^{p}>1\), node \(u\) selects node \(i\) in \(\mathbb{S}_{u}^{NB}\) as a relay node and forwards a copy of packet \(p\) to node \(i\) without consideration of any other condition in line 4. Based on the social strength between nodes, a social graph is constructed. In the social graph, vertices are nodes, and there is a link between two nodes if their social strength is greater than zero. The degree centrality of a node is defined as the number of links between itself and other nodes in the social graph. To update the forwarding token's value, degree centrality is used. Let \(D_{u}\) and \(D_{i}\) represent the degree centrality of node \(u\) and the degree centrality of node \(i\), respectively. The forwarding token's value assigned to the copy of packet \(p\) at node \(i\) is denoted as \(c_{i}^{p}\), which is calculated as follows:  
\[c_{i}^{p}=\min(\max(c_{u}^{p}\times\frac{D_{i}}{D_{i}+D_{u}+\epsilon},1),c_{u}^ {p}-1) \tag{3}\]  
where a very small value, \(\epsilon\), is added to avoid the denominator being zero. According to Equation (3), \(c_{i}^{p}\) is limited to values between \([1,c_{u}^{p}-1]\), and a node with a larger value for the degree centrality will be assigned a greater forwarding token's value. In the real context, a node with a high degree of centrality has a greater likelihood of connecting with other nodes. If it has a large value for the forwarding token, copies of the packet will quickly spread throughout the network. That supports minimizing \(PDL\) and enhances the possibility of delivering the packet to its destination. In Algorithm 1, \(c_{i}^{p}\) is calculated in line 5, and \(c_{u}^{p}\) is updated in line 6 (i.e., \(c_{u}^{p}=c_{u}^{p}-c_{i}^{p}\)). In phase 2, when \(c_{u}^{p}=1\), the packet delivery predictability are compared in line 8. If node \(i\) has a greater packet delivery predictability with edge node \(v\) than node \(u\) (i.e., \(DP(i,v)_{t}>DP(u,v)_{t}\)), node \(i\) is chosen as a relay node for packet \(p\) in line 9. Otherwise, if \(DP(i,v)_{t}=DP(u,v)_{t}\), social strengths are compared in line 10. Specifically, if \(DP(i,v)_{t}=DP(u,v)_{t}\) and \(s(i,v)>s(u,v)\), node \(i\) is selected as a relay node for packet p in line 11.