A friend recommendation method based on local community detection combining topology and attributes

By combining the topological and attribute information of social networks and employing local community detection and particle swarm optimization, the problems of insufficient and overly broad friend recommendations in social networks are solved, achieving more accurate and closer friend recommendations.

CN117807328BActive Publication Date: 2026-11-17ANHUI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311853239.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2026-11-17
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

Existing social network friend recommendation systems suffer from insufficient reasons for recommendations and overly broad scope, leading to recommendation failures or user disinterest.

Method used

A local community detection method based on a combination of topology and attributes is adopted. By calculating the topological relationships and behavioral attribute similarities between users, the friend recommendation strategy is optimized by combining the particle swarm optimization algorithm, and the true friend set is found by using edge addition and flipping strategies.

Benefits of technology

It improves the accuracy and precision of friend recommendations, provides more compelling reasons for recommendations, resolves the issue of temporary friends in the "friends of friends are friends" scenario, and enhances user interest.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117807328B_ABST
    Figure CN117807328B_ABST
Patent Text Reader

Abstract

This invention discloses a friend recommendation method based on a combination of topology and attributes for local community detection, comprising: 1. Utilizing the community structure and attribute information of local communities, designing an edge-adding strategy within the community to strengthen connections among members; 2. Utilizing unique attribute information and designing a flipping strategy during evolution to make the detected members more accurate. This invention can fully utilize the topology and attribute information in social networks, and through edge-adding and flipping strategies, can quickly and effectively find the true friend set of users in social networks, maximizing the scope and accuracy of local community detection methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of social networks, specifically a friend recommendation method based on local community detection using a combination of topology and attributes. Background Technology

[0002] With the rapid development of the Internet and Web 2.0 technologies, more and more people enjoy chatting and making friends on social networks. In fact, these social networks can be viewed as directed graphs composed of nodes and edges. Users in the network correspond to nodes in the graph, while the social relationships between users correspond to edges in the directed graph.

[0003] With the rapid development of internet technology, the spread of information can be swift through the "social influence effect," attracting considerable research interest. In real life, many applications are based on social networks, such as friend recommendations. While these help users on social media meet and connect with like-minded individuals, they also present several challenges. The common practice of using the "friends of friends are friends" principle can lead to overly broad recommendations, such as those made temporarily for customer service rebates. In such cases, the friend recommendation system often malfunctions, resulting in failed recommendations. Furthermore, when recommending friends, the reasons given based on existing friendships may be insufficient to pique user interest, thus failing to effectively recommend genuine friends. Summary of the Invention

[0004] This invention aims to address the shortcomings of existing technologies by proposing a friend recommendation method based on a combination of topology and attributes for local community detection. This method fully utilizes the topological and attribute information in social networks and employs edge addition and flipping strategies to quickly and effectively find the true friend set of users in social networks, thereby maximizing the scope and accuracy of local community detection methods.

[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:

[0006] The friend recommendation method of this invention, based on local community detection combining topology and attributes, is characterized by its application in social networks, where the social network is represented as G = {V, E, A}, where V = {v1, v2, ..., v...}. i ,…,v m} represents the set of all users in the social network G, vi represents the i-th user; m is the total number of users; E = {e ij |i=1,2,…,m;j=1,2,…,m} represents the set of connections between any two users; e ij Represents the i-th user v iWith the j-th user v j The connection between them; if the i-th user v i With the j-th user v j If there is a relationship between them, then let e ij =1; otherwise, let e ij =0; A = {A1,A2,…,A} i ,…,A m} represents the set of group behaviors of the social network G; A i This represents the i-th user v in the set of group behavior attributes A. i The set of behavioral attributes; the friend recommendation method is performed according to the following steps:

[0007] Step 1: Determine the i-th user v i Relationships with other users;

[0008] Step 1.1: Calculate the i-th user v using equation (1). i The probability of being selected, P i :

[0009]

[0010] In equation (1), d ij Represents the i-th user v i With the j-th user v j The shortest distance between users; p max p represents the maximum probability that a user will be selected. min d represents the minimum probability of a user being selected. max Indicates the maximum distance between users;

[0011] Determine P i Is P greater than the random number rand? If it is, then let P... i =1; otherwise, let P i =0;

[0012] Step 1.2: Calculate the i-th user v using equation (2). i Behavioral attribute set A i With the j-th user v j Behavioral attribute set A j Similarity S between ij :

[0013]

