Social network key node discovery method based on social relation distance
By adopting a social relationship distance-based method in social networks, computing and iteratively deleting nodes to determine the degree of social relationship closeness, the problem of difficulty in identifying key nodes in social networks is solved, and accurate detection and identification of key users is achieved.
Patent Information
- Application Number
- CN202411875617.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-18
AI Technical Summary
The prior art is difficult to effectively identify key users in social networks that occupy a core position through relationship transmission mechanisms, which limits their application effect in practice.
Using a method based on social relationship distance, by obtaining the social network adjacency matrix and user social relationship distance of the social network graph, the breadth-first traversal algorithm is used to calculate the set and number of nodes contained in the social relationship distance by nodes, iteratively delete nodes to calculate the degree of social relationship tightness, and finally output the node with the largest (k, δ)-core social network as the key node.
It can accurately discover key nodes in social networks, improving the measurement of user relationship tightness and the accuracy of key user detection.
Smart Images

Figure CN119850356A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic digital data processing, and in particular to a method for discovering key nodes of a social network based on social relationship distance. Background Art
[0002] With the rapid development of Internet technology, the scale of user participation in social networks continues to expand, prompting the study of interactive relationships between users in social networks to become a core issue in recent years. The closeness of user social relationships in social networks determines the overall stability of social networks. Specifically, the retention decision of users in social networks is often based on the size of their social circles, and the strength of social relationships is directly reflected by the number of friends shared between users.
[0003] In order to accurately discover subgraphs with dense user relationships in social networks, many social network relationship analysis models have been proposed, including k-core, k-truss, and k-clique. However, these models have certain limitations in defining social network structural constraints. They only focus on the structural characteristics between users and their immediate neighbors, and fail to fully consider the propagation characteristics of social relationships in the network. Given the complexity and dynamics of social relationships in the real world, these models often find it difficult to effectively identify key users who occupy a core position in the network through relationship transmission mechanisms when applied to large-scale social networks, thus limiting their application in practice.
[0004] How to discover key nodes in social networks has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present invention provides a method for discovering key nodes of a social network based on social relationship distance, which solves the technical problem that the key nodes of a social network cannot be discovered.
[0006] In order to solve the above technical problems, the technical solutions adopted by the present invention are as follows:
[0007] A method for discovering key nodes in a social network based on social relationship distance comprises the following steps:
[0008] Step S1: Obtain the social network adjacency matrix G and the user social relationship distance δ of the social network graph, and use the breadth-first traversal algorithm to calculate the node set {M} of all nodes within the user social relationship distance δ from the social network adjacency matrix G. δ (u,G)|u∈V(G)} and the number of nodes {Mn δ (u,G)|u∈V(G)}, u is a node, V(G) is the set of all nodes in the social network adjacency matrix G;
[0009] Step S2: By iteratively deleting the node with the smallest number of nodes within the user social relationship distance δ of node u in the social network adjacency matrix G, the social relationship closeness set K of all nodes in the social network adjacency matrix G is calculated. δ (u, G), u∈V(G);
[0010] Step S3: Whenever a node u is deleted from the social network adjacency matrix G, the node set {M δ (v, G-{u})|v∈V(G-{u})} and the number of nodes {Mn δ (v, G-{u})|v∈V(G-{u})};
[0011] Step S4: Iterate steps S2 and S3 until all nodes in the social network adjacency matrix G are deleted, and finally output the maximum (k, δ)-core social network of the social network adjacency matrix G, i.e., max-C k,δ The node corresponding to (G) is the key node.
[0012] A further technical solution is that in step S2, when the subgraph S belongs to a subgraph of the social network adjacency matrix G and satisfies: each node u in the subgraph S satisfies the node number Mn δ (u, S) ≥ node number constraint k, and subgraph S is a maximal connected subgraph, then subgraph S is the (k, δ)-core of the social network adjacency matrix G. The (k, δ)-core of the social network adjacency matrix G is represented by C k,δ (G), When δ=1, (k, 1)-core is a k-core social network model; the (k, δ)-core subgraph with the maximum k value constraint is called the maximum (k, δ)-core social network of the social network adjacency matrix G, denoted as max-C k,δ (G); The closer the user social relationship of a node is, the greater the degree of association between the node and other nodes in the social network. The node with the closest user social relationship is the key user of the social network.
[0013] A further technical solution is that: in step S2, the social relationship closeness set K of all nodes in the social network adjacency matrix G is δ (u, G) is the (k, δ)-core of the social network adjacency matrix G, i.e., C k,δ Another form of (G) is to constrain the number of nodes k contained in the social relationship distance δ of the user, and the node u∈C k,δ (G) and K δ (u, G) = k.
[0014] A further technical solution is that the step S3 is specifically divided into the following steps:
[0015] Step S301: Node u and node set M δ (u, G) constitutes the induced subgraph G′ of the social network adjacency matrix G, and defines the set M to update the node set M δ The social relationship set of all nodes in (u, G) within the distance δ;
[0016] Step S302: Initialize the node set M δ The set of all nodes h in (u, G) M[h] = {h}; h represents the relationship nodes contained in the social relationship distance δ of node u;
[0017] Step S303: Calculate M[h]=M[h]∪M[w], where node w is the associated edge node of h;
[0018] Step S304: Execute step S303 for δ times and end;
[0019] Step S305: Node set Mn δ The reduced value of (v, G-{u}) is to satisfy G′∩M δ-d (u, G) and the number of nodes where δ(w,u)<δ-d, d=δ G (u, v), v∈V(G-{u}), the node set Mn can be calculated δ (v, G-{u}) value.
[0020] A further technical solution is that the step S3 is specifically divided into the following steps:
[0021] Step S301′: define an integer array A to represent the node u in the node set M δ The bitmap of each node on the induced subgraph G′ derived by (u, G), and initialize the bitmap of each node to 0;
[0022] Step S302′: number the nodes in the social network adjacency matrix G starting from 0, and calculate BITMAP(u) to represent the position of node u in the bitmap;
[0023] BITMAP(u):u→n (2)
[0024] Formula (2) is the mapping relationship definition of the BITMAP function, u∈V(G), n is a natural number;
[0025] Step S303′: Set the node set M δThe bitmap bit BITMAP(v) of the node v in (u, G) whose user social relationship distance is less than δ is set to 1, otherwise it is 0;
[0026] Step S304′: Calculate the reachable node set A of each node using a dynamic programming algorithm, and implement the process of merging two reachable sets through a bitwise OR operation of the bitmap;
[0027] Step S305′: Use bitwise AND operation to determine the node w∈M δ-l Whether (u, G) and node v are reachable within the social relationship distance δ, if the condition (1<<map(w))&(A[j][map(v)]) is satisfied, then update M δ (v, G-{u})(v∈V(G-{u})), otherwise continue to look for node w∈M δ-l Whether (u, G) and node v are reachable within the social relationship distance δ.
[0028] A further technical solution is: in the step S304′, the initial value conditions are: i=1, j=2; the calculation formula is: A[i][map(v)]←A[i][map(v)]|A[j][map(w)], A[i][map(w)]←A[i][map(w)]|A[j][map(v)], e(v, w)∈E(G′); iterate δ times, and exchange the values of i and j in each iteration.
[0029] The beneficial effects of adopting the above technical solution are:
[0030] A method for discovering key nodes in a social network based on social relationship distance comprises the following steps: Step S1: obtaining a social network adjacency matrix G and a user social relationship distance δ of a social network graph, and using a breadth-first traversal algorithm to calculate from the social network adjacency matrix G a node set {M} of all nodes within the user social relationship distance δ. δ (u, G)|u∈V(G)} and the number of nodes {Mn δ (u, G)|u∈V(G)}, u is a node, V(G) is the set of all nodes in the social network adjacency matrix G; Step S2: By iteratively deleting the node with the smallest number of nodes within the user social relationship distance δ of node u in the social network adjacency matrix G, the social relationship closeness set K of all nodes in the social network adjacency matrix G is calculated δ (u, G), u∈V(G); Step S3: Whenever a node u is deleted from the social network adjacency matrix G, the node set corresponding to the remaining node set in the social network adjacency matrix G is updated {M δ (v, G-{u})|v∈V(G-{u})} and the number of nodes {Mn δ(v, G-{u})|v∈V(G-{u})}; Step S4: Iterate steps S2 and S3 until all nodes in the social network adjacency matrix G are deleted, and finally output the maximum (k, δ)-core social network of the social network adjacency matrix G, i.e., max-C k,δ The node corresponding to (G) is a key node. By iteratively executing step S2 and step S3 until all nodes in the social network adjacency matrix G are deleted, the key nodes of the social network can be found.
[0031] Please refer to the detailed description of the specific implementation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1-1 It is the topological diagram of the 1-core social network relationship model;
[0033] Figure 1-2 It is the topological diagram of the 2-core social network relationship model;
[0034] Figure 1-3 It is the topological diagram of the 3-core social network relationship model;
[0035] Figure 2 It is a flowchart for finding key nodes on social networks based on social relationship distance;
[0036] Figure 3-1 It is the topological graph of the social network adjacency matrix G;
[0037] Figure 3-2 It is the topological graph of the social network adjacency matrix G after deleting node u1;
[0038] Figure 3-3 It is the topological graph of the (5,2)-core subgraph of the social network adjacency matrix G;
[0039] Figure 3-4 is the maximum max-C of the social network adjacency matrix G when δ = 2 k,δ (G) Topological graph of (6,2)-core subgraph;
[0040] Figure 4-1 It is the topological graph of the social network adjacency matrix G1;
[0041] Figure 4-2 It is the topological graph of the social network adjacency matrix G1 after deleting node v1;
[0042] Figure 4-3 It is the topological graph of the social network adjacency matrix G1 after deleting nodes v1 and v2;
[0043] Figure 4-4is the maximum max-C of the social network adjacency matrix G1 when δ = 2 k,δ (G) Topological graph of (5,2)-core subgraph;
[0044] Figure 5 These are screenshots of the effectiveness experiments of the social network key node discovery method based on social relationship distance on the Facebook and CA-As datasets respectively;
[0045] Figure 6 This is a screenshot of the performance experiment of the social network key node discovery method based on social relationship distance on the Facebook dataset;
[0046] Figure 7 This is a screenshot of the performance experiment of the social network key node discovery method based on social relationship distance on the CA-As dataset. DETAILED DESCRIPTION
[0047] The purpose of this application is to provide a method for discovering key nodes in a social network based on social relationship distance, obtain social network data, establish an adjacency matrix to store the association relationship between users, and thus form a network; based on social network modeling, calculate the closeness of user social relationships; decompose the social network based on the closeness of user social relationships to obtain the closest social structure; output key node results, and feed the results back to social network analysts for public opinion monitoring and recommendation system construction in social networks.
[0048] This overcomes the shortcomings of the k-core model of social network relationships. The k-core model defines that each node in a social network has at least k neighbors, and all nodes are connected to at least k other nodes in the subgraph. The k-core example graph, where k is 1, 2, and 3 respectively, is as follows.
[0049] like Figure 1-1 As shown in the figure, when k is 1, the topological diagram of the 1-core social network relationship model.
[0050] like Figure 1-2 As shown in the figure, when k is 2, the topological diagram of the 2-core social network relationship model.
[0051] like Figure 1-3 As shown in the figure, when k is 3, the topological diagram of the 3-core social network relationship model.
[0052] The definition of the k-core model restricts the participation of each user in the social network to be the same. However, in real social networks, the social relationships between users can be transferred. The social network relationship model k-core only considers the relationship between users' neighbors, and does not consider the transfer of relationships between users in the social network. This is inconsistent with the current situation of users participating in social networks in the real world.
[0053] This application proposes a social network relationship model (k,δ)-core based on distance δ, where distance δ is a constraint on the user's social relationship distance, and the number of adjacent nodes k restricts the number of adjacent nodes of the user within the social relationship distance to be no less than k. Therefore, key users with different social relationship distances in the social network can be found by adjusting the value of distance δ.
[0054] The social network relationship model (k, δ)-core can form a stable social network by constraining the parameters k and δ. There are certain nodes in the social relationship network that form a highly cohesive subgraph with other nodes. When these nodes leave the social network, the social network will be unable to maintain its original stable structure due to constraints. This application calls these nodes key nodes.
[0055] A social network key node discovery method based on social relationship distance, that is, a key user discovery method oriented to social relationship distance, finds the node with the greatest influence on the entire relationship network as the key user based on the social network relationship model (k,δ)-core. This application proposes that user relationship closeness measures the importance of nodes in social relationship networks, and can accurately detect the most important users in social networks.
[0056] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present application and its application or use. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific embodiments disclosed below.
[0058] Embodiment 1:
[0059] like Figure 2As shown, the present invention discloses a method for discovering key nodes in a social network based on social relationship distance, comprising the following steps:
[0060] Step S1: Obtain the social network adjacency matrix G and the user social relationship distance δ of the social network graph, and use the breadth-first traversal algorithm to calculate the node set {M} of all nodes within the user social relationship distance δ from the social network adjacency matrix G. δ (u, G)|u∈V(G)} and the number of nodes {Mn δ (u, G)|u∈V(G)}, u is a node, and V(G) is the set of all nodes in the social network adjacency matrix G.
[0061] Details are as follows:
[0062] This application is based on undirected graphs.
[0063] Construct the social network adjacency matrix G of the social network graph, and calculate the node set {M δ (u, G)|u∈V(G)}, V(G) is the set of all nodes in the social network adjacency matrix G, δ G (u, v) is the minimum number of hops between node u and node v, M δ (u, G) represents the set of nodes contained in the user social relationship distance δ of node u in the social network adjacency matrix. δ (u, G) = {v∈G|v≠u∧δ G (u, v)≤δ}. Let Mn δ (u, G) = |M δ (u, G)| represents the number of nodes contained in the user social relationship distance δ of node u.
[0064] Input: social network graph, user social relationship distance δ.
[0065] Processing: Based on the social network graph, the social network adjacency matrix G = {V(G) | E(G)} is calculated, where E(G) is the relationship set of edges between all nodes in the social network adjacency matrix. The node set M contained in the user social relationship distance δ of node u is calculated based on the social network adjacency matrix and the breadth-first traversal algorithm. δ (u, G); when δ = 1, M 1 (u, G) is the neighbor set of node u, Mn 1 (u, G) is the degree of node u, and the degree is the number of nodes in the neighbor set; when δ>1, the node set M contained in the user social relationship distance δ is calculated by the graph breadth-first traversal algorithm δ (u, G).
[0066] Output: social network adjacency matrix G, node set {M δ (u, G)|u∈V(G)} and the node number set {Mn δ (u, G)|u∈V(G)}.
[0067] like Figure 3-1 As shown, for example: to calculate M δ (u1, G) as an example, first construct the social network adjacency matrix of the social network graph G = {V(G) | E(G)}, V(G) = {u1, u2, u3, u4, u5, u6, u7, u8}, E(G) = {<u1,u2> ,<u1,u3> ,<u2,u4> ,<u2,u8> , <u3,u5>,<u3,u8> ,<u4,u6> , <u4,u8>,<u5,u7> ,<u5,u8> , <u6,u7>,<u6,u8> ,<u7,u8>},<ui,uj> Indicates that there is an edge connection between node ui and node uj. When δ = 1, according to step S1, we know that the node set M 1 (u1, G) is the neighbor of node u1, calculate M 1 (u1, G) = {u2, u3}, Mn 1 (u1, G) = |M 1 (u1, G)|=2; when δ=2, the node set M can be calculated first through the breadth-first traversal algorithm of the graph 1 (u1, G), then calculate the node set M 1 The neighbors of (u1, G) can get the node set M 2 (u1, G) = {u2, u3, u4, u5, u8}, Mn 2 (u1, G) = |M 2 (u1, G)|=5; Similarly, when δ=3, first calculate the node set M 2 (u1, G), then calculate the node set M 2 The neighbors of (u1, G) can get the node set M 3 (u1, G) = {u2, u3, u4, u5, u6, u7, u8}, Mn 2 (u1, G) = |M 2 (u1, G)|=7; Similarly, when δ is any positive integer N, M can be calculated by the breadth-first traversal algorithm of the graph. N (u1,G),Mn N (u1, G) = |M N (u1, G)|.
[0068] Step S2: By iteratively deleting the node with the smallest number of nodes within the user social relationship distance δ of node u in the social network adjacency matrix G, the social relationship closeness set K of all nodes in the social network adjacency matrix G is calculated. δ (u, G), u∈V(G).
[0069] Input: social network adjacency matrix G, node set {M δ (u, G)|u∈V(G)}, the node number set {Mn δ (u, G)|u∈V(G)}.
[0070] Processing: Traverse the node quantity set {Mn δ (u, G)|u∈V(G)} to obtain the minimum number of nodes min{Mn δ (u, G)|u∈V(G)}, obtain the node u and node set M corresponding to the minimum number of nodes δ (u, G), the number of nodes Mn corresponding to the minimum number of nodes u δ (u, G) is assigned to the compactness intermediate variable temp (Note: If there are multiple nodes u, randomly select one of them u = Random ({u|min{Mn δ (u, G)|u∈V(G)}}, 1), Random(V,n) means selecting n elements from the set V to obtain the compactness intermediate variable temp, temp=min(min{Mn δ (u, G)|u∈V(G)}, temp), initialize temp to positive infinity, and obtain the social relationship closeness K of node u corresponding to the minimum number of nodes δ (u,G),K δ (u, G) = temp, check node set M δ Does each node x in (u, G) satisfy Mn? δ (x, G)≤temp, if it satisfies setting K δ (x, G) = temp, delete the node u corresponding to the minimum number of nodes and the node x corresponding to the calculated social relationship from the social network adjacency matrix, and temp is increased by 1, otherwise only the node u corresponding to the minimum number of nodes is deleted from the social network adjacency matrix; update {M δ (v, G-{u})|v∈V(G-{u})} and {Mn δ (v, G-{u})|v∈V(G-{u})}, update as shown in step S3; repeat the above steps to calculate the social relationship closeness K of the remaining nodes v δ(v, G), v∈V(GU), U represents the set of nodes u corresponding to the minimum number of nodes and nodes x corresponding to the calculated social relationship closeness; the calculation stops when all nodes in the social network adjacency matrix are deleted, and the social relationship closeness of all nodes can be calculated {K δ (u, G)|u∈V(G)}.
[0071] Output: User social relationship closeness set {K δ (u, G)|u∈V(G)}.
[0072] For example:
[0073] like Figure 3-1 As shown, assuming δ = 2, Mn can be calculated from step S1 2 (u1, G) = 5, Mn 2 (u2, G) = Mn 2 (u3, G) = Mn 2 (u4, G) = Mn 2 (u5, G) = Mn 2 (u6, G) = Mn 2 (u7, G) = Mn 2 (u8, G)=7.
[0074] like Figure 3-2 As shown, traverse the node quantity set {Mn δ (u, G)|u∈V(G)} to obtain the minimum value of the number of nodes temp=min(min{Mn 2 (u,G)|u∈V(G)},+∞)=min(Mn 2 (u1, G), +∞) = min (5, +∞) = 5, {u|min{Mn 2 (u, G)|u∈V(G)}}={u1}, so K 2 (u1, G) = temp = 5, M 2 (u1, G) = Mn of each node in {u2,u3,u4,u5,u8} δ (x, G)>5, let U={u1}, only delete u1 from G, G=GU.
[0075] In a new round of iteration, temp increases by 1, and temp=6.
[0076] like Figure 3-2 As shown, update {M δ (u, G)|u∈V(G)} and {Mn δ (u,G)|u∈V(G)},Mn 2 (u2, G) = Mn2 (u3, G) = Mn 2 (u4, G) = Mn 2 (u5, G) = Mn 2 (u6, G) = Mn 2 (u7, G) = Mn 2 (u8, G) = 6, because Mn 2 The values of (ui, G) are the same, i ranges from 2 to 8, so a node u2 is randomly selected, temp = min (6, 6) = 6, K 2 (u2, G) = 6, so K 2 (u3, G) = K 2 (u4, G) = K 2 (u5, G) = K 2 (u6, G) = K 2 (u7, G) = K 2 (u8, G) = K 2 (u2, G)=6.
[0077] In summary, K 2 (u1, G) = 5, K 2 (u3, G) = K 2 (u4, G) = K 2 (u5, G) = K 2 (u6, G) = K 2 (u7, G) = K 2 (u8, G) = K 2 (u2, G)=6.
[0078] Step S2 also includes step S201 and step S202. δ (u, G)|u∈V(G)},
[0079] Step S201: When the subgraph S belongs to a subgraph of the social network adjacency matrix G and satisfies: each node u in the subgraph S satisfies the node number Mn δ (u, S) ≥ node number constraint k, and subgraph S is a maximal connected subgraph, then subgraph S is the (k, δ)-core of the social network adjacency matrix G. The (k, δ)-core of the social network adjacency matrix G is represented by C k,δ (G), When δ=1, (k, 1)-core is a k-core social network model. The (k, δ)-core subgraph with the maximum k value constraint is called the maximum (k, δ)-core social network of the social network adjacency matrix G, denoted as max-C k,δ(G). The closer the user social relationship of a node is, the greater the degree of association between the node and other nodes in the social network. The node with the closest user social relationship is the key user of the social network.
[0080] Details are as follows:
[0081] The social network model (k, δ)-core based on social relationship distance is defined as follows:
[0082] Input: social network adjacency matrix G, user social relationship distance constraint δ, and the number of nodes contained in the user's social relationship distance δ.
[0083] Processing: If the subgraph S belongs to a subgraph of the social network adjacency matrix G and satisfies: (1) Every node u in the subgraph S satisfies Mn δ (u, S) ≥ k, (2) subgraph S is a maximal connected subgraph, then subgraph S is the (k, δ)-core of the social network adjacency matrix G. The (k, δ)-core of the social network adjacency matrix G is represented by C k,δ (G) When δ = 1, (k, 1)-core is the k-core social network model.
[0084] Output: (k, δ)-core of the social network adjacency matrix G, i.e. C k,δ (G),
[0085] In this application, the (k, δ)-core subgraph with the maximum k value constraint is called the maximum (k, δ)-core social network of the social network adjacency matrix G, denoted as max-C k,δ (G). The greater the degree of user social relationship of a node, the greater the degree of association of the node with other nodes in the social network. Therefore, the node with the greatest degree of user social relationship is the key user of the social network. Because there may be more than one node with the greatest degree of user social relationship, the key user based on social relationship distance can be a set of nodes.
[0086] For example:
[0087] like Figure 3-1 As shown, when δ = 1, according to step S1, Mn 1 (u1, G) = 2, Mn 1 (u2, G) = Mn 1 (u3, G) = Mn 1 (u4, G) = Mn 1 (u5, G) = Mn 1 (u6, G) = Mn 1 (u7, G) = 3, Mn 1(u8, G) = 6. Because the Mn of all nodes in the social network neighbor matrix G 1 (ui, G) ≥ 2, i is 1 to 8, so the social network adjacency matrix G is C 2,1 (G), S = G, but does not satisfy Mn 1 (ui, G)≥3, so when δ=1, the subgraph S is the largest (2, 1)-core social network of the social network adjacency matrix G.
[0088] When δ=2, Mn 2 (u1, G) = 5, Mn 2 (u2, G) = Mn 2 (u3, G) = Mn 2 (u4, G) = Mn 2 (u5, G) = Mn 2 (u6, G) = Mn 2 (u7, G) = Mn 2 (u8, G) = 7. Because the Mn of all nodes in the social network neighbor matrix G 2 (ui, G) ≥ 5, i is 1 to 8, so the social network adjacency matrix G is C 5,2 (G).
[0089] like Figure 3-2 As shown in Figure 2, when u1 is removed from the social network adjacency matrix G, let S = G-{u1}, M 2 (u2, S) = {u3, u4, u5, u6, u7, u8}, M 2 (u3, S) = {u2, u4, u5, u6, u7, u8}, M 2 (u4, S) = {u2, u3, u5, u6, u7, u8}, M 2 (u5, S) = {u2, u3, u4, u6, u7, u8}, M 2 (u6, S) = {u2, u3, u4, u5, u7, u8}, M 2 (u7, S) = {u2, u3, u4, u5, u6, u8}, M 2 (u8, S) = {u2,u3,u4,u5,u6,u7}, so Mn 2 (u2, G) = Mn 2 (u3, G) = Mn 2 (u4, G) = Mn 2 (u5, G) = Mn 2 (u6, G) = Mn 2 (u7, G) = Mn 2 (u8, G) = 6, so the subgraph S is C 6,2 (G); but does not satisfy Mn2 (ui, S)≥7, so when δ=2, the subgraph S is the largest (6, 2)-core social network of the social network adjacency matrix G.
[0090] Similarly, when δ≥3, Mn 2 (u1, G) = Mn 2 (u2, G) = Mn 2 (u3, G) = Mn 2 (u4, G) = Mn 2 (u5, G) = Mn 2 (u6, G) = Mn 2 (u7, G) = Mn 2 (u8, G) = 7, so the social network adjacency matrix G is C 7,3 (G), S = G, but does not satisfy Mn 1 (ui, G)≥8, so when δ=3, S is the largest (7, 3)-core social network of G.
[0091] Step S202: The social relationship closeness set K of all nodes in the social network adjacency matrix G δ (u, G) is the (k, δ)-core of the social network adjacency matrix G, i.e., C k,δ Another form of (G) is to constrain the number of nodes k contained in the social relationship distance δ of the user, and the node u∈C k,δ (G) and K δ (u, G) = k.
[0092] Details are as follows:
[0093] Use K δ (u, G) represents the closeness of the user social relationship of node u, which is C k,δ Another form of expression of (G). For the node number constraint k contained in the social relationship distance δ of a user, node u∈C k,δ (G) and K δ (u, G) = k.
[0094] For example:
[0095] like Figure 3-1 As shown, assuming δ = 2, we can get M 2 (u1, G) = {u2, u3, u4, u5, u8}, so Mn 2 (u1, G)=5.
[0096] Similarly, Mn 2 (u2, G) = Mn 2(u3, G) = ... = Mn 2 (u8, G)=6.
[0097] like Figure 3-3 As shown, therefore C 5,2 (G) = G.
[0098] like Figure 3-4 As shown, C 6,2 (G) = G-{u1}, since u1∈C 5,2 (G) and So K 2 (u1, G) = 5. Similarly, K 2 (u2, G) = K 2 (u3, G) = ... = K 2 (u8, G)=6.
[0099] Through step S2, step S201 and step S202, it can be known that the user social relationship closeness K δ (u, G) can measure the closeness of each node on the social network and find the node set {u|max{K δ (u, G)|u∈V(G)}} can thus find the key users in the social network.
[0100] Step S3: Whenever a node u is deleted from the social network adjacency matrix G, the node set {M δ (v, G-{u})|v∈V(G-{u})} and the number of nodes {Mn δ (v, G-{u})|v∈V(G-{u})}.
[0101] Details are as follows:
[0102] When a node u is deleted from the social network adjacency matrix G, it is necessary to update the node set M of the remaining nodes in the social network adjacency matrix G within the social relationship distance δ δ (v, G-{u}) and the number of nodes Mn δ (v, G-{u}), v∈V(G-{u}).
[0103] Input: The deleted node u, the adjacency matrix of the subgraph G-{u}.
[0104] Processing: Step S3: The node deletion update operation specifically includes the following five steps:
[0105] Step S301: Node u and node set M δ (u, G) constitutes the induced subgraph G′ of the social network adjacency matrix G, and defines the set M to update the node set Mδ The set of social relations of all nodes in (u, G) within a distance of δ.
[0106] Step S302: Initialize the node set M δ The set M[h]={h} of all nodes h in (u, G); h represents the relationship nodes contained in the social relationship distance δ of node u.
[0107] Step S303: Calculate M[h]=M[h]∪M[w], where node w is the associated edge node of h.
[0108] Step S304: Execute step S303 for δ times and end;
[0109] Step S305: Node set Mn δ The reduced value of (v, G-{u}) is to satisfy G′∩M δ-d The number of nodes with (u, G) and δ(w, u) < δ-d, where d = δ G (u, v), v∈V(G-{u}). Then the node set Mn can be calculated δ (v, G-{u}) value.
[0110] Output: node set Mn δ (v, G-{u}), v∈V(G-{u}).
[0111] Step S4: Iterate steps S2 and S3 until all nodes in the social network adjacency matrix G are deleted, and finally output the maximum (k, δ)-core social network of the social network adjacency matrix G, i.e., max-C k,δ The node corresponding to (G) is the key node.
[0112] Embodiment 2:
[0113] Embodiment 2 is different from Embodiment 1 in that step S3 is optimized using bitmap technology, and the optimization algorithm S3′ for S3 is
[0114] The present invention discloses a method for discovering key nodes in a social network based on social relationship distance, comprising the following steps:
[0115] Step S1: Obtain the social network adjacency matrix G and the user social relationship distance δ of the social network graph, and use the breadth-first traversal algorithm to calculate the node set {M} of all nodes within the user social relationship distance δ from the social network adjacency matrix G. δ (u, G)|u∈V(G)} and the number of nodes {Mn δ (u, G)|u∈V(G)}, u is a node, and V(G) is the set of all nodes in the social network adjacency matrix G.
[0116] Step S2: By iteratively deleting the node with the smallest number of nodes within the user social relationship distance δ of node u in the social network adjacency matrix G, the social relationship closeness set K of all nodes in the social network adjacency matrix G is calculated. δ (u, G), u∈V(G).
[0117] Step S3: Whenever a node u is deleted from the social network adjacency matrix G, the node set {M δ (v, G-{u})|v∈V(G-{u})} and the number of nodes {Mn δ (v, G-{u})|v∈V(G-{u})}.
[0118] In step S3, whenever node u is deleted, the M of the affected nodes needs to be frequently recalculated. δ (v, G-{u}), considering that when the value of the social relationship distance δ is very large, the calculation cost is very high. Therefore, this application proposes an optimization method through bitmap update technology.
[0119] In step S3, when node u is deleted from the social network adjacency matrix, only M δ Node v in (u, G) may need to update Mn δ (v). For other nodes in the graph If node u leaves the social network adjacency matrix, Mn δ The value of (w, G-{u}) will not change. Considering the node w∈M δ (u, G), when the user social relationship distance δ>1, then Mn δ The value of (w, G-{u}) may decrease by more than 1. Find a network adjacency matrix composed of M δ (u, G) induced subgraph S, when node u is removed from the social network adjacency matrix, only the Mn of node v∈V(G-{u}) in subgraph S needs to be maintained δ (v, G-{u}), without having to recalculate M δ Each node in (u, G). For a large-scale social network, the size of the subgraph S is much smaller than the size of the original graph. So after deleting node u, the affected nodes will be reduced in subgraph S.
[0120] Assume M δ Each node in (u, G) is labeled For M δ Each node s in (u, G) i , you can define a bitmap representation s i The reachable node set of Mδ (u, G) is derived from the induced subgraph G′ of the social network adjacency matrix, if s m With s n If it is reachable within the social relationship distance δ, then s m The nth bit of the bitmap is equal to 1, otherwise the nth bit is equal to 0; similarly, s n The mth bit of the bitmap is equal to 1, otherwise the mth bit is equal to 0. According to formula (1), when calculating M δ In the process of (u, G), the dynamic programming algorithm is used to merge all the reachable node sets of the node in sequence. The bitmap is used to perform the bitwise OR operation, which is much faster than the traditional union operation and can also reduce the storage space overhead.
[0121]
[0122] In formula (1), deg(u,G) represents the degree of node u in the social network adjacency matrix, that is, the number of neighbors, and N(u,G) represents the set of neighbors of node u in the social network adjacency matrix.
[0123] This application uses bitmap technology to optimize step S3, and the optimization algorithm step S3′ of step S3 is as follows:
[0124] Input: The deleted node u, the adjacency matrix of the subgraph G-{u}.
[0125] deal with:
[0126] Step S3′ includes the following steps:
[0127] Step S301′: define an integer array A to represent the node u in the node set M δ The bitmap of each node on the induced subgraph G′ derived by (u, G) is initialized to 0.
[0128] Step S302′: number the nodes in the social network adjacency matrix G starting from 0, and calculate BITMAP(u) to represent the position of node u in the bitmap, see formula (2).
[0129] BITMAP(u):u→n (2)
[0130] Formula (2) is the mapping relationship definition of the BITMAP function, where u∈V(G) and n is a natural number.
[0131] Step S303′: Set the node set M δ The bitmap BITMAP(v) of the node v in (u, G) whose user social relationship distance is less than δ is set to 1, otherwise it is 0.
[0132] Step S304′: Calculate the reachable node set A of each node using a dynamic programming algorithm, and implement the process of merging two reachable sets through a bitwise OR operation of the bitmap.
[0133] Initial value conditions: i=1, j=2; calculation formula: A[i][map(v)]←A[i][map(v)]|A[j][map(w)], A[i][map(w)]←A[i][map(w)]|A[j][map(v)], e(v, w)∈E(G′); iterate δ times, exchanging the values of i and j in each iteration.
[0134] Step S305′: Use bitwise AND operation to determine the node w∈M δ-l Whether (u, G) and node v are reachable within the social relationship distance δ, if the condition (1<<map(w))&(A[j][map(v)]) is satisfied, then update M δ (v, G-{u})(v∈V(G-{u})), otherwise continue to look for node w∈M δ-l Whether (u, G) and node v are reachable within the social relationship distance δ.
[0135] Output: {M δ (v, G-{u})|v∈V(G-{u})}.
[0136] The technical solution of the present invention is described in detail below by using illustrated examples:
[0137] like Figure 4-1 As shown, first, the social network adjacency matrix G1 and the social relationship distance δ=2 are input.
[0138] Then, according to step S1 and step S2, M is obtained. 2 (v1, G1)={v2, v3, v4}, Mn 2 (v2, G1) = 3, Mn 2 (v2, G1) = 5, Mn 2 (v3, G1) = 7, Mn 2 (v4, G1) = 7; so temp = 3, K δ (v1, G1) = temp = 3, judge M 2 (v1, G1) = whether the nodes in {v2, v3, v4} satisfy Mn 2 (vi, G1)≤3, i takes conditions 2, 3 and 4. Since nodes v2, v3, and v7 do not meet the conditions, node v1 is deleted from G1 and the set of remaining nodes is updated {M 2 (vm)|vm∈V(G1-{v1})}.
[0139] In the next iteration, temp = 4; M δ (v2, G1-{v1})={v3, v4, v7, v8}, Mn δ (v3) = Mn δ (v4) = Mn δ (v7) = Mn δ (v8) = 4, because nodes v3, v4, v7, and v8 satisfy Mn 2 (vi, G1)≤3 (i is 3, 4, 7, 8), so {v3, v4, v7, v8} is deleted from the graph G1, and the remaining nodes in the graph are updated. Similarly, the calculation process of the remaining nodes in G1 is the same. Finally, when all nodes in G1 are removed, the user social relationship density of each node is obtained, and the node set with the maximum user social relationship density is returned as the key node.
[0140] The following is an update based on the example graph analysis algorithm {M δ (v, G1-{u})|v∈V(G1-{u})} process. Assuming the input δ=2, this application only analyzes the deleted nodes v1 and v2, and the remaining deleted nodes are not described in detail.
[0141] like Figure 4-2 As shown, when node v1 is deleted, we can get δ (v1, G1) = the subgraph G′ induced by {v2, v3, v4}.
[0142] As shown in Table 1, it is δ The update process of the reachable node set bitmap of each node in (v1, G1). In order to facilitate the operation of the bitmap. Use the formula BITMAP function to establish a mapping from nodes to natural numbers to achieve the renumbering of nodes in G′. G (v1, v3) = 2 and δ G (v1, v4) = 2, so the bitmaps of v3 and v4 are initialized to 000. Therefore, it can be obtained that the bitmap of v2 is 001. Because the edge set E(G′) of the social network adjacency matrix G′ = {<v2,v3> , <v2, v4>}, so in the iteration process, the v2 bitmap is bitwise ORed with the v3 and v4 bitmaps, so the bitmap of v3 is 001 and the bitmap of v4 is 001. Update M δ The number of friends of other nodes in (v1, G1) within the social relationship distance is used to determine Mn δ (v, G-{u}) whether to reduce by 1. Finally, we get Mn 2 (v2, G1-{v1}) = 4, Mn 2 (v3, G1-{v1}) = 6, Mn 2 (v4, G1-{v1})=6.
[0143] Table 1: M after deleting v1 δ Node bitmap update process table in (v1, G1)
[0144] <![CDATA[M δ (v1, G1)]]> v2 v3 v4 BITMAP value 0 1 2 Initialize the bitmap 001 000 000 After the iteration, the bitmap 001 001 001
[0145] like Figure 4-3 As shown, when v2 is deleted, similarly, we can get δ The subgraph G′1 induced by (v2, G1-{v1})={v3, v4, v7, v8}.
[0146] As shown in Table 2, because and Therefore, the bitmaps of v7 and v8 are initialized to 0000. For nodes with a social relationship distance less than 2, the bitmap of v3 is 0001 and the bitmap of v4 is 0010.<v3,v7> ,<v4,v8>}, the bitmap of v7 is bitwise ORed with the bitmap of v3, and the bitmap of v8 is bitwise ORed with the bitmap of v4, so the bitmap of v7 is 0001, and the bitmap of v8 is 0010. Finally, Mn 2 (v3, G1-{v1, v2})=4, Mn 2 (v4, G1-{v1, v2}) = 4, Mn 2 (v7, G1-{v1, v2}) = 9, Mn 2 (v8, G1-{v1, v2})=10.
[0147] Table 2: M after deleting v2 δ Table of node bitmap update process in (v2, G1-{v1})
[0148] <h2 style=";text-align:left;direction:ltr"><![CDATA[M <h2 style=";text-align:left;direction:ltr"> δ <h2 style=";text-align:left;direction:ltr"> (v2, G1-{v1})]]><h2 style=";text-align:left;direction:ltr"> v3 v4 v7 v8 BITMAP value 0 1 2 3 Initialize the bitmap 0001 0010 0000 0000 After the iteration, the bitmap 0001 0010 0001 0010
[0149] Step S4: Iterate steps S2 and S3 until all nodes in the social network adjacency matrix G are deleted, and finally output the maximum (k, δ)-core social network of the social network adjacency matrix G, i.e., max-C k,δ The node corresponding to (G) is the key node.
[0150] like Figure 3-4 As shown, when δ = 2, the maximum max-C is obtained. k,δ (G) is a (6, 2)-core, and the key nodes are {u2,u3,u4,u5,u6,u7,u8}.
[0151] like Figure 4-4 As shown, the maximum max-C k,δ(G) is a (5,2)-core, and the key nodes are {vi|5≤i≤15}.
[0152] like Figure 5 As shown, the social network key node discovery method based on social relationship distance proposed in this application is more effective than discovering key nodes on the k-core social network.
[0153] like Figure 6 and Figure 7 As shown, the optimization algorithm S3′ proposed in this application is more efficient than the baseline algorithm S3.
[0154] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for discovering key nodes in a social network based on social relationship distance, characterized by: The steps include: Step S1: Obtain the social network adjacency matrix G and the user social relationship distance δ of the social network graph, and use the breadth-first traversal algorithm to calculate the node set {M} of all nodes within the user social relationship distance δ from the social network adjacency matrix G. δ (u,G)|u∈V(G)} and the number of nodes {Mn δ (u,G)|u∈V(G)}, u is a node, V(G) is the set of all nodes in the social network adjacency matrix G; Step S2: By iteratively deleting the node with the smallest number of nodes within the user social relationship distance δ of node u in the social network adjacency matrix G, the social relationship closeness set K of all nodes in the social network adjacency matrix G is calculated. δ (u,G),u∈V(G); Step S3: Whenever a node u is deleted from the social network adjacency matrix G, the node set {M δ (v,G-{u})|v∈V(G-{u})} and the number of nodes {Mn δ (v,G-{u})|v∈V(G-{u})}; Step S4: Iterate steps S2 and S3 until all nodes in the social network adjacency matrix G are deleted, and finally output the maximum (k,δ)-core social network of the social network adjacency matrix G, i.e., max-C k,δ The node corresponding to (G) is the key node.
2. The method for discovering key nodes in a social network based on social relationship distance according to claim 1, characterized in that: In step S2, when the subgraph S belongs to a subgraph of the social network adjacency matrix G and satisfies: each node u in the subgraph S satisfies the node number Mn δ (u,S) ≥ node number constraint k, and subgraph S is a maximal connected subgraph, then subgraph S is the (k,δ)-core of the social network adjacency matrix G. The (k,δ)-core of the social network adjacency matrix G is represented by C k,δ (G), When δ=1, (k,1)-core is a k-core social network model; the (k,δ)-core subgraph with the maximum k value constraint is called the maximum (k,δ)-core social network of the social network adjacency matrix G, denoted as max-C k,δ (G); The closer the user social relationship of a node is, the greater the degree of association between the node and other nodes in the social network. The node with the closest user social relationship is the key user of the social network.
3. The method for discovering key nodes in a social network based on social relationship distance according to claim 2, characterized in that: In step S2, the social relationship closeness set K of all nodes in the social network adjacency matrix G is δ (u,G) is the (k,δ)-core of the social network adjacency matrix G, i.e. C k,δ Another form of (G) is to constrain the number of nodes k contained in the social relationship distance δ of the user, and the node u∈C k,δ (G) and K δ (u,G)=k.
4. The method for discovering key nodes in a social network based on social relationship distance according to claim 1, characterized in that: The step S3 specifically includes the following steps: Step S301: Node u and node set M δ (u, G) constitutes the induced subgraph G' of the social network adjacency matrix G, and defines the set M to update the node set M δ The social relationship set of all nodes in (u,G) within the distance δ; Step S302: Initialize the node set M δ The set of all nodes h in (u, G) M[h] = {h}; h represents the relationship nodes contained in the social relationship distance δ of node u; Step S303: Calculate M[h]=M[h]∪M[w], where node w is the associated edge node of h; Step S304: Execute step S303 for δ times and end; Step S305: Node set Mn δ The reduced value of (v,G-{u}) is to satisfy G'∩M δ-d The number of nodes (u,G) and δ(w,u)<δ-d, d=δ G (u,v), v∈V(G-{u}), then the node set Mn can be calculated δ (v,G-{u}) value.
5. The method for discovering key nodes in a social network based on social relationship distance according to claim 1, characterized in that: The step S3 specifically includes the following steps: Step S301′: define an integer array A to represent the node u in the node set M δ The bitmap of each node on the induced subgraph G' derived by (u,G), and initialize the bitmap of each node to 0; Step S302′: number the nodes in the social network adjacency matrix G starting from 0, and calculate BITMAP(u) to represent the position of node u in the bitmap; BITMAP(u):u→n (2) Formula (2) is the mapping relationship definition of the BITMAP function, u∈V(G), n is a natural number; Step S303′: Set the node set M δ The bitmap bit BITMAP(v) of the node v in (u,G) whose user social relationship distance is less than δ is set to 1, otherwise it is 0; Step S304′: Calculate the reachable node set A of each node using a dynamic programming algorithm, and implement the process of merging two reachable sets through a bitwise OR operation of the bitmap; Step S305′: Use bitwise AND operation to determine the node w∈M δ-l Whether (u, G) and node v are reachable within the social relationship distance δ, if the condition (1<<map(w))&(A[j][map(v)]) is satisfied, then update M δ (v,G-{u})(v∈V(G-{u})), otherwise continue to look for node w∈M δ-l Whether (u,G) and node v are reachable within the social relationship distance δ.
6. The method for discovering key nodes in a social network based on social relationship distance according to claim 5, characterized in that: In the step S304′, the initial value conditions are: i=1, j=2; the calculation formula is: A[i][map(v)]←A[i][map(v)]|A[j][map(w)], A[i][map(w)]←A[i][mao(w)]|A[j][map(v)], e(v,w)∈E(G'); iterate δ times, and exchange the values of i and j in each iteration.