Community discovery method and device based on balanced label propagation
By combining node similarity and degree centering in the community discovery algorithm and using a balanced label propagation method, the problem of community division relying on core detection and unused node similarity in the existing technology is solved, and a more accurate and efficient community division is achieved.
Patent Information
- Application Number
- CN202411482231.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-03-07
AI Technical Summary
Existing community discovery algorithms rely on accurate core detection technologies when dividing community, and fail to fully utilize the similarity between nodes, resulting in inaccurate and efficient community division.
A community discovery method based on balanced label propagation is adopted, combining the local similarity and degree centering of nodes, label updates and community divisions are performed through balanced diffusion.
It improves the accuracy and efficiency of community division, is suitable for large-scale social network data, and can divide communities in high-quality areas in large-scale networks.
Smart Images

Figure CN119577259A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of community discovery in social networks, and in particular, relates to a community discovery method and device based on balanced label propagation. Background Art
[0002] In recent years, with the rapid development of the Internet and technology, the scale and number of social networks have been expanding and growing, and the current network data information is displayed in a diversified way. Taking social networks as an example, communication platforms such as Instagram, Twitter, WeChat, Weibo, Zhihu, etc. have provided a lot of convenience to our lives. With the rapid development of the platform, the user scale has also been continuously expanding, which has also made social networks more and more complex and information more diversified.
[0003] Social networks reflect social relationships in the real world, and there are groups with the same interests in our real life, so social networks have the characteristics of community structure. Different social networks have different community structures. The community structure is a special subgraph, which is composed of some similar interconnected vertices, and ensures that the connection density between nodes within the same community is higher than the connection density between different communities, that is, a community is one with close connections within the group and sparse connections between groups. For example, on the Weibo social platform, a community represents a group that pays attention to the same celebrity; in the Zhihu network, a community represents a group that pays attention to the same hot topic; the process of analyzing the existence of these communities in social networks is called community discovery.
[0004] Community discovery in social networks can not only show the grouping situation in social networks, but also help people analyze the functions and meanings of the social networks, discover some hidden information and potential laws in social networks, and predict the changes and development of the networks to guide people to solve some real-life problems. As a technology, community discovery can be applied to predict fraud prediction, interest recommendation, etc., so community discovery has high application value and practical significance.
[0005] Many community discovery algorithms have been proposed to find potential communities in a network through community discovery. When updating labels, some methods of typical label propagation algorithms are based on the label propagation of important nodes, while others are based on identifying core nodes and expanding local communities from the inside to the outside. Since the initial community strongly depends on identifying core nodes, these methods heavily rely on accurate core detection techniques.
[0006] For example, Wang (Yue Y, Wang G, Hu J, et al. An improved label propagation algorithm based on community core node and label importance for community detection in sparse network [J]. Applied Intelligence, 2023: 1-17.) proposed an improved label propagation algorithm CCLI-LPA that combines community core nodes and label importance. The core nodes in the network are selected by fusing the first-order and second-order structures of the nodes. Then the label selection mechanism is defined by combining the importance of adjacent nodes and their labels. The above algorithms determine the influence of the label based on the degree of node importance, and adjust its update order and label update method accordingly, but these algorithms do not make full use of the similarity between nodes. Based on the method of improving the similarity of nodes in the network, Zheng Wenping (Zheng Wenping, Liu Meilin, Yang Gui. A community discovery algorithm based on node stability and neighborhood similarity [J]. Computer Science, 2022, 49 (09): 83-91.) et al. proposed a community discovery algorithm based on node stability and neighborhood similarity (NSNSA), which measures the stability of nodes by node label entropy and defines the neighborhood similarity of nodes to construct a network according to the label composition of the node neighborhood. Liu (Liu Y, Yu J, Liu Z, et al. A Community Detection Algorithm Fusing Node Similarity and Label Propagation [C] / / China Conference on Wireless Sensor Networks. Singapore: Springer Nature Singapore, 2022: 94-107.) proposed the FNSLP algorithm, which obtains node update labels by calculating the similarity between nodes and neighbors, thereby improving the accuracy of the algorithm. In addition, these methods only use topological structures to divide communities, which has certain limitations in accurately dividing high-quality communities, and do not solve the randomness of LPA. Summary of the invention
[0007] The purpose of the present invention is to provide a community discovery method and device based on balanced label propagation, which combines the local similarity of nodes and the degree centrality of nodes, gives full play to the advantages of balanced label diffusion, and thus obtains more accurate community division results.
[0008] The technical solution to achieve the purpose of the present invention is: a community discovery method based on balanced label propagation, comprising the following steps:
[0009] Step 1: Based on the data of the social network, a membership network is constructed by representing the connection relationship between nodes as a linked list structure in Python;
[0010] Step 2: For nodes whose degree value in the linked list structure is greater than 1, execute steps 3 to 7;
[0011] Step 3, calculate node importance for each node by using node similarity and degree centrality;
[0012] Step 4: Initialize node labels and node diffusion marks;
[0013] Step 5: Update the node labels according to the node importance, and the two adjacent nodes with the highest similarity will get the same label;
[0014] Step 6: Select nodes whose importance is greater than a threshold as initial core nodes;
[0015] Step 7: Based on the selected initial core nodes, label diffusion is performed in a balanced diffusion manner;
[0016] Step 8: For nodes with a degree value equal to 1, directly assign their neighbor labels to the corresponding nodes;
[0017] Step 9: Select labels based on the comprehensive influence among communities, so that each node can find the most appropriate label;
[0018] Step 10: Find the final community through a quick merging step.
[0019] A community discovery device based on balanced label propagation, the device is used to implement the community discovery method based on balanced label propagation, the device includes a member relationship network construction module, a judgment module, a node importance calculation module, an initialization module, a label update module, an initial core node selection module, a label diffusion module, a label allocation module, a label selection module and a final community determination module, wherein:
[0020] The membership network building module builds a membership network based on the data of the social network by representing the connection relationship between nodes as a linked list structure in Python;
[0021] The judgment module executes the node importance calculation module to the label diffusion module for the nodes whose degree value is greater than 1 in the link list structure;
[0022] Node importance calculation module, which calculates the node importance for each node by using node similarity and degree centrality;
[0023] Initialization module, initialization node labels, and node diffusion marks;
[0024] The label update module updates the node labels according to the node importance, so that the two adjacent nodes with the highest similarity get the same label;
[0025] The initial core node selection module selects nodes whose importance is greater than a threshold as initial core nodes;
[0026] The label diffusion module performs label diffusion in a balanced diffusion manner based on the selected initial core nodes;
[0027] The label assignment module directly assigns the neighbor labels of the nodes with degree value equal to 1 to the corresponding nodes;
[0028] The label selection module selects labels based on the comprehensive influence among communities, so that each node can find the most suitable label;
[0029] The final community determination module finds the final community through a fast merging step.
[0030] Compared with the prior art, the present invention has the following significant advantages:
[0031] (1) Integrate the balanced diffusion method based on node importance and similarity to better utilize the information in the network to accurately divide communities and improve the efficiency of community discovery;
[0032] (2) Taking full advantage of the balanced label diffusion, balanced diffusion and the most similar neighbors are used to solve the community discovery problem. This not only enables community discovery on large-scale networks, but also improves computational efficiency and enables high-quality community division.
[0033] (3) It is applicable to large-scale social network data and improves the accuracy and stability of community division in social networks.
[0034] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following is a detailed description in combination with the preferred embodiments and the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of the community discovery method based on balanced label propagation of the present invention.
[0036] Figure 2 A schematic diagram of a node adjacency list.
[0037] Figure 3 Schematic diagram of the propagation process of the most similar neighbors. DETAILED DESCRIPTION
[0038] It is easy to understand that according to the technical solution of the present invention, without changing the essential spirit of the present invention, a person skilled in the art can imagine various implementation methods of the present invention. Therefore, the following specific implementation methods and drawings are only exemplary descriptions of the technical solution of the present invention, and should not be regarded as the whole of the present invention or as a limitation or restriction of the technical solution of the present invention.
[0039] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0040] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0041] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0042] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0043] The present invention provides a community discovery method based on balanced label propagation, comprising the following steps:
[0044] Step 1: Based on the data of the social network, a membership network is constructed by representing the connection relationship between nodes as a linked list structure in Python;
[0045] Step 2: For nodes whose degree value in the linked list structure is greater than 1, execute steps 3 to 7;
[0046] Step 3, calculate node importance for each node by using node similarity and degree centrality;
[0047] Step 4: Initialize node labels and node diffusion marks;
[0048] Step 5: Update the node labels according to the node importance, and the two adjacent nodes with the highest similarity will get the same label;
[0049] Step 6: Select nodes whose importance is greater than a threshold as initial core nodes;
[0050] Step 7: Based on the selected initial core nodes, label diffusion is performed in a balanced diffusion manner;
[0051] Step 8: For nodes with a degree value equal to 1, directly assign their neighbor labels to the corresponding nodes;
[0052] Step 9: Select labels based on the comprehensive influence among communities, so that each node can find the most appropriate label;
[0053] Step 10: Find the final community through a quick merging step.
[0054] As a specific example, in step 1, a member relationship network is constructed based on the data of the social network, as follows:
[0055] According to the data of social network, we construct a graph model G(V,E), where V = {v1,v2,…,v n} represents the set of nodes, E = {e1, e2, …, e m} represents the edge between nodes, n and m represent the number of nodes and edges respectively;
[0056] Each edge in E corresponds to a pair of nodes in V. In a social network, v1 and v2 represent two nodes in the network, and e1 represents the edge connecting v1 and v2, which also means that v1 and v2 have a connection relationship of e1.
[0057] The connection relationship between nodes is represented as a linked list structure in Python, that is, the key is the node, the list represents all the neighbors of the node, and the length of each key is equal to the degree value of the corresponding node.
[0058] As a specific example, the node similarity in step 3 is specifically:
[0059] Use a custom local similarity metric Similarity(i,j) to measure the similarity between nodes:
[0060]
[0061] Among them, supplement N i represents the neighbor node set of node i, N j represents the set of neighbor nodes of node j;
[0062] For nodes i and j, if N i The number of node sets is greater than or equal to N j Number of node sets, N a N j 、N b N i ; if N i The number of nodes in a set is less than N j Number of node sets, N a Ni 、N b N j ;
[0063] The degree centrality is specifically:
[0064] Degree centrality is the ratio of the number of neighbors of a node in the community to other nodes. The greater the number of neighbors, the greater the centrality value, and the more important the node is considered to be.
[0065] Degree Centrality DC i Select the central node with the largest number of neighbors, and the degree centrality calculation formula is as follows:
[0066]
[0067] Among them, supplement d i Represents the degree value of node i; for a network containing n nodes, the maximum node degree value is n-1.
[0068] As a specific example, step 3 calculates the node importance for each node by using node similarity and degree centrality, as follows:
[0069] Define node importance NI(i):
[0070]
[0071] Arrange the obtained node importance values in descending order.
[0072] As a specific example, in step 4, the node label and the node diffusion mark are initialized as follows:
[0073] Initialize the label of each node to ensure that the node has not been updated. Mark all node labels as 0. When updating, the node labels start counting from 1.
[0074] The diffusion flag diffusion_flag of the node is initialized to 0. diffusion_flag=0 indicates that the label diffusion step has not been executed, and diffusion_flag=1 indicates that the label diffusion step has been executed.
[0075] As a specific example, in step 5, the node label is updated according to the node importance, as follows:
[0076] Based on node similarity, select the current node i and its most similar neighbor. If the similarity between the current node i and its most similar neighbor node is 0, then select the neighbor label with the highest degree centrality and assign it to the same label as the current node i.
[0077] If the node importance of the selected neighbor is greater than the importance of the current node i, then the current node i and the selected neighbor node receive the same node label, otherwise only the current node i receives a new node label.
[0078] As a specific example, in step 6, nodes whose importance nodes are greater than a threshold are selected as initial core nodes, as follows:
[0079] Select nodes with NI(i)>θ as initial core nodes, θ represents the threshold value of node importance greater than the average node importance, and the nodes greater than the threshold θ are selected as initial core nodes;
[0080] In step 7, label diffusion is performed in a balanced diffusion manner, and the following operations are performed on the nodes with diffusion marks of 0:
[0081] ① Arrange the nodes in descending order from top to bottom. The top of the list indicates the most important node, and the bottom of the list indicates the least important node.
[0082] ② Select a new node from the top of the list and a node from the bottom. Each selected node is changed to the label of the node with the highest node importance according to its neighbor labels. The labels represent the community to which the nodes belong. The same label number indicates the same community.
[0083] ③After updating these two nodes, return to step ② and select two more nodes from the list to update their labels until there are no more nodes left in the list;
[0084] For the nodes participating in steps ② and ③, the diffusion flag of the node is changed to the diffusion flag diffusion_flag=1.
[0085] As a specific example, in step 9, label selection is performed based on the comprehensive influence among communities, as follows:
[0086] The node first updates its own label to the community label with the highest update frequency among its neighbors. If multiple communities share the same frequency, the effectiveness of each community is calculated by the following formula, and a community with the highest comprehensive influence is assigned. The formula is as follows:
[0087]
[0088] Where N i is the set of neighbors of node i, with community label C m ; j is one of the neighbors selected by node i, C m It is one of the communities with the highest frequency.
[0089] As a specific example, in step 10, the final community is found through the fast merging step, as follows:
[0090] First, the largest community is excluded, the average size of the remaining communities is calculated, and then the communities smaller than the average are considered small communities;
[0091] The representative node is calculated for each small community. The calculation method of the representative node of the small community is as follows:
[0092] RE i =d i +NI(i)
[0093] Among them, RE i represents the representative value of node i, d i represents the degree value of the node, NI(i) represents the importance of the node;
[0094] Then, select a node with a different label from the selected representative node i and RE i The neighbor node j with the highest score and higher importance than the selected representative node assigns the label of the neighbor node j to the selected representative node i, thereby merging the two communities immediately; if there is no such neighbor node j, the two communities are not merged;
[0095] Nodes with the same label are divided into a community to form the final community.
[0096] The present invention also provides a community discovery device based on balanced label propagation, which is used to implement the community discovery method based on balanced label propagation. The device includes a member relationship network construction module, a judgment module, a node importance calculation module, an initialization module, a label update module, an initial core node selection module, a label diffusion module, a label allocation module, a label selection module and a final community determination module, wherein:
[0097] The membership network building module builds a membership network based on the data of the social network by representing the connection relationship between nodes as a linked list structure in Python;
[0098] The judgment module executes the node importance calculation module to the label diffusion module for the nodes whose degree value is greater than 1 in the link list structure;
[0099] Node importance calculation module, which calculates the node importance for each node by using node similarity and degree centrality;
[0100] Initialization module, initialization node labels, and node diffusion marks;
[0101] The label update module updates the node labels according to the node importance, so that the two adjacent nodes with the highest similarity get the same label;
[0102] The initial core node selection module selects nodes whose importance is greater than a threshold as initial core nodes;
[0103] The label diffusion module performs label diffusion in a balanced diffusion manner based on the selected initial core nodes;
[0104] The label assignment module directly assigns the neighbor labels of nodes with a degree value equal to 1 to the corresponding nodes;
[0105] The label selection module selects labels based on the comprehensive influence among communities, so that each node can find the most suitable label;
[0106] The final community determination module finds the final community through a fast merging step.
[0107] The principle of the present invention is explained below in conjunction with embodiments, and other aspects, features and advantages of the present invention will become apparent from the detailed description.
[0108] Example
[0109] like Figure 1 to Figure 3 As shown, this embodiment provides a community discovery method based on balanced label propagation of node importance and similarity, including the following steps:
[0110] Step 1: Based on the data given by the social network, model it into the required graph G(V,E), where V = {v1,v2,…,vn} represents the set of nodes, E = {e1,e2,…,en} represents the edges between nodes, and n and m represent the number of nodes and edges respectively. Each edge in E should have a pair of nodes in V. The relationship between them is represented in the form of an adjacency list in Python as input, that is, the key can be regarded as a node, and the list represents all the neighbors of the node and the node degree value, such as Figure 2 shown.
[0111] Step 2: Perform the operations from step 3 to step 8 only on nodes whose degree is greater than 1, and do not perform the operations on others.
[0112] Step 3: Use the new local similarity metric Similarity(i,j) you define to measure the similarity between nodes. This is explained in detail with an example. Figure 3 , the similarity is:
[0113]
[0114] For better understanding, Figure 3 shows two consecutive operations of selecting the labels of the most similar neighbors and then updating the node labels. The similarity value between two nodes is written on the edge. Nodes with degree 1 are labeled last. Figure 3 It can be clearly seen in (a) that the most similar neighbor of nodes 2, 3, and 4 is node 1, and their labels are updated to the label of node 1. At initialization, node 5 chooses the label of node 4, and node 6 chooses the label of node 3, and they are represented in different colors. Figure 3 In (b), after updating the label assignment order, the nodes are assigned real labels. Finally, node 12 receives the label of node 6, and node 11 receives the label of node 10.
[0115] Step 4: Degree centrality is the ratio of the number of neighbors of a node in the community to other nodes. The greater the number of neighbors, the greater the centrality value, and the node is considered to be more important. Degree centrality DCi selects the central node with the largest number of neighbors, so degree centrality is used for calculation. The degree value di of the node can be directly calculated by Figure 2 The calculation method is:
[0116]
[0117] Step 5: In step 3 and step 4, local similarity and node degree centrality are obtained. In order to obtain the community more efficiently and accurately, the importance of nodes is defined and the obtained importance values are sorted in descending order to prepare for the update order of node labels in the process of label propagation. Its definition method is:
[0118]
[0119] Step 6: At this time, you need to initialize the label of each node to ensure that the node has not been updated. Mark all node labels as "0". When updating, the node label starts counting from 1, and the node diffusion mark is initialized to 0. 0 means that the diffusion step has not been executed, and 1 means that the label diffusion step has been executed.
[0120] Step 7: Only nodes with a degree greater than 1 are required to be operated here. Repeat this step. First, select the current node i and its most similar neighbor (judged by similarity). If the similarity of the two nodes is 0, then select the neighbor with the highest degree centrality and assign them the same label. If the node importance of the most similar neighbor is greater than the importance of the current node, then the current node and its neighbor node receive the same label. Otherwise, only the current node receives a new node label.
[0121] Step 8: Perform the label diffusion step. There is a requirement that the nodes need to be screened and a part of the most important nodes are found as coarse core nodes to form the initial structure of the community. The nodes with NI(i)>θ are selected as the initial core nodes. θ is the part of the nodes whose importance is greater than the average importance, which is used as the threshold θ. The balanced selection of nodes adopts a very efficient method, but it should be noted that only the nodes with the diffusion mark "0" are operated. First, sort the node importance in descending order, select a new node from the top of the list, and select a node from the bottom. Each selected node is changed to the most important label according to its neighbor label. After updating these two, select them from the list again, and so on, until there is nothing left in the list. For the nodes participating in this step, change their diffusion flag to the diffused flag diffusion_flag=1.
[0122] Step 9: Perform operations on all nodes with degree values equal to 1 and directly assign neighbor labels to them.
[0123] Step 10: The previous steps may result in incorrect node label assignment. In order to obtain a more accurate community, calculate the comprehensive influence of all nodes and select the community with the highest community influence. The method is as follows:
[0124]
[0125] Step 11: Perform the fast merging step. The fast merging condition will integrate the weak communities with the surrounding suitable communities. In fact, these small communities are part of other communities, but the algorithm mistakenly isolates them. For this reason, an efficient and fast method is used to merge them. How this step works: first exclude the largest community and calculate the average size of the remaining communities. Then the communities smaller than the average are considered small communities. The merging step is to compare the representative nodes of the two communities, so for each small community, the calculation method is as follows:
[0126] RE i =d i +NI(i)
[0127] Table 1 is an evaluation based on the NMI value. It can be clearly seen that the performance of the LPABIS method and other methods on 6 real data sets is evaluated based on the NMI metric. The LPABIS algorithm performs better overall than others. On the Karate data set and the Dolphin data set, the NMI result of LPABIS is 1 for the community, indicating that the algorithm can divide the community division results that are the same as the actual community distribution of the real network, and the community division is clearer. LPABIS also obtained relatively satisfactory results on the Polbooks and Amazon data. On the Amazon data set, NMI = 0.97, which is the highest quality among massive data sets. Although the NMI result on the Football data set DBLP data set did not reach the highest value, it is also close to the top compared to several other algorithms, indicating that the algorithm can effectively detect community structure in the network. The experimental data of the NMI value of the real network under the comparison of the algorithms are shown in Table 1:
[0128] Table 1 Experimental results of NMI of various algorithms in real network
[0129] Datasets CNM LPA CDME Louvain LSMD LPABIS Karate 0.69 0.21 1 0.71 1 1 Dolphins 0.57 0.53 0.70 0.435 1 1 Polbooks 0.53 0.44 0.58 0.53 0.59 0.62 Football 0.72 0.86 0.92 0.85 0.93 0.924 DBLP 0.50 0.71 0.75 0.53 0.70 0.747 Amazon 0.80 0.93 0.93 0.83 0.19 0.97
[0130] Table 2 is an evaluation based on the degree of modularity, where Q and C represent the modularity and number of communities of the algorithm, respectively. Community detection groups similar nodes into the same community in order to form a node cluster. It can be clearly seen that the LPABIS algorithm shows the same modularity as other algorithms on the real network. On the Football dataset and Amazon dataset network, the LPABIS algorithm performs well and can obtain accurate result division. Similarly, it also obtains relatively good results on the Karate dataset, Polbooks dataset, and DBLP dataset. Although the results on the Dolphins dataset are not very high, the difference is still small compared to others. Therefore, the LPABIS algorithm can obtain a good modularity value Q in the real network, and the network division results are clear, which is basically higher than other algorithms. The final experimental results of the modularity and number of communities of the real network are shown in Table 2:
[0131] Table 2 Experimental results of modularity and number of communities of various algorithms in real networks
[0132]
[0133] The above is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of rights of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and changes can be made without departing from the principle of the present invention, and these improvements and changes are also regarded as the protection scope of the present invention.
Claims
1. A community discovery method based on balanced label propagation, characterized in that: The following steps are involved: Step 1: Based on the data of the social network, a membership network is constructed by representing the connection relationship between nodes as a linked list structure in Python; Step 2: For nodes whose degree value in the linked list structure is greater than 1, execute steps 3 to 7; Step 3, calculate node importance for each node by using node similarity and degree centrality; Step 4: Initialize node labels and node diffusion marks; Step 5: Update the node labels according to the node importance, and the two adjacent nodes with the highest similarity will get the same label; Step 6: Select nodes whose importance is greater than a threshold as initial core nodes; Step 7: Based on the selected initial core nodes, label diffusion is performed in a balanced diffusion manner; Step 8: For nodes with a degree value equal to 1, directly assign their neighbor labels to the corresponding nodes; Step 9: Select labels based on the comprehensive influence among communities, so that each node can find the most appropriate label; Step 10: Find the final community through a quick merging step.
2. The community discovery method based on balanced label propagation according to claim 1, characterized in that: In step 1, a member relationship network is constructed based on the data of the social network, as follows: According to the data of social network, we construct a graph model G(V,E), where V = {v1,v2,…,v n } represents the set of nodes, E = {e1, e2, …, e m } represents the edge between nodes, n and m represent the number of nodes and edges respectively; Each edge in E corresponds to a pair of nodes in V. In a social network, v1 and v2 represent two nodes in the network, and e1 represents the edge connecting v1 and v2, which also means that v1 and v2 have a connection relationship of e1. The connection relationship between nodes is represented as a linked list structure in Python, that is, the key is the node, the list represents all the neighbors of the node, and the length of each key is equal to the degree value of the corresponding node.
3. The community discovery method based on balanced label propagation according to claim 2, characterized in that: The node similarity described in step 3 is specifically: Use a custom local similarity metric Similarity(i,j) to measure the similarity between nodes: Among them, supplement N i represents the neighbor node set of node i, N j represents the set of neighbor nodes of node j; For nodes i and j, if N i The number of node sets is greater than or equal to N j Number of node sets, N a N j 、N b N i ; if N i The number of nodes in a set is less than N j Number of node sets, N a N i 、N b N j ; The degree centrality is specifically: Degree centrality is the ratio of the number of neighbors of a node in the community to other nodes. The greater the number of neighbors, the greater the centrality value, and the more important the node is considered to be. Degree Centrality DC i Select the central node with the largest number of neighbors, and the degree centrality calculation formula is as follows: Among them, supplement d i Represents the degree value of node i; for a network containing n nodes, the maximum node degree value is n-1.
4. The community discovery method based on balanced label propagation according to claim 3, characterized in that: Step 3 calculates the node importance for each node by using node similarity and degree centrality as follows: Define node importance NI(i): Arrange the obtained node importance values in descending order.
5. The community discovery method based on balanced label propagation according to claim 4, characterized in that: In step 4, initialize the node label and the node diffusion mark as follows: Initialize the label of each node to ensure that the node has not been updated. Mark all node labels as 0. When updating, the node labels start counting from 1. The diffusion flag diffusion_flag of the node is initialized to 0. diffusion_flag=0 indicates that the label diffusion step has not been executed, and diffusion_flag=1 indicates that the label diffusion step has been executed.
6. The community discovery method based on balanced label propagation according to claim 5, characterized in that: In step 5, the node labels are updated according to the node importance, as follows: Based on node similarity, select the current node i and its most similar neighbor. If the similarity between the current node i and its most similar neighbor node is 0, then select the neighbor label with the highest degree centrality and assign it to the same label as the current node i. If the node importance of the selected neighbor is greater than the importance of the current node i, then the current node i and the selected neighbor node receive the same node label, otherwise only the current node i receives a new node label.
7. The community discovery method based on balanced label propagation according to claim 6, characterized in that: In step 6, nodes whose importance is greater than the threshold are selected as initial core nodes, as follows: Select nodes with NI(i)>θ as initial core nodes, θ represents the threshold value of node importance greater than the average node importance, and the nodes greater than the threshold θ are selected as initial core nodes; In step 7, label diffusion is performed in a balanced diffusion manner, and the following operations are performed on the nodes with diffusion marks of 0: ① Arrange the nodes in descending order from top to bottom. The top of the list indicates the most important node, and the bottom of the list indicates the least important node. ② Select a new node from the top of the list and a node from the bottom. Each selected node is changed to the label of the node with the highest node importance according to its neighbor labels. The label represents the community to which the node belongs, and the same label number indicates the same community; ③After updating these two nodes, return to step ② and select two more nodes from the list to update their labels until there are no more nodes left in the list; For the nodes participating in steps ② and ③, the diffusion flag of the node is changed to the diffusion flag diffusion_flag=1.
8. The community discovery method based on balanced label propagation according to claim 7, characterized in that: In step 9, label selection is performed based on the comprehensive influence among communities, as follows: The node first updates its own label to the community label with the highest update frequency among its neighbors. If multiple communities share the same frequency, the effectiveness of each community is calculated by the following formula, and a community with the highest comprehensive influence is assigned. The formula is as follows: Where N i is the set of neighbors of node i, with community label C m ; j is one of the neighbors selected by node i, C m It is one of the communities with the highest frequency.
9. The community discovery method based on balanced label propagation according to claim 8, characterized in that: In step 10, the final community is found through the fast merging step, as follows: First, the largest community is excluded, the average size of the remaining communities is calculated, and then the communities smaller than the average are considered small communities; The representative node is calculated for each small community. The calculation method of the representative node of the small community is as follows: RE i =d i +NI(i) Among them, RE i represents the representative value of node i, d i represents the degree value of the node, NI(i) represents the importance of the node; Then, select a node with a different label from the selected representative node i and RE i The neighbor node j with the highest score and higher importance than the selected representative node assigns the label of the neighbor node j to the selected representative node i, thereby merging the two communities immediately; if there is no such neighbor node j, the two communities are not merged; Nodes with the same label are divided into a community to form the final community.
10. A community discovery device based on balanced label propagation, characterized in that: The device is used to implement the community discovery method based on balanced label propagation according to any one of claims 1 to 9, and the device includes a member relationship network construction module, a judgment module, a node importance calculation module, an initialization module, a label update module, an initial core node selection module, a label diffusion module, a label allocation module, a label selection module and a final community determination module, wherein: The membership network building module builds a membership network based on the data of the social network by representing the connection relationship between nodes as a linked list structure in Python; The judgment module executes the node importance calculation module to the label diffusion module for the nodes whose degree value is greater than 1 in the link list structure; Node importance calculation module, which calculates the node importance for each node by using node similarity and degree centrality; Initialization module, initialization node labels, and node diffusion marks; The label update module updates the node labels according to the node importance, so that the two adjacent nodes with the highest similarity get the same label; The initial core node selection module selects nodes whose importance is greater than a threshold as initial core nodes; The label diffusion module performs label diffusion in a balanced diffusion manner based on the selected initial core nodes; The label assignment module directly assigns the neighbor labels of the nodes with degree value equal to 1 to the corresponding nodes; The label selection module selects labels based on the comprehensive influence among communities, so that each node can find the most suitable label; The final community determination module finds the final community through a fast merging step.