[0014] Determine S ij Is it greater than or equal to Δ1 and less than or equal to 1? If so, let S ij =1; otherwise, determine S ij Is it less than Δ1 and greater than Δ2? If so, then Sij Otherwise, it means S remains unchanged. ij Less than or equal to Δ2 and greater than or equal to 0, and let S ij =0;

[0015] Step 1.3: Calculate the i-th user v using equation (3). i With the j-th user v j Mix similarity ij Thus, the i-th user v is obtained. i The user v is obtained by combining the mixed similarity with all users and sorting them in descending order. i A mixed similarity set;

[0016] Mix ij =S ij +P i (3)

[0017] Step 1.4: Set two similarity thresholds to determine the ranking of the i-th user v after sorting. i The mixed similarity set is divided into three subsets, and all users in the first subset are taken as the i-th user v. i Close user group All users in the second subset are considered as the i-th user v. i Important user set All users in the third subset are considered as the i-th user v. i A collection of unfamiliar users

[0018] According to the i-th user v i intimate user group With important user groups The sequence number of the middle user to the close user set With important user groups Sort all users in ascending order to get the i-th user v. i The sorted set of close and important users;

[0019] According to the i-th user v i The sorted set of close and important users yields the corresponding mixed similarity set, denoted as Mix. i ={mix i1 ,mix i2 ,…,mix ik ,…mix id}, where mix ik Represents the i-th user v i With the kth user v in the set of close and important users k Mixed familiarity; d represents the total number of users in the set of close and important users;

[0020] Step 1.5: Select all users from the social network G who are closely connected to the user group. The user in the middle has no edge connection to the user and is treated as v i General users, and close users grouped together Behavioral attribute set A close All users with a similarity of 1 among them are represented as v i Potential users and constitute v i Potential user friend collection U i and will gather potential user friends U i The edges between all users with a similarity of 1 constitute a virtual edge set E'. i ;

[0021] Step 2: Add connections between users;

[0022] Step 2.1: Define the current loop count as T, and initialize T = 1;

[0023] For the i-th user v respectively i intimate user group Add edges between close users and use them as v i User friend set in the Tth cycle

[0024] Step 2.2, using the potential user friend group U i With user friends The intersection between them is v i The target user set in the Tth cycle

[0025] Step 2.3: Calculate the objective function for adding user connections in the Tth iteration using equation (4).

[0026]

[0027] In equation (4), Represents a user's friend set The number of inner edges; Represents a user's friend set Users in and not in The number of edges between users in the data;

[0028] Step 2.4, Judgment Each user joins In, and in the virtual edge set E' i After adding the corresponding edges, Does it increase? If it increases, then from... After deleting the corresponding user, add to If the condition is met, then no friend is added, thus obtaining the user friend set for the (T+1)th iteration.

[0029] Step 2.5, Judgment Is it empty? If it is empty, then... join in After removing duplicate users, we get v i End user friend set Otherwise, after assigning T+1 to T, return to step 2.2 and execute sequentially;

[0030] Step 3: Calculate the value of the i-th user v i mode of behavioral attributes Local modularity;

[0031] Step 3.1: Calculate the i-th user v according to equation (5). i Ave_s's criteria for choosing friends i :

[0032] Ave_s i =mode{s i1 ,s i2 ,…,s ik ,…,s id} (5)

[0033] In equation (5), s ik Represents the i-th user v i Behavioral attribute A i With user friends The kth user v k Behavioral attribute A k The similarity between them; mode represents the modal function;

[0034] If s ik ≥Ave_s i The table represents the k-th user v. k Matching user v i The selection criteria for users are defined; otherwise, it indicates that the k-th user v... k Does not meet user v i Criteria for choosing friends;

[0035] Step 3.2: Construct the i-th user v using equation (6). i User Friends Collection Local modularity

[0036]

[0037] In equation (6), |E| represents the number of edges between users in the social network representation G. Represents the i-th user v i User Friends Collection The number of edges between users Represents the i-th user v i User Friends Collection Number of edges between users and user friend collection Users in the friend list and those not in the user's friend list The sum of the number of edges between users in the system;

[0038] Step 4: Calculate the value of user v using the particle swarm optimization algorithm. i User Friends Collection True friends in the world;

[0039] Step 4.1: Initialize the parameters of the particle swarm optimization algorithm, including the total number of particles τ. max Number of iterations t, maximum number of iterations t max The current particle number τ is determined, and t is initialized to 1.

