## 3 System Model Design
### Community Structure Contraction Strategy
After the contraction of the structure, the network scale decreases, and the nodes in the network structure have very close relationships. When information is transmitted and data is forwarded, the number of copies of the forwarded data can be determined according to the sociality of the nodes. The sociality of node is defined as:

\[S_{B}\left(v_{i}\right)=S_{b}\left(v_{i}\right)/\left[\left(N-1\right)\left[N -2\right]/2\right] \tag{4}\]2

In the formula, \(link\left(i,j\right)\) is defined to be the connection status of node \(v_{i}\) in the community. If there is a node \(v_{j}\) connected to node \(v_{i}\), then \(link\left(i,j\right)=1\), otherwise \(link\left(i,j\right)=0\). If node \(v_{i}\) is not in a defined community, the nodes that the link function compares is all the nodes in the entire network. Such a measure strategy distinguishes between nodes in the community and nodes outside the community. In the ESR algorithm, the minimum number of copies required to achieve the expected time delay is independent of network size N and propagation range K, only depending on the number of nodes M in the network. Many studies have shown that the number of copies required only depends on the number of nodes, and the number of messages is an important index affecting the algorithm. Reference [26] gives the following formula, where M is the total number of nodes, and \(H_{n}^{r}=\sum_{i=1}^{n}\frac{1}{\tau}\). \[S_{B}\left(v_{i}\right)=S_{b}\left(v_{i}\right)/\left[\left(N-1\right)\left[N -2\right]/2\right] \tag{4}\]3

In the first process, sending n copies of the data to each node can easily lead to oversizing. Aiming at this problem, this paper proposes a copy-allocation method based on community division,a reduction strategy of copy, and copy distribution based on the following formula, with L as the number of available messages that the node currently has:

\[\left\{ \begin{array}{l}T_{i}=\left(L-1\right)\frac{c_{i}}{c_{i}+c_{j}}\\ T_{j}=\left(L-1\right)\frac{c_{j}}{c_{i}+c_{j}}\end{array} \right. \tag{15}\]

In the second process, the source node sends information to all its neighbors. If the neighboring node is within the community, the copies of the data are propagated through the community. If not, the data information is forwarded to the meeting node. All data copies are allocated according to formula (15), and the forwarding process ends when the target node gets a copy of the data. Because of the social feature of the opportunistic social network, in the first process, we distribute copies of data through the community. The number of data copies will not cause overflow, and the expected packet delivery ratio and transmission delay can also be achieved. In the second process, the data-forwarding speed and communication link stability in the community are very good. Relative to the transmission of information between single nodes, the ESR algorithm is transmitted through the community, which can improve the speed of information transmission. At the same time, since relatively stable community structures can be thought of as trusted institutions, message transmission within communities is safe. The simplified pseudo-code for this part is as follows (see Algorithm 2):

```
1:subgraph \(G_{n}\)
2:adjusted subgraph \(G_{n}\)
3:For each group \(\boldsymbol{do}\) //delete inefficient node
4: For each node \(V_{i}\) do
5: Calculate the importance \(IM\left(v_{i}\right)\) of node \(V_{i}\)
6: If \(IM\left(v_{i}\right)<\tau\)
7: Delete node \(V_{i}\)
8: End If
9: End For
10: For each node pair \(e=\left(v_{i},v_{j}\right)\) // structure-shorten
11: Calculate distance \(D_{ij}\)
12: Calculate initial network cohesion \(\varphi\left[G\right]\) and \(\varphi\left[G*V_{i}\right]\)
13: If the value of \(V_{i}^{\prime}\) is bigger than \(\varepsilon\) then
14: replace \(V_{i}\) and its neighbor with a new node \(V_{i}^{\prime}\)
15: End If
16: End For
```

**Algorithm 2** Community based data-forwarding algorithm

In this algorithm, time complexity is O(\(n\)).