1 Introduction

With the rapid development of social media in 5G communication, online social networks have become very important information dissemination platforms. Through these platforms, people can exchange ideas and share information such as pictures, videos, and text at any time. Social networking sites (such as FaceBook, Twitter, and Google plus) support the information-sharing activities of billions of users every day. This information will be converted into data and accepted, stored and sent by other users. In the course of these activities, individuals and organizations have transformed from message producers to message producers, providing a data source for society, which also means that their roles are also changing. During the transmission of messages, individuals and organizations must cooperate with each other to complete the forwarding of information [1].

Opportunistic social networks are an offline conversion form of social networks. They belong to intermittently connected networks, have mobility, openness and sparseness, and rely on the opportunity to encounter nodes to forward data [2]. Therefore, the opportunistic social network can realize the distribution and transmission of information without a continuous and stable end-to-end connection environment, thereby better responding to the intermittent, delay and high error rate characteristics of information transmission in wireless communications [3,4,5]. However, with the development of social networks, the diversity of various network applications has made the network larger and larger, and the number of nodes and data has also increased dramatically. The collection and processing of data adds a burden to the network [6,7,8,9,10,11].

Generally, the number of nodes’ caches is limited. During communication, people use portable mobile devices to move around the network. Nodes rely on encounters to implement data forwarding. The message passing state is directly related to the encounter probability of the cooperative nodes, but there is no stable connection link between the cooperative nodes. When there is no suitable transmission target or the transmission target does not respond within the transmission range, the device saves the data in the cache and finds a suitable cooperative node for data forwarding [16,17,18]. In the process of finding forwarding nodes, data storage will take up a lot of buffer space. On the one hand, some information may be in a state where no user accepts or responds for a long time, and the target node cannot receive the data in a timely manner. On the other hand, because the cache space is occupied by much useless stranded information, new information cannot be updated in a timely manner, resulting in higher overall network latency [19, 20]. In addition, due to the limited resources, computing power, and energy of nodes, the behavior of nodes in social networks tends to be selfish. When nodes are only interested in their own interests, they are usually reluctant to provide their own resources to forward information to other nodes. Affects the network performance of the entire system [21, 22]. Table 1 lists the existing methods in social networks.

Table 1 Comparison of existing methods

In order to solve the above problems, most of the current researches focus on selecting appropriate routing and forwarding algorithms, selecting reliable cooperative nodes for data forwarding during node movement, and reducing the occupation of cache resources through irrelevant information, thereby improving data transmission. Efficiency, reducing network latency and reducing malicious relays. The state of message passing is closely related to the chance of encountering the target node. Therefore, in order to improve the efficiency of message forwarding, the probability of satisfying nodes must be evaluated to ensure that high-probability nodes obtain information preferentially. In fact, the similarities between people often reflect their social relationships. People with the same characteristics of interest are more likely to use the same route, such as going to the same ball games and buying the same clothes, so these users should hold more meetings and exchange information. By analyzing and comparing node preferences and behaviors, and forwarding data to nodes with higher similarity, it can help to effectively select reliable relay nodes, so that route forwarding can achieve successful message forwarding with fewer hops. This reduces the occupation of resources by redundant information. In addition, since similar users have similar sensitivities to information, filtering nodes that are highly matched with information attributes can effectively increase the demand for messages by relay nodes, reduce the use of cache space for messages that are not related to the node, and improve utilization of cache space [23].

Therefore, this paper proposes Historical Behavior Prediction method (HBP) in opportunistic social networks. By calculating the preference matching method, an effective data transmission mechanism is implemented to ensure that nodes with a higher probability of encountering obtain data information first, reduce redundant copies of information in social networks, improve the utilization of message cache space, and effectively reduce communication Latency and overhead.

The contributions of this article include:

  1. (1)

    A social network is used to establish nodes preference model based on user historical messages. When node select relay neighbors, they select nodes with a high matching value as relay neighbors by matching the similarity of nodes, so that information forwarding can pass through less cooperation node.

  2. (2)

    In the preference similarity matching, an attention mechanism is introduced to dynamically adjust the preference model according to the information attributes, improve the sensitivity of the relay node to the information, and reduce malicious relay.

  3. (3)

    Based on the simulation results, the performance of the HBP algorithm is analyzed and compared with the Spay and wait algorithm, the EIMSP algorithm, and the Epidemic algorithm. The ICPP algorithm shows enhanced performance in improving the delivery rate, end-to-end delay, and overhead.

2 Related works