[0040] Step 4.2: Use the position of the τ-th particle in the t-th generation population as v. i For user friend collection The choices made by each user are represented by the velocity of the τ-th particle in the t-th generation population. i For user friend collection The selection direction of each user determines the position of the τ-th particle in the t-th generation of the population. and speed and Let k represent the k-th position and k-th velocity of the τ-th particle in the t-th generation population, respectively, where if This indicates that the user's friend set has been selected. The k-th user v k As true friends, if This means that the user's friend set is not selected. The k-th user v k As true friends, 1≤τ≤τ max ; 1≤k≤d; if This indicates that the user's friend set has been selected. The k-th user v k If you're going in the wrong direction as a friend, then... This indicates that the user's friend set has been selected. The k-th user v k Being friends is the right direction;

[0041] Step 4.3: Calculate the local modularity of the τ-th particle in the t-th generation population using equation (6) and use it as the fitness. Thus, the τ in the t-th generation population is obtained. max The fitness of each particle is calculated, and the particle with the highest fitness is selected as the locally optimal particle in the t-th generation population. The optimal position of the locally optimal particle in the t-th generation population is denoted as . in, Let k represent the k-th dimension optimal position of the locally optimal particle in the t-th generation population;

[0042] Step 4.4, As the globally optimal particle X gbest ={x gbest,1 ,x gbest,2 ,…,x gbest,k ,…x gbest,d}; where X gbest,k This represents the k-th dimension optimal position in the globally optimal particle;

[0043] Step 4.5: Based on the position of the τ-th particle in generation t. and speed Calculate the position of the τth particle in the (t+1)th generation. and speed Thus, τ in the (t+1)th generation particle swarm is obtained. max The position and velocity of each particle;

[0044] Step 4.6: Following the process in Step 4.3, obtain the optimal position of the locally optimal particle in the (t+1)th generation population, denoted as... in, Let k represent the k-th dimension optimal position of the locally optimal particle in the (t+1)th generation population;

[0045] Step 4.7, if X gbest The fitness is greater than The fitness of the particle X will then maintain the globally optimal particle X. gbest Otherwise, Assigned to X gbest ;

[0046] Step 4.8: Assign t+1 to t, and check t. <t max Check if the condition is met. If it is, proceed to step 4.5 sequentially; otherwise, it indicates that step t is complete. max The next iteration yields the globally optimal particle X. gbest The corresponding user friend selection scheme and as v i The final selection of true friends.

[0047] The friend recommendation method based on local community detection combining topology and attributes described in this invention is characterized by the fact that, in step 4.2, the position of the τ-th particle in the t-th generation population... and speed It is generated according to the following steps:

[0048] Step 4.2.1: Calculate the initial velocity of the τ-th particle in the k-th dimension of the population in the t-th generation using equation (7).

[0049]

[0050] In equation (7), v max v represents the maximum speed. min Indicates minimum speed; Let represent the k-th dimension random number between [0,1] for the τ-th particle in the t-th generation population;

[0051] Step 4.2.2: Calculate the initial position of the τ-th particle in the k-th dimension of the population in the t-th generation using equation (8).

[0052]

[0053] In equation (8), p max p represents the probability of the maximum position. min Let q represent the minimum position probability, and q be a parameter. v represents the k-th user of the τ-th particle in the t-th generation population. k With v i Mixed similarity;

[0054] judge Is it greater than the random number rand1? If it is, then let... Otherwise, let Where rand1 represents a random number between [0,1];

[0055] Step 4.2.3: Following steps 4.2.1 and 4.2.2, obtain the position and velocity of the τ-th particle in all dimensions in generation t.

[0056] Step 4.5 is performed as follows:

[0057] Step 4.5.1: Update the k-th dimension velocity of the τ-th particle in the (t+1)-th generation population according to equation (9). Thus, the velocity of the τth particle in all dimensions is obtained in the (t+1)th generation;

[0058]

[0059] In equation (9), ω represents a fixed parameter, and c1 and c2 represent two learning factors;

[0060] Step 4.5.2: According to equation (10), determine the velocity of the τ-th particle in the k-th dimension of the t-th generation population. Convert to user factors

[0061]

[0062] Step 4.5.3: Update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension search space. This allows us to obtain the position of the τ-th particle in all dimensions of the search space during the (t+1)-th generation.

[0063] Step 4.5.3.1, if Perform step 4.4.3.2; otherwise, let Where rand2 represents a random number between [0,1];

[0064] Step 4.5.3.2: When If the conditions are met Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension. If satisfied and Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension.

[0065] when If the conditions are met Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension. If satisfied and Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension.

[0066] The present invention provides an electronic device, including a memory and a processor, wherein the memory is used to store a program that supports the processor in executing the friend recommendation method, and the processor is configured to execute the program stored in the memory.

