A social network friend prediction method integrating local information and community information
By integrating local information and community information, combined with community detection and k-layer probability propagation algorithm, the problem of failure to effectively consider local information and community influence in the existing technology is solved, and a more accurate social network friend prediction is achieved.
Patent Information
- Application Number
- CN202111544505.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2041-12-16
AI Technical Summary
The existing social network friend prediction method fails to effectively consider the user's local information and the impact of different community users on the target user, resulting in poor prediction results.
A method of integrating local information and community information is adopted to obtain the community structure of the social network through the community detection algorithm, the weighted matrix is used to reflect the user relationship, and the user similarity is calculated through the k-layer probability propagation algorithm.
This method can more accurately predict the friend relationship between users, is suitable for large-scale social networks, and avoids the problem of parameter tuning.
Smart Images

Figure CN114201690B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of social network friend prediction, and more specifically to a social network friend prediction method that integrates local information and community information. Background Art
[0002] The era of big data has brought various changes to society and our lives, among which social networks play an important role. The widespread use of the Internet around the world enables people to connect with each other. In modern social networks, multimedia data is very abundant. It is very common to share multimedia data such as images, videos or music on social networks such as Facebook, Twitter, Google+, Flicker, etc. In addition, text information sharing through SMS, chat or public posting of personal dynamics is also very popular on social networks, and people establish connections with friends through the above behaviors. Therefore, social networks provide a huge corpus for multimedia data analysis, especially predictive analysis. In order to better understand the underlying relationships between various objects, the collected data is usually represented in the form of graphs or networks. Predicting missing friend relationships or predicting relationships that may arise in the near future plays a very important role in revealing hidden social relationships. The emergence of such problems has attracted a large number of researchers to do some work in related fields. However, many existing works consider the first-order or second-order neighbors of users, without considering more local information, and few works consider the problem that users from different communities will have different effects on the target user. Therefore, a social network friend prediction method that integrates local information and community information is proposed.
[0003] At present, the work related to friend prediction can be divided into the following two categories:
[0004] (1) Similarity-based methods. This is a common method for predicting friendships. In this method, for each pair of nodes, a similarity score is calculated based on the structure of the node pair or the attributes of the nodes. The score represents the predicted connection between the node pairs. Similarity-based methods include global similarity methods and local similarity methods. Local similarity-based methods usually use information about common neighbors and node degrees to calculate, considering the neighbors of the node. This method regards neighbor users as equal and does not distinguish between different influences. Global similarity-based methods use the entire topological information of the network to calculate. However, this method has high computational complexity and is not suitable for large networks.
[0005] (2) Methods based on probabilistic models. This method requires the establishment of a model composed of multiple parameters that can better estimate the observed data of a given network. In addition to structural information, probabilistic models usually require more information such as node or attribute knowledge. However, this information is difficult to extract, and parameter setting is also a major problem, which limits their applicability. Summary of the invention
[0006] In order to overcome the shortcomings of the prior art, the present invention provides a social network friend prediction method that integrates local information and community information, considers local information such as the user's neighbor nodes, and integrates community information in the social network, considering the different influences of users inside and outside the community, in order to accurately predict the friendship between users in the social network.
[0007] The present invention adopts the following technical solutions to solve the technical problems:
[0008] A social network friend prediction method integrating local information and community information comprises the following steps:
[0009] Step 1: Use community detection algorithm to pre-process the social network and obtain the community structure of the network;
[0010] Step 2: By using the community structure of the network to weight the edges between users, the relationship between users can be more accurately reflected;
[0011] Step 3: k-layer probability propagation
[0012] Step 3.1: Construct a bipartite network B_G(X,Y,W) based on the original network, where X represents the users in the network, Y represents the users in the network, and W represents the connection between the nodes in X and the nodes in Y.
[0013] Step 3.2, set the resource allocation ratio, and calculate the resource ratio from X to Y or from Y to X according to the weight matrix obtained in step 2;
[0014] Step 3.3, set the number of propagation layers k;
[0015] Step 3.4: For any user i in the network G, find its neighbor node and set the initial resource of the neighbor node of user i in X to 1;
[0016] Step 3.5: First layer propagation: distribute the resources of all nodes in X to their neighbor nodes in Y in proportion;
[0017] Step 3.6, second layer propagation: distribute the resources of all nodes in Y to their neighbor nodes in X in proportion;
[0018] Step 3.7: Repeat steps 3.5 and 3.6, and the resources are repeatedly propagated between X and Y until the set k-layer propagation is reached;
[0019] Step 4: Calculate the user similarity matrix
[0020] Step 4.1: Execute step 3 for all users to obtain the k-layer resource propagation values of all users;
[0021] Step 4.2, calculate the similarity between any i-th user node and the l-th user node;
[0022] Step 4.3: After step 4.2, the similarity between any two nodes can be obtained, and the user similarity matrix can be constructed;
[0023] Step 5: User node similarity ranking
[0024] The similarity of the node pairs that originally had edges is set to 0, and then the similarities of the remaining node pairs are sorted from large to small. The higher the similarity, the greater the possibility that there is an edge between the two nodes, that is, the greater the possibility that the two users are friends.
[0025] Preferably, the network representation is defined as G(V,E), V = {v1,v2,…,v i ,…,v n} represents the users in the social network, v i represents the i-th user; n is the total number of nodes; E = {e ij |i=1,2,…,n;j=1,2,…,n} means there is a connection between any two nodes; ij represents the i-th node v i With the jth node v j Is there an edge between them? If e ij =1, indicating the i-th node v i With the jth node v j There is an edge between them, then the i-th node v i With the jth node v j are neighbor nodes; if e ij =0, indicating the i-th node v i With the jth node v j There is no boundary connection between them, that is, there is no connection.
[0026] Preferably, in step 1, the community structure of the network is obtained as C = {c ij |i=1,2,…,n; j=1,2,…,n}, c ij represents the i-th node v i With the jth node v j Whether they belong to the same community; if cij =1, indicating the i-th node v i With the jth node v j belong to the same community; if c ij =0, indicating the i-th node v i With the jth node v j Not belonging to the same community.
[0027] Preferably, in step 2, for any two users v i and v j , the weights of their edges are:
[0028] W ij =c ij ×e ij +e ij (1)
[0029] In formula (1), c ij Indicates whether two users are in the same community. If they are in the same community, c ij =1, otherwise c ij =0;e ij Indicates whether there is an edge between two users. If there is an edge, then e ij =1, otherwise e ij =0.
[0030] Preferably, in step 3.1, X={x1,x2,…,x i ,…,x n}; Y = {y1,y2,…,y i ,…,y n}; x i and i All represent user nodes v i ; n is the total number of nodes; W = {w ij |i=1,2,…,n;j=1,2,…,n} represents the i-th node x in X i and the jth node y in Y j There is a connection between them; if w ij =0, indicating node x i With node y j There is no edge between them; if w ij >0, indicating node x i With node y j There are edges between them.
[0031] Preferably, in step 3.2, the ratio of resources from X to Y or from Y to X is calculated as follows:
[0032]
[0033] In formula (2), W ij Represents the weight of the i-th node and the j-th node;
[0034] Preferably, in step 3.5, in the first layer of propagation, the resources obtained by the lth node in Y are:
[0035]
[0036] In formula (3), f1(y l ) represents the resource value of the lth node in Y in the first layer of propagation; f0(x i ) represents the initial resource value of the i-th node in X.
[0037] Preferably, in step 3.6, in the second layer propagation, the resources obtained by the lth node in X are:
[0038]
[0039] In formula (4), f2(x l ) represents the resource value of the lth node in X in the second layer of propagation; f1(y i ) represents the resource value of the i-th node in Y obtained through the first layer of propagation.
[0040] Preferably, in step 4.2, for any i-th user node, the similarity calculation method with the l-th user node is:
[0041] Sim(i,l)=f1(y l )+f2(x l )+…+f k (x l ) (5)
[0042] In formula (5), f1(y l ) represents the resource value contained in the lth node in Y after the first layer of propagation; f2(x l It represents the resource value contained in the lth node in X after the second layer of propagation.
[0043] Preferably, in step 4.3, the user similarity matrix constructed is not necessarily symmetrical, so the upper triangle and the lower triangle of the matrix are added and averaged, and for the i-th user node, the similarity with the l-th user node is:
[0044] Sim(i,l)=(Sim(i,l)+Sim(l,i)) / 2 (6)
[0045] Sim(l,i)=(Sim(i,l)+Sim(l,i)) / 2 (7).
[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0047] 1. The present invention uses local information of user nodes, has low complexity, and can be applied to large-scale social networks. Compared with the previous method based on local similarity, this method can consider more information of neighboring users by using the probability propagation method, and divides the social network into multiple non-overlapping communities by using the community detection method. Users in the same community have a greater influence on each other, and the connection between users in different communities is weaker; the integration of local information and community information enables the present invention to more accurately predict the user's friend relationship.
[0048] 2. Compared with the method based on probability model, the present invention does not need to set too many parameters, thus avoiding the problem of parameter tuning. It uses the structural information of user nodes to predict the friendship relationship between users, and the information is easy to extract. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A flowchart of a social network friend prediction method that integrates local information and community information in the present invention;
[0050] Figure 2 This is a schematic diagram of the community division of the present invention;
[0051] Figure 3 A schematic diagram of the k-layer probability propagation algorithm proposed by the present invention; DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] In this example, a social network friend prediction method that integrates local information and community information is proposed. Its characteristics are as follows: Figure 1 Specifically, the steps are as follows:
[0054] Define the network representation as G(V,E), V = {v1,v2,…,v i ,…,v n} represents the users in the social network, v i represents the i-th user; n is the total number of nodes; E = {e ij |i=1,2,…,n;j=1,2,…,n} means there is a connection between any two nodes; ij represents the i-th node v i With the jth node vj Is there an edge between them? If e ij =1, indicating the i-th node v i With the jth node v j There is an edge between them, then the i-th node v i With the jth node v j are neighbor nodes; if e ij =0, indicating the i-th node v i With the jth node v j There is no boundary connection between them, that is, there is no connection;
[0055] Step 1: Community structure detection
[0056] The community detection algorithm is used to preprocess the social network and obtain the community structure C = {c ij |i=1,2,…,n; j=1,2,…,n}, c ij represents the i-th node v i With the jth node v j Whether they belong to the same community; if c ij =1, indicating the i-th node v i With the jth node v j belong to the same community; if c ij =0, indicating the i-th node v i With the jth node v j Not belonging to the same society;
[0057] The community detection algorithm is as follows: the Louvain community detection algorithm is used to process the social network to obtain the community structure of the network, and users with closer connections can be divided into the same community; the method is divided into two stages of repeated iterations. First, different communities are assigned to each node, and then for each node, the neighbors of the node are considered, and the node is placed in the community to which the neighboring nodes belong and the modularity gain is calculated, and then the node is placed in the community with the largest gain; the modularity gain obtained by moving node i to community C can be calculated as:
[0058]
[0059] Where ∑in is the sum of the number of edges in community C, ∑tot is the sum of the number of edges associated with nodes in community C, and k i is the degree of node i, k i,in is the sum of the number of edges from node i to the nodes in community C, and m is the sum of the number of all edges in the network;
[0060] For example Figure 2As shown in the figure, it is assumed that there are 8 nodes in the network; the Louvain community detection algorithm is used in the network. First, the 8 nodes are divided into 8 different communities. For any node, it is placed in the community to which the neighboring node belongs and its modularity gain is calculated. Then the node is placed in the community with the largest gain. After repeated iterations, the two communities shown in the figure are finally obtained.
[0061] Step 2: Weighted matrix calculation
[0062] By using community information to weight the edges between users, the relationship between users can be more accurately reflected; for any two users v i and v j , the weights of their edges are:
[0063] W ij =c ij ×e ij +e ij (1)
[0064] In formula (1), c ij Indicates whether two users are in the same community. If they are in the same community, c ij =1, otherwise c ij =0;e ij Indicates whether there is an edge between two users. If there is an edge, then e ij =1, otherwise e ij =0;
[0065] Step 3: k-layer probability propagation
[0066] Step 3.1: Based on the original network (i.e., the user social network dataset obtained through public data), construct a bipartite network B_G(X,Y,W), X = {x1,x2,…,x i ,…,x n} represents the users in the network; Y = {y1,y2,…,y i ,…,y n} represents a user in the network; x i and i All represent user nodes v i ; n is the total number of nodes; W = {w ij |i=1,2,…,n;j=1,2,…,n} represents the i-th node x in X i and the jth node y in Y j There is a connection between them; if w ij =0, indicating node x i With node y j There is no edge between them; if w ij >0, indicating node x i With node yj There are edges between them;
[0067] Step 3.2: Set the resource allocation ratio. According to the weight matrix obtained in step 2, the ratio of resources from X to Y or from Y to X is calculated as follows:
[0068]
[0069] In formula (2), W ij Represents the weight of the i-th node and the j-th node;
[0070] Step 3.3, set the number of propagation layers k;
[0071] Step 3.4: For any user i in the network G, find its neighbor node and set the initial resource of the neighbor node of user i in X to 1;
[0072] Step 3.5, first layer propagation: Allocate the resources of all nodes in X to their neighboring nodes in Y in proportion. The resources obtained by the lth node in Y are:
[0073]
[0074] In formula (3), f1(y l ) represents the resource value of the lth node in Y in the first layer of propagation; f0(x i ) represents the initial resource value of the i-th node in X;
[0075] For example Figure 3 As shown, assuming that there are 4 nodes in the social network, the proportion of allocated resources is assumed to be average propagation, and the similarity between user 1 and other user nodes is to be calculated; first, a bipartite graph network is constructed according to step 3.1, and the similarity between user 1 and other user nodes is to be calculated; for user 1y1 in Y, there are two nodes x2 and x3 in X that are connected to it, so the initial resources of x2 and x3 are set to 1, and then the first propagation is performed; for x2, there is y1 connected to it in Y, so 1 resource is propagated to y1; for x3, there are y1 and y4 connected to it in Y, so the 1 resource value is evenly distributed to y1 and y4; finally, the first layer of propagation is completed;
[0076] Step 3.6, second layer propagation: distribute the resources of all nodes in Y to their neighboring nodes in X in proportion. The resources obtained by the lth node in X are:
[0077]
[0078] In formula (4), f2(x l ) represents the resource value of the lth node in X in the second layer of propagation; f1(y i) represents the resource value of the i-th node in Y after the first layer of propagation;
[0079] Step 3.7: Repeat steps 3.5 and 3.6, and the resources are repeatedly propagated between X and Y until the set k-layer propagation is reached;
[0080] Step 4: Calculate the user similarity matrix
[0081] Step 4.1: Execute step 3 for all users to obtain the k-layer resource propagation values of all users;
[0082] Step 4.2: For any i-th user node, the similarity calculation method with the l-th user node is:
[0083] Sim(i,l)=f1(y l )+f2(x l )+…+f k (x l ) (5)
[0084] In formula (5), f1(y l ) represents the resource value contained in the lth node in Y after the first layer of propagation; f2(x l ) represents the resource value contained in the lth node in X after the second layer of propagation;
[0085] Step 4.3: After step 4.2, we can get the similarity between any two nodes and construct a user similarity matrix. This matrix is not necessarily symmetrical, so we add the upper triangle and the lower triangle of the matrix and take the average. For the i-th user node, the similarity with the l-th user node is:
[0086] Sim(i,l)=(Sim(i,l)+Sim(l,i)) / 2 (6)
[0087] Sim(l,i)=(Sim(i,l)+Sim(l,i)) / 2 (7)
[0088] Step 5: User node similarity ranking
[0089] The similarity of the node pairs that originally had edges is set to 0, and then the similarities of the remaining node pairs are sorted from large to small. The higher the similarity, the greater the possibility that there is an edge between the two nodes, that is, the greater the possibility that the two users are friends.
[0090] The above contents are merely examples and explanations of the structure of the present invention. The technicians in this technical field may make various modifications or additions to the specific embodiments described or replace them in a similar manner. As long as they do not deviate from the structure of the present invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.
Claims
1. A social network friend prediction method integrating local information and community information, characterized in that: The following steps are involved: Step 1: Use community detection algorithm to pre-process the social network and obtain the community structure of the network; Step 2: By using the community structure of the network to weight the edges between users, the relationship between users can be more accurately reflected; For any two users v i and v j , the weights of their edges are: W ij =c ij ×e ij +e ij (1) In formula (1), c ij Indicates whether two users are in the same community. If they are in the same community, c ij =1, otherwise c ij =0;e ij Indicates whether there is an edge between two users. If there is an edge, then e ij =1, otherwise e ij =0; Step 3: k-layer probability propagation Step 3.1: Construct a bipartite network B_G(X, Y, W) based on the original network, where X represents the users in the network, Y represents the users in the network, and W represents the connection between the nodes in X and the nodes in Y. Step 3.2, set the resource allocation ratio, and calculate the resource ratio from X to Y or from Y to X according to the weight matrix obtained in step 2; Step 3.3, set the number of propagation layers k; Step 3.4: For any user i in the network G, find its neighbor node and set the initial resource of the neighbor node of user i in X to 1; Step 3.5: First layer propagation: distribute the resources of all nodes in X to their neighbor nodes in Y in proportion; Step 3.6, second layer propagation: distribute the resources of all nodes in Y to their neighbor nodes in X in proportion; Step 3.7: Repeat steps 3.5 and 3.6, and the resources are repeatedly propagated between X and Y until the set k-layer propagation is reached; Step 4: Calculate the user similarity matrix Step 4.1: Execute step 3 for all users to obtain the k-layer resource propagation values of all users; Step 4.2, calculate the similarity between any i-th user node and the first user node; Step 4.3: After step 4.2, obtain the similarity between any two nodes and construct a user similarity matrix; Step 5: User node similarity ranking The similarity of the node pairs that originally had edges is set to 0, and then the similarities of the remaining node pairs are sorted from large to small. The higher the similarity, the greater the possibility that there is an edge between the two nodes, that is, the greater the possibility that the two users are friends.
2. The social network friend prediction method integrating local information and community information according to claim 1, characterized in that: Define the network representation as G(V,E), V = {v1, v2, ..., v i , ..., v n } represents the users in the social network, v i represents the i-th user; n is the total number of nodes; E = {e ij |i=1,2,...,n;j=1,2,...,n} means there is a connection between any two nodes; ij represents the i-th node v i With the jth node v j Is there an edge between them? If e ij =1, indicating that the i-th node v i With the jth node v j There is an edge between them, then the i-th node v i With the jth node v j are neighbor nodes; if e ij =0, indicating the i-th node v i With the jth node v j There is no boundary connection between them, that is, there is no connection.
3. The social network friend prediction method integrating local information and community information according to claim 2, characterized in that: In step 1, the community structure of the network is obtained as C = {c ij |i=1, 2, ..., n; j=1, 2, ..., n}, c ij represents the i-th node v i With the jth node v j Whether they belong to the same community; if c ij =1, indicating that the i-th node v i With the jth node v j belong to the same community; if c ij =0, indicating the i-th node v i With the jth node v j Not belonging to the same community.
4. The social network friend prediction method integrating local information and community information according to claim 3, characterized in that: In step 3.1, X={x1, x2, ..., x i , ..., x n }; Y = {y1, y2, ..., y i , ..., y n }; x i and i All represent user nodes v i ; n is the total number of nodes; W = {w ij |i=1,2,...,n;j=1,2,...,n} represents the i-th node x in X i and the jth node y in Y j There is a connection between them; if w ij =0, indicating that node x i With node y j There is no edge between them; if w ij >0, indicating node x i With node y j There are edges between them.
5. The social network friend prediction method integrating local information and community information according to claim 4, characterized in that: In step 3.2, the ratio of resources from X to Y or from Y to X is calculated as follows: In formula (2), W ij Represents the weight of the i-th node and the j-th node.
6. The social network friend prediction method integrating local information and community information according to claim 4, characterized in that: In step 3.5, in the first layer of propagation, the resources obtained by the lth node in Y are: In formula (3), f1(y l ) represents the resource value of the lth node in Y in the first layer of propagation; f0(x i ) represents the initial resource value of the i-th node in X.
7. The social network friend prediction method integrating local information and community information according to claim 6, characterized in that: In step 3.6, the second layer of propagation, the resources obtained by the lth node in X are: In formula (4), f2(x l ) represents the resource value of the lth node in X in the second layer of propagation; f1(y i ) represents the resource value of the i-th node in Y obtained through the first layer of propagation.
8. The social network friend prediction method integrating local information and community information according to claim 7, characterized in that: In step 4.2, for any i-th user node, the similarity calculation method with the l-th user node is: Sim(i,l)=f1(y l )+f2(x l )+…+fk(x l ) (5) In formula (5), f1(y l ) represents the resource value contained in the lth node in Y after the first layer of propagation; f2(x l ) represents the resource value contained in the lth node in X after the second layer of propagation.
9. The social network friend prediction method integrating local information and community information according to claim 8, characterized in that: In step 4.3, the user similarity matrix is not necessarily symmetrical, so the upper triangle and the lower triangle of the matrix are added and averaged. For the i-th user node, the similarity with the l-th user node is: Sim(i,l)=(Sim(i,l)+Sim(l,i)) / 2 (6) Sim(l,i)=(Sim(i,l)+Sim(l,i)) / 2 (7).
Citation Information
Patent Citations
Method and system for friend recommendation based on similar associations in social network
CN104731962A
A social network character relationship analysis method based on multi-layer network community division
CN109815414A