At present, many foreign scholars have researched various aspects of social network routing and forwarding algorithms based on the working mechanism of “carry-store-forward” of information in nodes. Among them, these routing and forwarding algorithms are divided into zero information type and information auxiliary type. In the message forwarding process, the zero-information routing algorithm depends only on the chance of meeting between nodes. It does not require nodes to provide information. It mainly includes flood-based routing and forwarding strategies, direct-pass routing algorithms, and routing algorithms based on fixed message copies. In a flood-based routing mechanism, a large number of messages are replicated and forwarded to each node that meets the minimum messaging delay requirements [12, 13]. However, in the case of limited network resources, a large amount of redundant information will occupy a large amount of bandwidth, resulting in a decrease in the performance of the network resources.

In the routing based on the fixed message copy, Wang Innovatively proposes to distribute a certain number of message copies in the network, and divides the message forwarding into two phases: the spraying phase and the waiting phase. When nodes meet, the amount of data carried will be executed. Half are passed to the other party. When the number of message copies is 1, it waits for data transmission. [14] This algorithm improves the problem of massive message redundancy and resource waste caused by the flooding mechanism, and achieves lower latency, but as the number of message copies increases, the overhead of node data transmission also increases. The design idea of the zero-type forwarding algorithm is intuitive and easy to implement, but in the forwarding process, factors such as the attributes of the transmitted data and the characteristics of the participating forwarding nodes will not cause the algorithm’s poor performance in the following aspects: forwarding overhead, delivery Speed and latency. The current type of information assistance has become the current mainstream direction.

According to different information attributes, the information-assisted routing and forwarding algorithms can be further divided into routing algorithms based on information attributes, routing algorithms based on node information, and routing algorithms based on topology information. Yu et al. proposed an NSFRE model [15]. This model constructs a feature vector similarity matrix based on the social attributes between nodes, and iteratively calculates matching scores to build a trust routing table for message forwarding, and chooses a greater possibility to forward messages Writing nodes to the destination node solves the problems of information flooding and node non-cooperation in node forwarding.

Luo proposed a utility-based cache management algorithm (UBM) [16], and devised a method to calculate message validity based on the probability of message attributes and node interest characteristics, and to manage the entire buffer based on the valid values. UBM is a receiver-driven policy that implements both active and passive discard policies for sender scheduling. Experiments show that UBM can achieve higher transmission rates and lower latency, and has fewer networks overhead. However, in order to reduce the content sharing delay in this mechanism, most information is only placed in the central area of ​​the network, so user caches in these areas are heavily occupied, and network performance is significantly reduced.

In addition, Wu et a proposed a hierarchical collaborative caching method in mobile social networks [17]. This method divides user cache resources into local areas, friend areas and unfamiliar areas according to information sources, and uses different cache replacement strategies to manage different Cache area. Increase effective information service cache occupancy. However, when the cache resources in the unfamiliar area are insufficient, the mechanism will randomly replace the content in the cache area, thereby reducing the efficiency of content sharing in the unfamiliar area and reducing the cache utilization rate.

Based on the user’s social attributes, Wang proposed a method of forming a virtual community based on the same or similar users to increase the possibility of communication with users in the community [18]. However, users in different communities are unlikely to communicate or may not communicate. Most importantly, due to different user attributes, even users in the same community have different needs for content. Therefore, when looking for cooperative forwarding nodes, it is necessary to consider various factors that affect users’ ability to share information.

Based on the above research and existing problems, this paper proposes a routing and forwarding algorithm based on the user’s historical state and user interest model to ensure that nodes with high probability are obtained.

3 System model design

This paper considers opportunistic social networks with m nodes. The characteristics of node-based wireless communication, the network is modeled as a unit circle graphG0=(V0,E0).The setV0 contains all nodes in network, and the setE0includes all edges in network. There is an edge between two nodes if and only if the distance between them is less than or equal to the maximum transmission distance.

Assuming that the time between the nodes is synchronized, the scheduling time is divided into several time slices of the same length. Each node can finish sending or receiving a piece of data in a time slice. This paper regards the physical interference model as the signal interference model, that is, when a node’s signal to noise ratio is not lower than a certain threshold, the node can correctly decode the required signal.

This paper research the broadcasting problem of opportunistic networks, among which the source node needs to transmit its data to all sensor nodes at time slice 1. When all sensor nodes receive data from the source node, the broadcast task is complete. Broadcast scheduling is used to allocate the transmission time slice of each node. The goal of this paper is to determine how to optimize the latency that all nodes receive source node data and ensure that the scheduled data transmission signals do not interfere with each other.

Definition 1