[0067] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps of the friend recommendation method.

[0068] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0069] 1. This invention effectively combines local community information and designs an edge-adding initialization strategy method that considers both community topology and node attribute information. Through the edge-adding step, it solves the problem of insufficient recommendation reasons in existing technologies, making the social network structure more compact. When recommending to users, in addition to considering the principle of friend relationships, it adds user behavioral attributes, such as interests and hobbies, to the recommendations, thus making the recommendation reasons more comprehensive.

[0070] 2. This invention, by combining with the particle swarm optimization algorithm, designs a flipping strategy method based on user behavior attributes. During the evolution process, the flipping position of the next generation of particles is determined by factors such as particle velocity, particle position, and user factor. Finally, the global optimal solution of the particles is obtained to represent the user's final true set of friends, thereby overcoming the problem of temporary friends in "friends of friends are friends". The scope of recommended friends is more reasonable, the accuracy of the friend recommendation system is improved, and the recommendations to users can arouse user interest. Attached Figure Description

[0071] Figure 1 This is a flowchart of the method of the present invention;

[0072] Figure 2 This is a diagram illustrating the edge-adding strategy of the present invention.

[0073] Figure 3 This is a standard diagram for selecting friends in this invention;

[0074] Figure 4 This is a diagram showing the operator flipping mechanism of the present invention. Detailed Implementation

[0075] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0076] In this embodiment, a friend recommendation method based on local community detection combining topology and attributes is applied to a social network, which is represented as G = {V, E, A}, where V = {v1, v2, ..., v...}. i ,…,v m Let v represent the set of all users in the social network G. i Represents the i-th user; m is the total number of users; E = {e ij |i=1,2,…,m;j=1,2,…,m} represents the set of connections between any two users; e ij Represents the i-th user v i With the j-th user v j The connection between them; if the i-th user v iWith the j-th user v j If there is a relationship between them, then let e ij =1; otherwise, let e ij =0; A = {A1,A2,…,A} i ,…,A m} represents the set of group behaviors in social network G; A i Let v represent the i-th user in the set of group behavior attributes A. i A set of behavioral attributes; such as Figure 1 As shown, this friend recommendation method proceeds through the following steps:

[0077] Step 1: Determine the i-th user v i Relationships with other users;

[0078] Step 1.1: Calculate the i-th user v using equation (1). i The probability of being selected, P i :

[0079]

[0080] In equation (1), d ij Represents the i-th user v i With the j-th user v j The shortest distance between users; p max p represents the maximum probability that a user will be selected. max =1.0, p min p represents the minimum probability of a user being selected. min =0.1, d max Indicates the maximum distance between users;

[0081] Determine P i Is P greater than the random number rand? If it is, then let P... i =1; otherwise, let P i =0.

[0082] Step 1.2: Calculate the i-th user v using equation (2). i Behavioral attribute set A i With the j-th user v j Behavioral attribute set A j Similarity S between ij :

[0083]

[0084] Determine S ij Is it greater than or equal to Δ1 and less than or equal to 1? If so, let S ij =1; otherwise, determine S ij Is it less than Δ1 and greater than Δ2? If so, then Sij Otherwise, it means S remains unchanged. ij Less than or equal to Δ2 and greater than or equal to 0, and let S ij =0.

[0085] Step 1.3: Calculate the i-th user v using equation (3). i With the j-th user v j Mix similarity ij Thus, the i-th user v is obtained. i The user v is obtained by combining the mixed similarity with all users and sorting them in descending order. i A mixed similarity set;

[0086] Mix ij =S ij +P i (3)

[0087] Step 1.4: Set two similarity thresholds to determine the ranking of the i-th user v after sorting. i The mixed similarity set is divided into three subsets, and all users in the first subset are taken as the i-th user v. i Close user group All users in the second subset are considered as the i-th user v. i Important user set All users in the third subset are considered as the i-th user v. i A collection of unfamiliar users

[0088] According to the i-th user v i intimate user group With important user groups The sequence number of the middle user to the close user set With important user groups Sort all users in ascending order to get the i-th user v. i The sorted set of close and important users;

[0089] According to the i-th user v i The sorted set of close and important users yields the corresponding mixed similarity set, denoted as mix. i ={mix i1 ,mix i2 ,…,mix ik ,…mix id}, where mix ik Represents the i-th user v i With the kth user v in the set of close and important users k Mixed familiarity; d represents the total number of users in the set of close and important users.

