# Improving Traffic Load Distribution Fairness in Mobile Social Networks
## 4 TraLDA Design
### TraLDA Distributed Algorithm  
In TraLDA, we combine a node's inherent popularity and social-relations popularity to assess its global popularity. The instantaneous global popularity of node \(I\) in time window \(t\), denoted by \(P^{t}_{global}(i)\), is represented by  
\[P^{t}_{global}(i)=P^{t}_{intr}(i)+\xi\cdot P^{t}_{soc}(i) \tag{16}\]  
where \(P^{t}_{intr}(i)\) and \(P^{t}_{soc}(i)\) are node \(i\)'s inherent and social-relations popularity, respectively, in time window \(t\), and \(\xi\) is a social influence factor which controls the impact of neighbours' influences on the overall \(i\)'s popularity and is defined between \(0\leq\xi\leq 1\). When \(\xi=0\), neighbours' influences disappear, and the node's global popularity is solely dependent of its own behaviour. The metric \(P^{t}_{global}(i)\) is further used by TraLDA to select optimal relays during node contacts.  
We now discuss how TraLDA is implemented in a distributed environment. In self-organizing networks such as mobile social networks, a node should be able to perceive its immediate neighbours autonomously. In TraLDA, we use the terminology \"familiar set\" in [50] to refer to a node's group of friends (direct neighbours) (hereafter, called a _friendship set_\(F\)). Every node stores a map of the contacted nodes together with their total encounter times. When the pairwise total contact time surpasses a given friendship threshold \(F_{th}\), the contacted node is added in the given node's friendship set. This implies that the two nodes now have a link, and in turn, we apply a direction and a weight on this connection to indicate the direction of social impact and the strength of the tie between them, respectively. Finally, in Algorithm 1 we describe how to calculate node popularity in mobile social networks using the TraLDA distributed algorithm. When a contact occurs in time window \(t\) and the contacted node is in the current node's friendship set, the two nodes exchange two items of data to compute their social-relations popularities: \(\overline{P}^{t-1}_{global}(\cdot)\) the mean of global popularity in time window \(t-1\), and \(ts_{lower}(\cdot)\) the total strength of connections to the less popular neighbours. The latter is computed as \(\sum_{k\in F(j)}\stackrel{{\rightarrow}}{{g_{jk}}}\cdot w_{jk}\), where \(k\) is the direct neighbours of \(j\), \(w_{jk}\) is the connection strength of \(j\) and \(k\), and \(\stackrel{{\rightarrow}}{{g_{jk}}}\) is the existence of influence of \(j\) towards \(k\). The current node modifies its social-relation popularity and then recalculates both its instantaneous global popularity and cumulative average global popularity based on this peer's data. When the contact ends, if the contacted node is not in the friendship set yet, then the current node updates a map \((peer,ts(peer))\). Finally, the peer will be added to the friendship set when \(ts(peer)\) exceeds the threshold \(F_{th}\) (the implementation of the TraLDA distributed algorithm in the ONE simulator is available online at [[https://github.com/soelistijanto/TraLDA](https://github.com/soelistijanto/TraLDA)]([https://github.com/soelistijanto/TraLDA](https://github.com/soelistijanto/TraLDA)) (accessed on 14 June 2022).  
```
require : \(P^{0}_{soc}(i)\gets 0\), \(\overline{P}^{0}_{global}(i)\gets 0\) while \(i\) encounters / in time window \(t\)do /*update current node's global popularity based on the peer's information*/ if\(j\in F(i)\)then  send \((\overline{P}^{t-1}_{global}(i)\), \(ts_{lower}(i))\) receive \((\overline{P}^{t-1}_{global}(j)\), \(ts_{lower}(j))\) calculate \(P^{t}_{soc}(i)\) (14) calculate \(P^{t}_{third}(i)\) (9)-(12) calculate \(P^{t}_{global}(i)\) (16) calculate \(\overline{P}^{t}_{global}(i)\) (15) endif /* exchange instantaneous node global popularity */ send \(P^{t}_{global}(i)\) receive \(P^{t}_{global}(j)\) /*when the contact ends*/ if\(j\
otin F(i)\)then update map (\(j\), \(ts(j)\)) if\(ts(j)>F_{th}\)then\(F(i)\gets j\) endif endif endwhile
```  
**Algorithm 1**TraLDA node global popularity calculation (\(i\)).