BDPIM(Broadcast Delay under Physical Interference Model) question, Given the wireless networkG0=(V0,E0)and a source node j, under the physical interference model, a broadcast algorithm is designed so that all nodes can receive data from the source node with the lowest broadcast delay.

Existing work has proved that the BDPIM problem is an NP-difficult problem, it is impossible to design an optimization algorithm for polynomial time. In order not to increase the time complexity of the algorithm and to optimize the performance of the algorithm as much as possible, a low-latency broadcast algorithm with polynomial time needs to be designed.

In opportunistic social networks, nodes use the “storage-carry-forward” routing mode to implement inter-node communication. When we analyze the nodes in opportunistic networks, we must first know its characteristics. Therefore, we point out that all social network nodes meet the following conditions.

We can define that at times, the modularity of the community can be expressed as

$$ U(s)=\frac{mE}{M}-\frac{lt^2}{4{M}^2} $$
(1)

Among them, U is the modularity of the community. M is the total weight of the edge. mE represents total weight of edges in community E. lt express the total level of node S in the community.

Condition 1

If the node is a node in opportunistic complex networks, then as the weight of edges formed with other nodes in the network increases, the total edge weight mE of the community will increase. This will increase the relevance degree of the community in the opportunistic networks.

Proof 1

At times, the modularity in the community is U(s), then the change in modularity after times + 1can be expressed as:

$$ U(s)=\frac{me+\varDelta m}{M+\varDelta m}-\frac{{\left( lt+2\varDelta m\right)}^2}{4{\left(M+\varDelta m\right)}^2} $$
(2)

Then

$$ {\displaystyle \begin{array}{c}\begin{array}{c}U\left(s+1\right)-U(s)=\frac{m_e+\Delta m}{M+\Delta m}-\frac{{\left({l}_t+2\Delta m\right)}^2}{4{\left(M+\Delta m\right)}^2}-\left(\frac{m_e}{M}-\frac{l_t^2}{4{M}^2}\right)\\ {}=\frac{4{M}^3\Delta m-4{M}^2{l}_t\Delta m-4{M}^2{m}_e\Delta m+2{M}^2{l}_t\Delta m}{4{M}^2{\left(M+\Delta {m}^2\right)}^2}-\frac{4M{l}_t\Delta {m}^2-{\left({l}_t\Delta m\right)}^2}{2{M}^2{\left(M+\Delta m\right)}^2}\\ {}\ge \frac{4{M}^3\Delta m-6{M}^2{l}_t\Delta m-2{M}^2{l}_t\Delta m-2{M}^2{l}_t\Delta m+{\left({l}_t\Delta m\right)}^2}{4{M}^2{\left(M+\Delta m\right)}^2}\end{array}\\ {}=\Delta m\frac{4{M}^3\Delta m-6{M}^2{l}_t+2{M}^2{l}_t-2{M}^2{l}_t\Delta m+{l}_t^2\Delta m}{4{M}^2{\left(M+\Delta m\right)}^2}\\ {}=\Delta m\frac{\left(2{M}^2-2M{l}_t-{l}_t\Delta m\right)\times \left(2M-{l}_t\right)}{4{M}^2{\left(M+\Delta m\right)}^2}\end{array}} $$
(3)

We can get Δm>0. So we just need to prove(2M2 − 2Mlt − ltΔm) × (2M − lt)>0, then can get U(s + 1) − U(s)>0.

In other words,