[0090] Step 1.5: Select all users from the social network G who are closely connected to the user group. The user in the middle has no edge connection to the user and is treated as v i General users, and close users grouped together Behavioral attribute set A close All users with a similarity of 1 among them are represented as v i Potential users and constitute v i Potential user friend collection U i and will gather potential user friends U i The edges between all users with a similarity of 1 constitute a virtual edge set E'. i .

[0091] Step 2: Add connections between users;

[0092] Step 2.1: Define the current loop count as T, and initialize T = 1;

[0093] For the i-th user v respectively i intimate user group Add edges between close users and use them as v i User friend set in the Tth cycle

[0094] Step 2.2, using the potential user friend group U i With user friends The intersection between them is v i The target user set in the Tth cycle

[0095] Step 2.3: Calculate the objective function for adding user connections in the Tth iteration using equation (4).

[0096]

[0097] In equation (4), Represents a user's friend set The number of inner edges; Represents a user's friend set Users in and not in The number of edges between users in the system.

[0098] Step 2.4, Judgment Each user joins In, and in the virtual edge set E' i After adding the corresponding edges, Does it increase? If it increases, then from... After deleting the corresponding user, add to If the condition is met, then no friend is added, thus obtaining the user friend set for the (T+1)th iteration.

[0099] Step 2.5, Judgment Is it empty? If it is empty, then... join in After removing duplicate users, we get v i End user friend set Otherwise, after assigning T+1 to T, return to step 2.2 and execute sequentially.

[0100] like Figure 2 As shown, Figure 2 Part (a) in the diagram represents the constructed social network. Part (b) shows the dashed lines representing the edges to be added. {1,2,5} is the initial set of user friends. Edge (2,5) is an edge within the added set of close friends. Edges (3,5) and (3,1) are the virtual edges corresponding to node 3. Part (c) in the diagram represents the network after adding connections between users.

[0101] The current local community members are {1,2,5}, and the objective function is M. 前 =1.00; Node 1 is user v i Nodes 2 and 5 are close user nodes; target user set One user in the system, node 3; virtual edge set E' i The corresponding edges (3,1) and (3,5) are given; the addition operation is performed, and the local community members are now {1,2,3,5}. The objective function M is... 后 =2.00; M 后 >M 前 This indicates that the addition was successful.

[0102] Step 3: Calculate the value of the i-th user v i mode of behavioral attributes Local modularity;

[0103] Step 3.1: Calculate the i-th user v according to equation (5). i Ave_s's criteria for choosing friends i :

[0104] Ave_s i =mode{s i1 ,s i2 ,…,s ik ,…,s id} (5)

[0105] In equation (5), s ik Represents the i-th user v iBehavioral attribute A i With user friends The kth user v k Behavioral attribute A k The similarity between them; mode represents the modal function.

[0106] If s ik ≥Ave_s i The table represents the k-th user v. k Matching user v i The selection criteria for users are defined; otherwise, it indicates that the k-th user v... k Does not meet user v i Criteria for choosing friends;

[0107] like Figure 3 As shown, intimate nodes represent close users, important nodes represent important users, and unfamiliar nodes represent unfamiliar users; node 1 represents user v. i The friend selection criteria Ave_s1 = mode{1.00,0.98,0.78,0.63,0.85,0.51,0.55,0.61}, Ave_s1 = 0.60; users v6 and v7 do not meet the friend selection criteria of user v1, while users v1, v2, v3, v4, v5, and v8 meet the friend selection criteria of user v1.

[0108] Step 3.2: Construct the i-th user v using equation (6). i User Friends Collection Local modularity

[0109]

[0110] In equation (6), |E| represents the number of edges between users in the social network representation G. Represents the i-th user v i User Friends Collection The number of edges between users Represents the i-th user v i User Friends Collection Number of edges between users and user friend collection Users in the friend list and those not in the user's friend list The sum of the number of edges between users in the system.

[0111] Step 4: Calculate the value of user v using the particle swarm optimization algorithm. i User Friends Collection True friends in the world;

[0112] Step 4.1: Initialize the parameters of the particle swarm optimization algorithm, including the total number of particles τ.max Number of iterations t, maximum number of iterations t max The current particle number τ is determined, and t is initialized to 1.

[0113] Step 4.2: Use the position of the τ-th particle in the t-th generation population as v. i For user friend collection The choices made by each user are represented by the velocity of the τ-th particle in the t-th generation population. i For user friend collection The selection direction of each user determines the position of the τ-th particle in the t-th generation of the population. and speed and Let k represent the k-th position and k-th velocity of the τ-th particle in the t-th generation population, respectively, where if This indicates that the user's friend set has been selected. The k-th user v k As true friends, if This means that the user's friend set is not selected. The k-th user v k As true friends, 1≤τ≤τ max ; 1≤k≤d; if This indicates that the user's friend set has been selected. The k-th user v k If you're going in the wrong direction as a friend, then... This indicates that the user's friend set has been selected. The k-th user v k Being friends is the right direction.

