# Proactive Caching at the Edge Leveraging Influential User Detection in Cellular D2D Networks
## 4 Proposed Methodology
### Proposed Algorithm  
Algorithm 3 presents our proposed approach for centrality based D2D proactive caching. Initially, we model the system based on the procedure presented in Section 4.1. After designing the model (step 2), we apply the CC-GA algorithm (step 3) for identifying clusters in the network that returns a set \(C\) depicting the communities of the network (communities and clustering have the same meaning and we use them interchangeably). Afterwards, we initialize a matrix \(M\) (step 4) having the dimensions \((C\times U)\), where \(C\) represents the total number of clusters (\(C_{i}\) row contains the centrality values of cluster \(C_{i}\)) and \(U\) equals \(max(|C_{i}|)\). This matrix stores the centrality value of each node with respect to its community. Note that \(C_{i}\) has \(|C_{i}|\) values and the remaining indexes which are \(max(|C_{i}|)-(|C_{i}|)\) will have 0 entries. We also initialize an \(IU\) matrix to find and store the influential users. The dimensions of this matrix are \((C\times 2)\). Then, we call the compute centrality algorithm (step 5), presented in Algorithm 2, which returns a vector of centrality values (\(M^{\prime}\)) indexes by node labels that are in the form of integers. As we need matrix \(M\) for computing the influential users, we therefore compute it from \(M^{\prime}\) (step 6). We compute the primary influential users and secondary influential users from the matrix in each cluster and store them in the matrix (steps 7-10). The reason for finding secondary influential users is to ensure reliability of the system. In the end, we compute the popular content of influential users as described in Section 4.3 and load it into the cache (step 12).  
We see that the proposed Algorithm 3 relies on one primary influential user from one cluster, which raises important questions such as how many clusters the network has and how many users each cluster contains. To answer these questions, we present the distribution of community sizes in power-law networks in Figure 4. The figure shows the community sizes distribution of the network shown in Figure 2. We can see that the community size also follows a power law distribution that implies that there are no such communities who have either a large number of users that cover a great part of the network and neither there are such communities who have very few numbers of nodes. Taking this into consideration, we also follow network community size distribution to load the content in the cache of influential users. The user that has a greater community size has more content in the cache and vice versa.  
The cellular networks suffer from a network outage problem, which can be in the form of power failure, signal loss or link break down. For maintaining the reliability of the network, we also maintain a list of secondary influential users as shown in Algorithm 3. In case of network outage problems, the secondary influential users will be used for D2D communication.  
```
1:procedureD2D Proactive Caching
2:\(G=\) Model the system
3:\(C=\) CC-GA (G)
4: initialize \(M^{C\times U}\) and \(IU^{C\times 2}\)matrix by 0
5:\(M^{\prime}=\) Compute Centrality(G)
6: compute matrix \(M\) from \(M^{\prime}\)
7:for\(i\gets 1,|C|\)do
8:\(IU_{0}=max(M_{i})\)
9: remove(\(max(M_{i})\))
10:\(IU_{1}=max(M_{i})\)
11:endfor
12: Compute the popular content of influential users and load into cache
13:endprocedure
```  
**Algorithm 3** Proactive Caching