$$ {\displaystyle \begin{array}{c}\left\{\begin{array}{c}2{M}^2-2M{l}_t-{l}_t\Delta m>0\\ {}2M-{l}_t>0\end{array}\right.\\ {}\left\{\begin{array}{c}2{M}^2-2M{l}_t-{l}_t\Delta m>0\\ {}2M-{l}_t>0\\ {}\Delta m>0\end{array}\right.\Longrightarrow \left\{\begin{array}{c}0<\Delta m<2M\left(\frac{M}{l_t}-1\right)\\ {}{l}_t<2M\end{array}\right.\\ {}\Longrightarrow \left\{\begin{array}{c}0<\Delta m<2M\left(\frac{M}{l_t}-1\right)\\ {}2M\left(\frac{M}{l_t}-1\right)>0\\ {}{l}_t<2M\end{array}\right.\Longrightarrow \left\{\begin{array}{c}0<\Delta m<2M\left(\frac{M}{l_t}-1\right)\\ {}{l}_t<M\end{array}\right.\end{array}} $$
(4)

However, we also know that2 U is the sum degree of the nodes in the network, no community in the network has a saturation greater than2 U. In summary, we can get that increasing the weight can increase the relevance to the community in the social opportunity network. In summary, we can get that if a node belongs to this opportunistic complex networks, its weight will affect the relevance of the community in the social opportunity network.

Condition 2

In an opportunistic network, if node Ni meets the condition \( \frac{l_i{l}_j}{2M}<{m}_{ij}<\varDelta m+\frac{l_i{l}_j+{l}_t\varDelta m+\varDelta {m}^2}{2\left(M+\varDelta m\right)} \), then it will be separated from the community of node Cj.

Proof 2

We first assume that community E is divided into two sub-communities Ei and Ej, where nodes Ni and Cj are in different communities. Along with the total weight has decrease in community. Then

$$ \left\{\begin{array}{c}{M}_i+{M}_j<M\\ {}\frac{u_i}{M}-\frac{{l_i}^2}{4{M}^2}+\frac{u_j}{M}-\frac{{l_j}^2}{4{M}^2}<\frac{l_i+{l}_j+{m}_{ij}}{M}-\frac{{\left({l}_i+{l}_j\right)}^2}{4{M}^2}\\ {}{m}_{ij}>\frac{l_i{l}_j}{2M}\end{array}\right. $$
(5)

When the total weight has decreased, we can express the formula as:

$$ {M_i}^{\ast }+{M_j}^{\ast }>{M}^{\ast } $$
(6)
$$ {m}_{ij}<\varDelta m+\frac{l_i{l}_j+{l}_t\varDelta m+\varDelta {m}^2}{2\left(M+\varDelta m\right)} $$
(7)

So the communities Ei and Ej where the two nodes are located meet the condition \( \frac{l_i{l}_j}{2M}<{m}_{ij}<\varDelta m+\frac{l_i{l}_j+{l}_t\varDelta m+\varDelta {m}^2}{2\left(M+\varDelta m\right)} \), then the community have been divided.

Condition 3

For node Ni in the opportunistic network, if its edge is connected to node Cj and this edge is the only edge of node Cj. Then the weight between nodes Ni and Cj drops, node Cj will still not be separated from the community.

Proof 3

If community E is divided, then it must meet the following three conditions:

$$ \left\{\begin{array}{c}{M}_i+{M}_j<M\\ {}\frac{u_i}{M}-\frac{{l_i}^2}{4{M}^2}+\frac{u_j}{M}-\frac{{l_j}^2}{4{M}^2}<\frac{l_i+{l}_j+{m}_{ij}}{M}-\frac{{\left({l}_i+{l}_j\right)}^2}{4{M}^2}\\ {}{m}_{ij}>\frac{l_i{l}_j}{2M}\end{array}\right. $$
(8)

Along with weight change, the formula can be expressed as:

$$ \left\{\begin{array}{c}{M_i}^{\ast }+{M_j}^{\ast }>{M}^{\ast}\\ {}{m}_{ij}<\varDelta m+\frac{l_i{l}_j+{l}_t\varDelta m+\varDelta {m}^2}{2\left(M+\varDelta m\right)}\end{array}\right. $$
(9)

It can be understood as:

$$ \frac{l_i{l}_j}{2M}<{m}_{ij}<\frac{l_i\left({l}_j+\varDelta m\right)}{2\left(M+\varDelta m\right)}=\frac{l_i{l}_j+{l}_i\varDelta m}{2\left(M+\varDelta m\right)} $$
(10)

Because

$$ \frac{l_i{l}_j+{l}_i\varDelta m}{2\left(M+\varDelta m\right)}-\frac{l_i{l}_j}{M}=\frac{l_i\varDelta m\left(M-{l}_j\right)}{M\left(M+\varDelta m\right)}<0\left(\varDelta m<0\right) $$
(11)

then

$$ \frac{l_i{l}_j+{l}_i\varDelta m}{2\left(M+\varDelta m\right)}<\frac{l_i{l}_j}{M} $$
(12)

So in the end we can get \( \frac{l_i{l}_j}{2M}<{m}_{ij}<\varDelta m+\frac{l_i{l}_j+{l}_t\varDelta m+\varDelta {m}^2}{2\left(M+\varDelta m\right)} \)is false.

Pass the above proof, we can get the conclusion that for the node in opportunistic complex networks, if its edge is connected to another node and this edge is the only edge of the node. Then the weight between two nodes drops, the node will still not be separated from the community.

In summary, if a node is in opportunistic networks, then it should meet the above conditions.

In social networks, nodes with a high degree of similarity are usually more likely to have similar lifestyles, such as going to the same place and watching a movie at the same time, then they will have a greater chance of meeting, which also reflects the characteristics of social networks. For opportunistic social networks, the key to optimizing caching is to find suitable relay nodes in the information forwarding process to reduce the occupation of resources by irrelevant information. If the preferences between a node and a transmitting node are similar, we can think that the similarity between the node and the target node may be higher, and the sensitivity to the message may also be similar.

The user’s history often contains important characteristics of interest. By analyzing the subject of the user’s historical browsing information, an actual interest model can be established. However, user interests are often dynamic. On the one hand, the interests of some users usually change gradually. On the other hand, based on the browsing behavior of different users, the features of interest shown by the users have different references. For example, sometimes users will focus on a series of content under a certain topic for a short time, and sometimes they will intermittently focus on certain aspects of information. Computer researchers may browse a lot of relevant information as they travel somewhere, and users may not be interested in this in the next stage. Obviously, the importance of information based on this behavioral characteristic is low. Therefore, in order to accurately quantify the similarity of node preferences, this paper uses recurrent neural networks to model user preference characteristics and behavior characteristics. The interest modeling model diagram is as follows (Fig. 1).

Fig. 1
figure 1

User interest model

In the process of modeling user interests, the input of the recursive neural network layer is the user’s access to the historical topic collection D = (d1, d2, ⋯, dn) and all corresponding content collections C = (c1, c2, ⋯, cn). Because the user’s historical characteristics include all the browsing information currently transmitted, that is, the user’s Behavior changes existing interest models. Therefore, the supervised learning method is used in the modeling process to extract the user’s preference vectors at different time stages through the recurrent neural network layer. The status node of each stage depends on the current browsing theme dn and the related browsing set cn and the status node of the previous stage In − 1, that is,

$$ {\mathrm{I}}_{\mathrm{n}}=f\left({I}_{n-1},{d}_n,{c}_n\right) $$
(13)

Among them, the node type of the RNN is GRU, so the f(hn − 1, dn, cn) function in the formula is calculated as follows:

$$ {r}_n=\delta \left({W}_r\left[{d}_n,{c}_n\right]+{V}_r{i}_n-1\right) $$
(14)
$$ {z}_n=\delta \left({W}_z\left[{q}_n,{d}_n\right]+{V}_z{i}_n-1\right) $$
(15)
$$ {c}_n=\mathit{\tanh}\left({W}_c\left[{q}_n,{d}_n\right]+{V}_n\left({r}_n{i}_n-1\right)\right) $$
(16)
$$ {i}_n=\left(1-{z}_n\right){i}_n-1+{z}_n{c}_n $$
(17)

rn resets the gate, zn represents the update gate, and the information that is extracted from the previous state node and the current state node to enter the next node is determined by both of them. δ is a sigmoid function.Wr, Wz, Wc, Vr, Vz, Vc are parameters adjusted during training. After processing at the GRU layer, the output of the hidden layer nodes at different stages is expressed as the user’s interest characteristics at different stages, namely: I1 = (i1, i2, ⋯, in).

In order to obtain the rule that the importance of user preference changes with the characteristics of user behavior, this paper models user behavior. Similar to the method of user interest modeling, this article uses a GRU that is more suitable for long-term memory to model the user behavior state, and obtains the characteristics of the user behavior state changing over time. At the same time, the user’s current behavior state is used to model the current behavior state.

In order to reasonably quantify the user’s behavior state, this article uses the discrete degree S(d) of the user’s browsing information under a browsing topic to characterize the user’s behavior state. Because the main domain name is the same, although the user browses the information differently, the topic of the information is not discrete at this time, so the degree of discreteness of the information selection should be calculated by adding the number of information browsing times under the same domain name. The calculation formula is:

$$ S(d)=\sum \limits_{d_i\in \boldsymbol{content}(d)}-p\left({c}_i\left|d\right.\right){\mathit{\log}}_2p\left({c}_i\left|d\right.\right) $$
(18)

Where S(d) refers to the result information set of topic d, and P(ci| d) under topic d, the proportion of the browsing of the topic information to the total number of browsing, the calculation formula is:

$$ p\left(\left.{c}_i\right|d\right)=\frac{BE\left({c}_i\right)}{\sum \limits_{c\in \boldsymbol{content}\left({d}_i\right)} BE\left({c}_j\right)} $$
(19)

In order to accurately describe the query results, this article uses SE(d) to represent the degree of discreteness of the information, and the calculation formula is:

$$ SE(d)=\sum \limits_{i=1}^{R_c}-{c}_r{\mathit{\log}}_2\left({c}_r\right) $$
(20)

Where SE(d) is the content distribution entropy when the information topic is d, Rc is the dimension of the information vector, and all information vectors in the crtopic d are in the r-th dimension.

Similar to formula (2), the input of the GRU layer is the user history browsing theme D = (d1, d2, ⋯, dn), and the corresponding behavior characteristics A = (a1, a2, ⋯, an).The behavior characteristic C is determined by the degree of discreteness of information selection and the degree of discreteness of browsing information. The user’s behavioral state model will change with new user behaviors. Therefore, the supervised learning method is used to extract behavioral feature vectors of different periods through the recursive neural layer. The calculation formula is:

$$ {i}_n=g\left({i}_{n-1},{d}_n,{a}_n\right) $$
(21)

in represents the current state node vector. According to the current topic dn, the state vector an corresponding to the topic and the previous node an − 1 are obtained. The g function is obtained by GRU training, and the calculation formula is:

$$ {s}_n=\delta \left({H}_s\left[{d}_n,{a}_n\right]+{M}_{\mathrm{s}}{\mathrm{i}}_{\mathrm{n}}-1\right) $$
(22)
$$ {x}_n=\delta \left({H}_x\left[{q}_n,{d}_n\right]+{M}_x{i}_n-1\right) $$
(23)
$$ {t}_n=\mathit{\tanh}\left({H}_t\left[{q}_n,{d}_n\right]+{M}_t\left({s}_n{i}_n-1\right)\right) $$
(24)
$$ {i}_n=\left(1-{t}_n\right){i}_n-1+{t}_n{x}_n $$
(25)

Among them, sn resets the gate, and xn represents an update gate. The information that is extracted from the previous state node and the current state node and enters the next node is jointly determined by the two. σ() is a sigmoid function. Hs, Hx, Ht, Ms, Mz, Mt are parameters adjusted during training. After the GRU layer processing, the output of the hidden layer nodes in different stages is expressed as the user’s interest characteristics in different stages, that is, I2 = (i1, i2, ⋯, in).

Because users have different degrees of attention to user interests in different behavior states, this article sets up a gating unit to control the weight of user preferences in different behavior states to obtain the user interest set I. The calculation formula is:

$$ t={V}_t\sigma \left({I}_1{W}_t+{b}_t\right) $$
(26)
$$ I=t\cdot {I}_2 $$
(27)

Where t represents the degree of attention of the user’s interest, σ() is the sigmoid function, and Vt, Wt, bt are parameters that are continuously adjusted during training. Finally, the user preference set I2 = (i1, i2, ⋯, in) is obtained.

In the opportunistic social network, by predicting the similarity matching between nodes, a suitable cooperative node can be selected for data forwarding. Therefore, our approach is to first establish a connection between nodes and calculate the similarity of the node’s preferences. If the matching value is high, data is transmitted, otherwise cooperation with other nodes is established. Due to the randomness of the characteristics of the transmitted information, in order to increase the demand for information by the forwarding node, improve the cache utilization of the relay node, and reduce malicious forwarding, we consider the matching degree between the information attribute and the node when sorting the relay node, and according to the information attribute Dynamically adjust the node preference model, and set different degrees of attention to different characteristics of interest. Obviously, preferences that are highly correlated with the current information attributes should have a higher weight, while irrelevant preferences have a smaller impact on the current data transmission. Therefore, this paper introduces an attention mechanism to assign different weights to different preferences, while reducing the negative impact of unrelated preferences on the calculation of node matching values.

In order to obtain the attention to different preferences when the information attributes are different, we choose MLP to calculate the weights of different preferences. Cosine similarity, dot product, and multi-layer perceptron (MLP) can be used to represent weights, but MLP can extract more comprehensive semantic features to weight vectors as needed due to its good adaptability and is widely used in complex functions For the fitting, we take different preference sets I = (i1, i2, ⋯, in) and the information to be transmitted d as the input of the attention layer, and calculate the weight under the information attribute at that time, the calculation formula is:

$$ {e}_i=\vartheta \left(d,{S}_i\right) $$
(28)
$$ {\varphi}_i=\frac{\mathit{\exp}}{\sum \limits_{j=1}^n\mathit{\exp}\left({e}_i\right)} $$
(29)

ϑ() is a multi-layer perceptron (MLP). Using exp() as the activation function, during the training process, the interest of each interest can be dynamically learned according to the current message attributes, which improves the preferences that are more relevant to the message attributes Weights. The node interest calculation formula is:

$$ {X}_i=\sum \limits_{i=1}^n{\varphi}_i{S}_i $$
(30)

The attention mechanism enhances the degree of model adaptation in this paper. During the calculation of matching values, the user preference model is dynamically adjusted towards the current information attributes, enhancing the reference and effectiveness of the model. After obtaining the user’s interest feature vector based on the current information attributes, we calculate the node relevance score by calculating the node information similarity. The calculation formula is:

$$ S\left({N}_1,{N}_2,{d}_i\right)= Mat\left({X}_u\left({N}_1,{d}_i\right),{X}_u\left({N}_1,{d}_i\right)\right) $$
(31)
$$ Mat\left({N}_1,{N}_2\right)=\frac{N_1{N}_2}{\left|\left|{N}_1\right|\left|{N}_2\right|\right|} $$
(32)

Among them, Score(di| Xu) represents the node’s attribute matching score, and Mat(X, Y) uses the cosine similarity to calculate the matching degree between the two. When the nodes meet, our approach is to forward the information directly if the meeting node is the destination node. If it is not the target node, we sort the surrounding nodes by calculating the matching value of the node, and select the corresponding scored node as the cooperative node. Data transmission. The algorithm pseudo code is Table 2:

Table 2 Pseudo code with algorithm (HBP)

4 Simulation

This paper uses OMNET ++ to conduct simulation tests and analyze the performance of HBP in real environment. OMNET ++ describes motion trajectories through different motion models and records data transmission packets in the simulation.

The parameter settings in the experiment are as follows in Table 3.

Table 3 simulation parameters setting

In this study, HBP was compared with the following algorithm.

(1) EIMST algorithm [19].

(2) Spray waiting algorithm [20].

(3) Epidemic algorithms [21].

Compare the HBP with the types of the classical algorithms mentioned above to verify its performance. This study focused on the following parameters:

  1. (1)

    Delivery ratio: Use this parameter to describe the probability of information being transmitted between corresponding nodes. The transfer rate can be expressed as a message sent by a node and a received message by a neighbor node.

  2. (2)

    Energy consumption: This parameter records the energy consumption of each node during transmission.

  3. (3)

    End-to-end average delay: This parameter indicates the delay in transmitting information from the node to the target node, including search delay, wait delay, and transmission delay. The delay is accumulated by each node delay. First, we need to verify the impact of the number of collaborative nodes

  4. (4)

    Overhead: This parameter displays the cost of transmitting information between two nodes. We describe the overhead in terms of transmission time.

In Fig. 2, we can see the relationship between the number of nodes and the Delivery ratio. When the number of nodes increases, transmission tasks are shared by multiple nodes, and nodes can more easily find reliable relay nodes during the movement process. The transmission ratio of messages increases accordingly, making it easier to send messages to other nodes. However, as the number of nodes increases, because nodes need to store a large amount of data in the cache, a large amount of data is waiting to be sent. The number of node caches is limited. When a node does not have enough caches to store these data, redundant information takes up more resources. Therefore, when the number of cooperative nodes is greater than 5, the transmission ratio is relatively reduced.

Fig. 2
figure 2

Delivery ratio

Figure 3 shows the relationship between transmission energy consumption and the number of nodes. As the number of nodes increases, energy consumption continues to increase as the transmission rate of information between nodes increases. When the number of nodes exceeds 5, the data transmission rate decreases due to the large amount of cache space occupied, and some data is in the waiting queue, and the energy consumption is gradually reduced. At this time, the energy consumption can be controlled by the node. If the target node has sufficient cache to store new messages, it will consume the next energy.

Fig. 3
figure 3

Energy consumption

Figure 4 shows the relationship between the end-to-end delay of information transmission and the number of nodes. As the number of nodes increases, a large number of nodes share the transmission task, and the average end-to-end delay decreases. However, when the number of cooperating nodes is greater than 5, the node cache is heavily occupied and the information is blocked. The number of messages in the waiting queue increases, resulting in an average end The end-to-end delay increases (Fig. 5).

Fig. 4
figure 4

Delay

Fig. 5
figure 5

Overhead

In Fig. 3, we can see the relationship between the transfer cost and the number of nodes. When the number of nodes increases, the large amount of buffer space is used to reduce the transmission cost of information between nodes. However, when the number of nodes exceeds 5, the large number of buffers is occupied, resulting in multiple messages waiting to be sent, and the data transmission overhead gradually increases.

Figure 6 shows the transfer rates of the above four algorithms in simulation experiments. Since HBP selects the node with the highest probability each time for data transmission, the transmission of data packets is accurately transmitted from the node to its neighbors, effectively using the cache space of the target node, and improving the transmission rate, so the transmission rate is the highest. When the buffer space is 40, the transfer rate of HBP can reach 0.91. In EIMST algorithm, by calculating the probability of nodes meeting in a social network, considering the cooperation between nodes, selecting appropriate nodes for data transmission. Therefore, the transfer rate is relatively high, but when the number of nodes increases, the EIMST algorithm does not effectively use the cache, resulting in a relatively limited transfer rate, with an average of 0.8. Spray and wait has the lowest transmission rate. This is because the algorithm uses a flooded method to transfer data between nodes by copying a large number of packets, resulting in limited utilization of cache space and most redundant information occupying a large amount of data. Resources, valid messages are blocked in the waiting queue. The Epidemic algorithm has a relatively improved transfer rate compared to Spray and wait. It can improve the transmission of information and reduce the number of copies of information. It also reduces the occupation of resources by redundant information. However, the same cache utilization problem also results in a low transfer rate. From the experimental results, we can conclude that the data transfer rate of the HBP algorithm has increased by 80% compared to the traditional algorithm.

Fig. 6
figure 6

Delivery ratio

Figure 7 shows the performance of the four algorithms in terms of average overhead. In the figure, we can see that the overhead of HBP and EIMST is significantly reduced compared to Spray and wait. This is because HBP effectively manages the node’s cache by selecting the nodes that are interested in forwarding information, which greatly reduces the redundant information in the cache, so that the overhead of data packet transmission between nodes is smaller. However, in the HBP algorithm, since the node similarity probability needs to be calculated during transmission, it will also consume the overhead in the social network. The HBP algorithm selects reliable relay nodes based on the matching degree of node interest similarity, which can predict transmission nodes better than EIMSP. Epiemic and Spray and wait algorithms have high overhead, because they transfer data to the target node by copying a large number of message copies, resulting in a large amount of redundant data during the transmission process, occupying cache space in the network, and greatly improving the data Transmission overhead.

Fig. 7
figure 7

Overhead on average

Figure 8 shows a comparison of transmission energy consumption. It can be seen from the figure that the smallest energy consumption is HBP and EIMST. This is because EIMSP selects appropriate nodes for data transmission by calculating the probability that the nodes meet in the social network, which greatly increases the transmission efficiency and reduces the transmission energy consumption accordingly. Compared with EIMSP, HBP selects reliable relay nodes based on node matching values, which increases the node’s demand for information, effectively improves cache utilization, and greatly reduces energy consumption. This allows more energy to be used for the transmission of valid data without being consumed on redundant information. In contrast, because the Spray and wait algorithm implements information forwarding by copying a large amount of data, the node cache utilization rate is greatly reduced, resulting in increased data transmission energy consumption. When the number of buffers is increased, more redundant messages are transmitted, resulting in greater energy consumption. In terms of transmission energy consumption, HBP is the best algorithm. When the buffer space is greater than 35 M, the energy consumption is only 40 J.

Fig. 8
figure 8

Energy consumption

Figure 9 shows the average delay of these algorithms. It can be seen from the figure that the delay increases with the increase of the cache size. This is because as the cache increases, more redundant information occupies the cache space in the network, resulting in an increase in average end-to-end transmission delay. Among the four algorithms, the Epidemic algorithm has the highest delay. As shown in the figure, the Epidemic algorithm has a delay of 450 time units. This is because the algorithm uses flooding transmission, which generates a lot of redundant information in the network, resulting in overall transmission delay. High and greatly affected by cache size. The delay of the HBP algorithm is basically stable at about 60, and it is least affected by the buffer size. This is because we have effectively improved the method of filtering nodes. By evaluating the probability of meeting between nodes, we ensure that high-probability nodes preferentially access information, making data transmission more efficient, and the average transmission delay is lower. We can use a lot of data during the transmission process. Shared cache improves transmission efficiency. Compared with the Spray and wait algorithm, the latency of the HBP algorithm is reduced by 70%.

Fig. 9
figure 9

Delay on average

5 Conclusion

This work proposes a routing and forwarding strategy based on user’s historical behavior, Historical Behavior Prediction method (HBP). Based on the social attributes of nodes, the algorithm evaluates the probability of node encounters by calculating node preference matching values, and selects reliable nodes for data. Forwarding ensures that nodes with high probability access information first, thereby improving node cache utilization. Through simulation and comparison with existing algorithms, it has a better performance in reducing transmission delay, increasing transmission rate, and reducing overhead. In future work, we will consider cache adjustment in a large-scale data transmission environment, and study more effective data transmission methods to improve node cache and overall network structure.