[0114] Step 4.2.1: Calculate the initial velocity of the τ-th particle in the k-th dimension of the population in the t-th generation using equation (7).

[0115]

[0116] In equation (7), v max v represents the maximum speed. max =9, v min V represents the minimum speed. min =-9; Let represent the k-th dimension random number between [0,1] for the τ-th particle in the t-th generation population;

[0117] Step 4.2.2: Calculate the initial position of the τ-th particle in the k-th dimension of the population in the t-th generation using equation (8).

[0118]

[0119] In equation (8), p max p represents the probability of the maximum position. max =1.0, p min p represents the minimum position probability. min =0.4, q is a parameter, q=0.1, v represents the k-th user of the τ-th particle in the t-th generation population. k With v i Mixed similarity.

[0120] judge Is it greater than the random number rand1? If it is, then let... Otherwise, let Here, rand1 represents a random number between [0,1].

[0121] Step 4.2.3: Following steps 4.2.1 and 4.2.2, obtain the position and velocity of the τ-th particle in all dimensions in generation t.

[0122] Step 4.3: Calculate the local modularity of the τ-th particle in the t-th generation population using equation (6) and use it as the fitness. Thus, the τ in the t-th generation population is obtained. max The fitness of each particle is calculated, and the particle with the highest fitness is selected as the locally optimal particle in the t-th generation population. The optimal position of the locally optimal particle in the t-th generation population is denoted as . in, Let k represent the k-th dimension optimal position of the locally optimal particle in the t-th generation population;

[0123] Step 4.4, As the globally optimal particle X gbest ={x gbest,1 ,x gbest,2 ,…,x gbest,k ,…x gbest,d}; where x gbest,k This represents the k-th dimension optimal position in the globally optimal particle.

[0124] Step 4.5: Based on the position of the τ-th particle in generation t. and speed Calculate the position of the τth particle in the (t+1)th generation. and speed Thus, τ in the (t+1)th generation particle swarm is obtained. max The position and velocity of each particle.

[0125] Step 4.5.1: Update the k-th dimension velocity of the τ-th particle in the (t+1)-th generation population according to equation (9). Thus, the velocity of the τth particle in all dimensions is obtained in the (t+1)th generation;

[0126]

[0127] In equation (9), ω represents a fixed parameter, ω = 0.729, and c1 and c2 represent two learning factors, c1 = 1.414 and c2 = 1.414.

[0128] Step 4.5.2: According to equation (10), determine the velocity of the τ-th particle in the k-th dimension of the t-th generation population. Convert to user factors

[0129]

[0130] Step 4.5.3: Update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension search space. This allows us to obtain the position of the τ-th particle in the (t+1)-th generation across all dimensions of the search space.

[0131] Step 4.5.3.1, if Perform step 4.4.3.2; otherwise, let Where rand2 represents a random number between [0,1];

[0132] Step 4.5.3.2: When If the conditions are met Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension. If satisfied and Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension.

[0133] when If the conditions are met Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension. If satisfied and Then update the position of the τ-th particle in the (t+1)-th generation in the k-th dimension.

[0134] like Figure 4 As shown, the initial friend set {1,1,0,0,1,0,1,0} is... Figure 3 Corresponding to the nodes shown, the friend set after the flip is {1,1,1,1,1,0,0,0}, through the update flip strategy in step 4.5.

[0135] Step 4.6: Following the process in Step 4.3, obtain the optimal position of the locally optimal particle in the (t+1)th generation population, denoted as... in, Let represent the k-th dimension optimal position of the locally optimal particle in the (t+1)th generation population.

[0136] Step 4.7, if X gbest The fitness is greater than The fitness of the particle X will then maintain the globally optimal particle X. gbest Otherwise, Assigned to X gbest ;

[0137] Step 4.8: Assign t+1 to t, and check t. <t max Check if the condition is met. If it is, proceed to step 4.5 sequentially; otherwise, it indicates that step t is complete. max The next iteration yields the globally optimal particle X. gbest The corresponding user friend selection scheme and as v i The final selection of true friends.

[0138] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.

[0139] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.

Claims

1. A friend recommendation method based on local community detection combining topology and attributes, characterized by applying... In a social network, the social network is characterized as ,in, Represents the social network The collection of all users, Indicates the first One user; The total number of users; This represents the set of connections between any two users; Indicates the first individual users With the individual users The connection between them; if the first individual users With the individual users If there is a relationship, then let =1; otherwise, let =0; Represents the social network A set of group behavior attributes; Represents the set of group behavior attributes The Middle individual users The set of behavioral attributes; the friend recommendation method is performed according to the following steps: Step 1: Determine the number individual users Relationships with other users; Step 1.1: Calculate the first step using equation (1). individual users probability of being selected : (1) In equation (1), Indicates the first individual users With the individual users The shortest distance between users; This indicates the highest probability that a user will be selected. This represents the minimum probability of a user being selected. Indicates the maximum distance between users; judge Is it greater than a random number? If it is greater than, then let =1; otherwise, let =0; Step 1.2: Calculate the first step using equation (2). individual users behavioral attribute set With the individual users behavioral attribute set Similarity between : (2) judge Is it greater than or equal to Δ1 and less than or equal to 1? If so, then let... =1; otherwise, determine Is it less than Δ1 and greater than Δ2? If so, then Keep unchanged, otherwise indicate Less than or equal to Δ2 and greater than or equal to 0, and let =0; Step 1.3: Calculate the first step using equation (3). individual users With the individual users Mixed similarity Thus, the first individual users The mixed similarity with all users is then sorted in descending order to obtain the sorted number. individual users A mixed similarity set; (3) Step 1.4: Set two similarity thresholds to determine the order of the sorted numbers. individual users The mixed similarity set is divided into three subsets, and all users in the first subset are used as the second subset. individual users Close user group All users in the second subset are taken as the first individual users Important user set All users in the third subset are taken as the first individual users A collection of unfamiliar users ; According to the individual users intimate user group With important user groups The sequence number of the middle user to the close user set With important user groups Sort all users in ascending order to get the number. individual users The sorted set of close and important users; According to the individual users The sorted set of close and important users yields the corresponding mixed similarity set, denoted as . ,in, Represents the i-th user The kth user in the set of close and important users Mixed similarity; d represents the total number of users in the set of close and important users; Step 1.5: From social networks Select all those that are related to The user in the middle has no edge connection to the user and is as General users, including general users behavioral attribute set All users with a similarity of 1 among them are considered as Potential users and constitute Potential user friend set and potential user friend set The edges between all users with a similarity of 1 constitute a virtual edge set. ; Step 2: Add connections between users; Step 2.1: Define the current loop count as... and initialize ; For the first individual users intimate user group Add edges between close users and use them as... In the User friend set in the second cycle ; Step 2.2: Utilize potential user friend sets With user friends The intersection between them as In the The target user set in the next loop ; Step 2.3: Calculate the first step using equation (4). The objective function for adding inter-user connections in the second loop. : (4) In equation (4), Represents a user's friend set The number of inner edges; Represents a user's friend set Users in and not in The number of edges between users in the data; Step 2.4, Judgment Each user joins In, and in the virtual edge set After adding the corresponding edges, Does it increase? If it increases, then from... After deleting the corresponding user, add to In the middle, otherwise, do not add, thus obtaining the first... User friend set in the second cycle ; Step 2.5, Judgment Is it empty? If it is empty, then... After removing duplicate users, we get End user friend set Otherwise, Assign to Then, return to step 2.2 and execute sequentially; Step 3, calculate the first... individual users mode of behavioral attributes Local modularity; Step 3.1: Calculate the first step according to equation (5). individual users Criteria for choosing friends : (5) In equation (5), Indicates the first individual users behavioral attributes With user friends The Middle individual users The similarity between them; This represents the modulo function; if The table then shows the first individual users Meets user needs The criteria for choosing a friend; otherwise, it indicates the first individual users Does not meet user requirements Criteria for choosing friends; Step 3.2: Construct the first... using equation (6) individual users User Friends Collection Local modularity ; (6) In equation (6), Representation of social networks The number of edges between users Indicates the first individual users User Friends Collection The number of edges between users Indicates the first individual users User Friends Collection Edge between users and user friend collection Users in and not in the user's friend set The sum of the number of edges between users in the system; Step 4: Calculate the first... individual users User Friends Collection True friends in the world; Step 4.1: Initialize the parameters of the particle swarm optimization algorithm, including the total number of particles. Number of iterations Maximum number of iterations Current particle number and initialize =1; Step 4.2, take the t-th generation of the population as the first... The position of each particle is used as For user friend collection The selection of each user in the t-th generation of the population. The velocity of each particle is used as For user friend collection The selection direction of each user in the t-th generation determines the generation of the t-th population. The position of each particle = and speed = , and They represent the t-th generation of the population. The k-th dimension position and k-th dimension velocity of a particle, where if =1 indicates that the user's friend set is selected. The first in individual users As true friends, if =0 means that the user's friend set is not selected. The first in individual users As true friends ; ;like If <0, it means the user's friend set is selected. The first in individual users If you're going in the wrong direction as a friend, then... This indicates that the user's friend set has been selected. The first in individual users Being friends is the right direction; Step 4.3: Use equation (6) to calculate the number of generations in the t-th generation population. The local modularity of each particle is used as the fitness. Thus, the population in generation t is obtained. The fitness of each particle is calculated, and the particle with the highest fitness is selected as the locally optimal particle in the t-th generation population. The optimal position of the locally optimal particle in the t-th generation population is denoted as . = ,in, Let k represent the k-th dimension optimal position of the locally optimal particle in the t-th generation population; Step 4.4, As the globally optimal particle ;in, This represents the k-th dimension optimal position in the globally optimal particle; Step 4.5, based on the t-th generation... The position of each particle and speed Calculate the t+1th generation respectively The position of each particle and speed Thus, the particle swarm of generation t+1 is obtained. The position and velocity of each particle; Step 4.5.1: Update the population of generation t+1 according to equation (9). The k-th dimension velocity of the particles Thus, the th generation in the (t+1)th generation is obtained. The velocity of a particle in all dimensions; (9) In equation (9), Indicates a fixed parameter. This represents two learning factors; Step 4.5.2: According to equation (10), the t-th generation population... The velocity of a particle in the k-th dimension Convert to user factors ; (10) Step 4.5.3: Update the (t+1)th generation... The position of each particle in the k-th dimension search space Thus, the (t+1)th generation is obtained. The position of each particle in the search space across all dimensions; Step 4.5.3.1, if If so, proceed to step 4.4.3.2; otherwise, let ;in, Represents a random number between [0, 1]; Step 4.5.3.2: When =0, If the conditions are met Then update the (t+1)th generation. The particle is located in the k-th dimension. If satisfied and Then update the (t+1)th generation. The particle is located in the k-th dimension. ; when =1, If the conditions are met Then update the (t+1)th generation. The particle is located in the k-th dimension. If satisfied and Then update the (t+1)th generation. The particle is located in the k-th dimension. ; Step 4.6: Following the process in Step 4.3, obtain the optimal position of the locally optimal particle in the (t+1)th generation population, denoted as... = ,in, Let k represent the k-th dimension optimal position of the locally optimal particle in the (t+1)th generation population; Step 4.7, if The fitness is greater than The fitness of the particle determines the globally optimal particle. Unchanged, otherwise, Assign to ; Step 4.8: Assign t+1 to t, and check if t < 1. Check if the condition is met. If it is, proceed to step 4.5 sequentially; otherwise, the process is complete. The next iteration yields the globally optimal particle. The corresponding user friend selection scheme and as The final selection of true friends.

2. The friend recommendation method based on local community detection combining topology and attributes according to claim 1, characterized in that, In step 4.2, the t-th generation of the population... The position of each particle and speed It is generated according to the following steps: Step 4.2.1: Use equation (7) to calculate the number of generations in the t-th generation population. The initial velocity of the particles in the k-dimensional search space : (7) In equation (7), Indicates the maximum speed. Indicates minimum speed; In the t-th generation of the population, the first generation is the th... Individual particles The k-th dimension of random numbers between; Step 4.2.2: Use equation (8) to calculate the number of generations in the t-th generation population. The initial positions of the particles in the k-dimensional search space : (8) In equation (8), Indicates the probability of the maximum position. This represents the probability of the minimum position. For parameters, In the t-th generation of the population, the first generation is the th... The kth user of the particles and Mixed similarity; judge Is it greater than a random number? If it is greater than, then let =1; otherwise, let =0; where, Represents a random number between [0, 1]; Step 4.2.3: Following steps 4.2.1 and 4.2.2, obtain the th generation in the t-th generation. The position and velocity of each particle in all dimensions.

3. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing any of the friend recommendation methods described in claims 1-2, and the processor is configured to execute the program stored in the memory.

4. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is run by the processor, it performs the steps of any of the friend recommendation methods described in claims 1-2.

Citation Information

Patent Citations

  • Method and system for friend recommendation based on similar associations in social network

    CN104731962A