Community discovery method, device, equipment and medium based on swarm intelligence strategy
Through a community discovery method based on group intelligence strategy, using technologies such as population initialization and mountain climbing search, the accuracy and complexity of community division in social networks are solved, and efficient and accurate community division is achieved.
Patent Information
- Application Number
- CN202411810705.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-01
Smart Images

Figure CN119740120A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network communities, and in particular to a community discovery method, device, equipment and medium based on a swarm intelligence strategy. Background Art
[0002] Community discovery refers to the process of dividing a set into several subsets based on a certain connection relationship between elements in a set. At present, the widely accepted descriptive definition of community is several subsets of a complex network node set, where the connections between nodes within each subset are relatively tight, while the connections between nodes in different subsets are relatively sparse. Studying community discovery technology in social networks helps to reveal the numerous independent and related community unit structures in social networks, and understand the structural characteristics, functional characteristics, operating laws and evolution processes of social networks. For example, communities in social networks can be used to represent groups of people with common interests or close relationships, and by analyzing and judging these community structure characteristics, the interaction patterns and behaviors between people can be revealed.
[0003] For social networks, the community structure discovery problem can also be regarded as an optimization problem, that is, to discover closely connected groups in the network by optimizing the objective function. Since optimization problems are often NP-hard problems, the solutions obtained by traditional methods are generally local optimal solutions, which cannot reflect the global characteristics of the problem. Optimization methods based on biological evolution and swarm intelligence can often obtain high-quality global optimal solutions due to their good global and local search capabilities. However, the above methods also have the following shortcomings: the calculation process is complicated; more initialization parameters are required, which is not conducive to users to properly set the algorithm parameters; it is difficult to achieve accurate community division effects. Summary of the invention
[0004] The purpose of the embodiments of the present application is to propose a community discovery method, device, equipment and medium based on a swarm intelligence strategy, so as to achieve the improvement of community division effect without the need for complex parameter calculation.
[0005] In order to solve the above technical problems, the embodiment of the present application provides a community discovery method based on a swarm intelligence strategy, including:
[0006] Acquiring initial node data, and performing population initialization processing based on the initial node data to obtain multiple initial sub-populations;
[0007] Performing a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population;
[0008] Performing a hill climbing search on the initial subpopulation and the mutated subpopulation according to a fitness function to update the subpopulation to obtain a plurality of updated subpopulations;
[0009] Determine a current target population according to the fitness function value and the updated subpopulation, and determine a target optimal individual from the current target population;
[0010] If the current number of iterations does not reach the preset maximum number of population iterations, the individuals in the current subpopulation are mutated again to obtain the target optimal individual, until the current number of iterations reaches the preset maximum number of population iterations, and the target optimal individual is converted into the corresponding network community division result.
[0011] In order to solve the above technical problems, the embodiment of the present application provides a community discovery device based on a swarm intelligence strategy, including:
[0012] An initialization unit, used to obtain initial node data, and perform population initialization processing based on the initial node data to obtain multiple initial sub-populations;
[0013] A mutation unit, used for performing a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population;
[0014] An updating unit, configured to perform a hill climbing search on the initial subpopulation and the mutated subpopulation according to a fitness function to update the subpopulation and obtain a plurality of updated subpopulations;
[0015] An individual confirmation unit, which determines a current target population according to the fitness function value and the updated sub-population, and determines a target optimal individual from the current target population;
[0016] The iteration ending unit is used to mutate the individuals in the current subpopulation again to obtain the target optimal individual if the current iteration number does not reach the preset maximum population iteration number, until the current iteration number reaches the preset maximum population iteration number, and convert the target optimal individual into the corresponding network community division result.
[0017] In order to solve the above technical problems, a technical solution adopted by the present invention is: to provide a computer device, including one or more processors; a memory for storing one or more programs, so that the one or more processors can implement any one of the community discovery methods based on swarm intelligence strategies described above.
[0018] In order to solve the above technical problems, a technical solution adopted by the present invention is: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements any one of the community discovery methods based on swarm intelligence strategies described above.
[0019] The embodiment of the present invention provides a community discovery method, device, equipment and medium based on a swarm intelligence strategy. The method includes: obtaining initial node data, and performing population initialization processing based on the initial node data to obtain multiple initial sub-populations; performing mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population; performing hill climbing search on the initial sub-population and the mutated sub-population according to the fitness function to update the sub-population to obtain multiple updated sub-populations; determining the current target group according to the fitness function value and the updated sub-population, and determining the target optimal individual from the current target group; if the current number of iterations does not reach the preset maximum number of population iterations, re-mutating the individuals in the current sub-population to obtain the target optimal individual, until the current number of iterations reaches the preset maximum number of population iterations, and converting the target optimal individual into the corresponding network community division result. The embodiment of the present invention performs mutation operations and local hill climbing search operations on individuals in a population to identify the optimal individual from the updated sub-population, and converts the target optimal individual into a corresponding network community division result. It does not require excessive manual intervention in parameter setting issues, and does not require complex parameter calculations. At the same time, mutation operations and local hill climbing search operations are beneficial to improving the community division effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 It is a flowchart of the implementation process of the community discovery method based on the swarm intelligence strategy provided in the embodiment of the present application;
[0022] Figure 2 It is a flowchart for implementing the first sub-process in the community discovery method based on the swarm intelligence strategy provided in the embodiment of the present application;
[0023] Figure 3 It is a flowchart for implementing the second sub-process in the community discovery method based on the swarm intelligence strategy provided in the embodiment of the present application;
[0024] Figure 4 It is a flowchart for implementing the third sub-process in the community discovery method based on the swarm intelligence strategy provided in the embodiment of the present application;
[0025] Figure 5 It is a flowchart for implementing the fourth sub-process in the community discovery method based on the swarm intelligence strategy provided in the embodiment of the present application;
[0026] Figure 6 is a flowchart for implementing the fifth sub-process in the community discovery method based on swarm intelligence strategy provided in an embodiment of the present application;
[0027] Figure 7 It is a flowchart for implementing the sixth sub-process in the community discovery method based on the swarm intelligence strategy provided in the embodiment of the present application;
[0028] Figure 8 Schematic diagram of a community discovery device based on a swarm intelligence strategy provided in an embodiment of the present application;
[0029] Fig. 9 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0031] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0033] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0034] It should be noted that the community discovery method based on swarm intelligence strategy provided in the embodiment of the present application is generally executed by a computer device, and accordingly, the community discovery device based on swarm intelligence strategy is generally configured in a computer device.
[0035] The community discovery method based on group intelligence strategy provided in the embodiment of the present application is mainly aimed at manually defining individuals or groups in social networks for community discovery. The basis for manual demarcation is often related to sensitive topics, risk factors, etc. In a specific embodiment, after confirming a risk account, how to find other accounts related to the risk account (community discovery) is discussed.
[0036] See also Figure 1 , Figure 1 A specific implementation of a community discovery method based on a swarm intelligence strategy is shown.
[0037] It should be noted that if there are substantially the same results, the method of the present invention is not limited to Figure 1 The process sequence shown is limited to the following steps:
[0038] S1: Acquire initial node data, and perform population initialization processing based on the initial node data to obtain multiple initial sub-populations.
[0039] Specifically, the initial node data is obtained, wherein the initial node data includes node ID, inter-node comments, forwarding and attention data, etc. Then, the population is initialized according to the initial node data to obtain multiple initial sub-populations.
[0040] See also Figure 2 , Figure 2 A specific implementation of step S1 is shown, which is described in detail as follows:
[0041] S11: Acquire the initial node data and initialize population parameters, wherein the population parameters include the preset maximum number of population iterations, the population size of the subpopulation, and the number of populations.
[0042] S12: Initializing a population according to the initial node data and the population parameters to place the initial node data in different communities and generate a plurality of initial sub-populations.
[0043] In the embodiment of the present application, initial population parameters are required, and the population parameters include the preset maximum population iteration number, the population size of the sub-population, and the number of populations. Then, the population is initialized according to the initial node data and the population parameters to place the initial node data in different communities and generate multiple initial sub-populations.
[0044] In a specific embodiment, for a network G = (V, E), V is a node set, E is an edge set, the number of nodes is n, and the number of edges is m. An individual can be represented as follows:
[0045]
[0046] In the above formula, individual j represents the jth individual in the subpopulation, Indicates that node i belongs to the community if Then the 4th node currently belongs to the 3rd community. Therefore, nodes with the same community ID are considered to be in the same community. When the subpopulation is initialized, each node is placed in a different community, such as {1,2,…,n}. Therefore, at the beginning, there are n communities in the network.
[0047] S2: Perform a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population.
[0048] Specifically, a mutation operation is performed on each individual in all initial sub-populations, so that each individual has the opportunity to update in a better target direction; when all individuals in each initial sub-population have been mutated, a mutated sub-population corresponding to the initial sub-population is obtained.
[0049] See also Figure 3 , Figure 3 A specific implementation of step S2 is shown, which is described in detail as follows:
[0050] S21: Each individual in the current initial sub-population randomly selects a node as the target node.
[0051] S22: Randomly select a community ID from the neighbor node set corresponding to the target node to obtain a target community ID.
[0052] S23: assigning the community ID of the target node to the target community ID, so as to perform a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population.
[0053] Specifically, for each individual in the current initial sub-population, a node is randomly selected as the target node; then a community ID is randomly selected from the neighbor node set corresponding to the target node to obtain the target community ID, and the community ID of the target node is assigned as the target community ID; after the assignment, another community ID is re-selected and re-assigned, and the process is repeated K times. The number of repetitions can be set independently. In the embodiment of the present application, by mutating the individuals in the initial sub-population, the structural information of the network is utilized, which is conducive to enhancing the global search capability of the algorithm and avoiding the increase in the amount of calculation caused by random assignment.
[0054] S3: Performing a hill climbing search on the initial sub-population and the mutated sub-population according to the fitness function to update the sub-population and obtain a plurality of updated sub-populations.
[0055] Specifically, after all individuals of the initial sub-population are mutated, hill climbing search is performed on the mutated individuals and the original individuals according to the fitness function, so that the initial sub-population and the mutated sub-population are updated to obtain multiple updated sub-populations.
[0056] In the community discovery method based on objective function optimization, the choice of objective function is very important, which directly affects the final result of community division. In the embodiment of the present application, the module density function is used as the fitness function. For an undirected graph, V is the set of nodes in the network, the number is n, E is the set of edges in the network, the number is m, and the adjacency matrix of the graph G is A. V1 and V2 are two non-overlapping subsets of V, in, At the same time, define a community partition of the network G: G1 = (V1, E1), G2 = (V2, E2), ..., G m =(V m ,E m ), where V i and E i are the i-th G of graph G i For the set of nodes and edges in a community, i=1,2,...,m, the module density D function is defined as follows:
[0057]
[0058] Among them, hill climbing search is an optimization technique based on local search. By comparing the objective function value of the current node with the objective function value of its neighboring nodes, it is found whether there is a neighboring node that is better than the current node. The embodiment of the present application uses a hill climbing search strategy to make up for the lack of local search capabilities in traditional algorithms.
[0059] See also Figure 4 , Figure 4 A specific implementation of step S3 is shown, which is described in detail as follows:
[0060] S31: randomly selecting a node from the initial sub-population and the mutated sub-population as the current node, and determining neighbor nodes of the current node.
[0061] S32: Calculate the objective function value of the community where the current node is located according to the fitness function to obtain a first objective function value.
[0062] See also Figure 5 , Figure 5 A specific implementation of step S32 is shown, which is described in detail as follows:
[0063] S321: Traverse all nodes in the community where the current node is located to determine the number of edges of the current community node.
[0064] S322: Traverse the external nodes adjacent to the current node to determine the number of external node edges.
[0065] S323: Calculate the difference between the number of edges of the current community node and the number of edges of the external node, and obtain the first objective function value according to the ratio of the difference to the number of edges of the current community node.
[0066] Specifically, when calculating the fitness function, you need to first randomly select a node from the initial sub-population and the mutated sub-population as the current node, and determine the neighbor nodes of the current node; then traverse all nodes in the community where the current node is located to determine the number of edges of the current community node, and traverse the external nodes adjacent to the current node to determine the number of edges of the external nodes. Then calculate the difference between the number of edges of the current community node and the number of edges of the external nodes, calculate the density of the edges inside the community, that is, the ratio of the difference to the number of edges of the current community node, and obtain the first objective function value. If you need to compare the effect of network community division, you can add the results of the ratios of each community to obtain the module density value of the entire network. The higher the module density value, the better the community division effect.
[0067] S33: Calculate the objective function value when the current node joins the community where the neighbor node is located to obtain a second objective function value.
[0068] Specifically, after adding the current node to the community where the neighbor node is located, the current new community is obtained, and then all nodes in the current new community are determined to obtain the number of edges of the current new community node; at the same time, the number of edges of the external nodes of the neighbor node is determined. According to the ratio of the number of edges of the current new community node to the number of edges of the external nodes of the neighbor node, the ratio is divided by the number of edges of the current new community node to obtain the second objective function value.
[0069] S34: Compare the first objective function value with the second objective function value to update the sub-population and obtain a plurality of updated sub-populations.
[0070] See also Figure 6 , Figure 6 A specific implementation of step S34 is shown, which is described in detail as follows:
[0071] S341: Compare the first objective function value with the second objective function value.
[0072] S342: If the second objective function value is greater than all the first objective function values, divide a new community according to the largest second objective function value, and move the current node to the new community.
[0073] S343: If the preset stop condition is not met, the current node is iteratively divided again until the preset stop condition is met, and a plurality of updated sub-populations are obtained.
[0074] Specifically, after the calculation of the above steps, multiple second objective function values are obtained, and the first objective function value is compared with the second objective function value respectively. If the second objective function value is greater than all the first objective function values, a new community is divided according to the largest second objective function value, and the current node is moved to the new community. If the preset stop condition is not met, the process returns to step S31 and reselects new nodes for community division until the preset stop condition is met, and multiple updated subpopulations are obtained. The preset stop condition includes reaching a preset number of iterations, the first objective function value no longer increases, or the number of communities no longer increases.
[0075] In a specific embodiment, the best individual in the current subpopulation can be selected from each initial subpopulation and each mutated subpopulation, and the best individual this time is used as the current node. The fitness function value calculation and hill climbing search are performed based on the current node to reduce the number of calculations and improve efficiency.
[0076] S4: Determine the current target population according to the fitness function value and the updated sub-population, and determine the target optimal individual from the current target population.
[0077] Specifically, multiple optimal individuals are obtained from the updated subpopulation according to the fitness function value, the multiple optimal individuals are combined into a current target group, and then the target optimal individual is determined from the current target group. The fitness function value is the first target function value calculated in the above step.
[0078] See also Figure 7 , Figure 7 A specific implementation of step S4 is shown, which is described in detail as follows:
[0079] S41: Selecting a preset number of individuals from each of the updated sub-populations according to the fitness function value as the current optimal individuals.
[0080] S42: Constructing the current target group according to all the current optimal individuals.
[0081] S43: Determine the optimal target individual according to the current target group.
[0082] Specifically, each individual in the updated subpopulation is sorted according to the fitness function value, and then the top-ranked individual is selected from each updated subpopulation as the current optimal individual, and the current target population is constructed based on all the current optimal individuals. The target optimal individual is determined based on the current target population. The target optimal individual can be selected based on the fitness function value.
[0083] S5: If the current number of iterations does not reach the preset maximum number of population iterations, the individuals in the current subpopulation are mutated again to obtain the target optimal individual, until the current number of iterations reaches the preset maximum number of population iterations, and the target optimal individual is converted into a corresponding network community division result.
[0084] Specifically, if the current iteration number is the preset maximum population iteration number, then return to step S2, mutate each individual, perform hill climbing search and population update according to the above steps, so as to obtain the target optimal individual of the current iteration, until the current iteration number reaches the preset maximum population iteration number. Finally, all the target optimal individuals are converted into corresponding network community division results.
[0085] It should be noted that the preset maximum number of population iterations is set according to actual conditions and is not limited here.
[0086] In an embodiment of the present application, initial node data is obtained, and population initialization processing is performed based on the initial node data to obtain multiple initial sub-populations; a mutation operation is performed on each individual in the current initial sub-population to obtain a mutated sub-population; a hill climbing search is performed on the initial sub-population and the mutated sub-population according to a fitness function to update the sub-population to obtain multiple updated sub-populations; a current target population is determined according to the fitness function value and the updated sub-population, and a target optimal individual is determined from the current target population; if the current number of iterations does not reach the preset maximum number of population iterations, the individuals in the current sub-population are mutated again to obtain the target optimal individual, until the current number of iterations reaches the preset maximum number of population iterations, and the target optimal individual is converted into a corresponding network community division result. The embodiment of the present invention performs mutation operations and local hill climbing search operations on individuals in a population to identify the optimal individual from the updated sub-population, and converts the target optimal individual into a corresponding network community division result. It does not require excessive manual intervention in parameter setting issues, and does not require complex parameter calculations. At the same time, mutation operations and local hill climbing search operations are beneficial to improving the community division effect.
[0087] In the embodiment of the present application, three initialization parameters are required: the maximum number of subpopulation iterations Gmax, the size of the subpopulation N_pop, and the number of subpopulations N_sub-swarms. The algorithm includes three main steps: (1) performing initialization operations for each subpopulation; (2) performing mutation operations on individuals in the subpopulation; and (3) performing hill climbing searches near the optimal individuals in each subpopulation. Assume that V_n is the number of nodes in the network, N_pop is the population size of each subpopulation starting population, and Gmax is the maximum number of subpopulation iterations. For each subpopulation, the time consumption mainly consists of two parts: mutation operations and hill climbing searches. For N_pop individuals in a subpopulation, the time complexity of performing mutation operations is O(N_pop*V_n). In addition, the time complexity of the hill climbing search depends on the number of community partitions represented by the optimal individual. Assuming that m is the number of final community partitions, the time complexity of the hill climbing search is O(N_pop*m). In the worst case, the number of community divisions is equal to the number of nodes in the network. In this case, the worst time complexity of hill climbing search is O(N_pop*V_n). However, this situation generally does not happen, and in most cases m is much smaller than V_n. Therefore, the overall time complexity of the algorithm is O(G_max*N_pop*(V_n+m)).
[0088] Therefore, in the embodiment of the present application, no prior knowledge of community structure, such as the number of communities, is required. The modular density function is used as the target optimization function to solve the resolution limitation problem of modularity in community division. And only mutation operations and local hill climbing search operations need to be performed on individuals in the population, which is easy to understand; the algorithm requires fewer parameters, only the population size, the maximum number of iterations and the number of fruit fly subgroups, and the entire calculation process does not need to consider parameter settings that require too much manual intervention, such as crossover probability and mutation probability in traditional evolutionary algorithms.
[0089] Please refer to Figure 8 , as a response to the above Figure 1 The present application provides an embodiment of a community discovery device based on a swarm intelligence strategy, and the device embodiment is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0090] like Figure 8 As shown, the community discovery device based on the swarm intelligence strategy of this embodiment includes: an initialization unit 61, a mutation unit 62, an update unit 63, an individual confirmation unit 64 and an iteration end unit 65, wherein:
[0091] An initialization unit 61 is used to obtain initial node data and perform population initialization processing based on the initial node data to obtain multiple initial sub-populations;
[0092] A mutation unit 62 is used to perform a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population;
[0093] An updating unit 63, configured to perform a hill climbing search on the initial sub-population and the mutated sub-population according to a fitness function to update the sub-population and obtain a plurality of updated sub-populations;
[0094] An individual confirmation unit 64 is used to determine a current target population according to the fitness function value and the updated sub-population, and to determine a target optimal individual from the current target population;
[0095] The iteration end unit 65 is used to mutate the individuals in the current sub-population again to obtain the target optimal individual if the current iteration number does not reach the preset maximum population iteration number, until the current iteration number reaches the preset maximum population iteration number, and convert the target optimal individual into the corresponding network community division result.
[0096] Furthermore, the mutation unit 62 includes:
[0097] A target node selection unit, used for randomly selecting a node from each individual in the current initial sub-population as a target node;
[0098] A target community ID selection unit, configured to randomly select a community ID from a set of neighboring nodes corresponding to the target node to obtain a target community ID;
[0099] The community ID assignment unit is used to assign the community ID of the target node to the target community ID, so as to perform a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population.
[0100] Further, the updating unit 63 includes:
[0101] A current node selection unit, used to randomly select a node from the initial sub-population and the mutated sub-population as a current node, and determine neighbor nodes of the current node;
[0102] A first objective function value calculation unit, configured to calculate the objective function value of the community where the current node is located according to the fitness function to obtain a first objective function value;
[0103] A second objective function value calculation unit, used to calculate the objective function value when the current node joins the community where the neighbor node is located, to obtain a second objective function value;
[0104] The subpopulation updating unit is used to compare the first objective function value with the second objective function value to update the subpopulation and obtain a plurality of updated subpopulations.
[0105] Furthermore, the first objective function value calculation unit includes:
[0106] A current community node variable determination unit, used to traverse all nodes in the community where the current node is located to determine the number of edges of the current community node;
[0107] An external node edge number determination unit, used for traversing external nodes adjacent to the current node to determine the number of external node edges;
[0108] A difference calculation unit is used to calculate the difference between the number of edges of the current community node and the number of edges of the external node, and obtain the first objective function value according to the ratio of the difference to the number of edges of the current community node.
[0109] Furthermore, the subpopulation updating unit includes:
[0110] a comparing unit, configured to compare the first objective function value with the second objective function value;
[0111] a community division unit, configured to divide a new community according to the largest second objective function value if the second objective function value is greater than all the first objective function values, and move the current node to the new community;
[0112] The iterative division unit is used to iteratively divide the current node again if the preset stop condition is not met, until the preset stop condition is met to obtain a plurality of updated sub-populations.
[0113] Further, the individual confirmation unit 64 includes:
[0114] A current best individual determination unit, used for selecting a preset number of individuals from each of the updated sub-populations according to the fitness function value as the current best individuals;
[0115] A current target group construction unit, used to construct the current target group according to all the current optimal individuals;
[0116] The target optimal individual determination unit is used to determine the target optimal individual according to the current target group.
[0117] Further, the initialization unit 61 includes:
[0118] An initial node data acquisition unit, used to acquire the initial node data and initialize population parameters, wherein the population parameters include the preset maximum number of population iterations, the population size of the subpopulation, and the number of populations;
[0119] The initial sub-population generating unit is used to initialize the population according to the initial node data and the population parameters, so as to place the initial node data in different communities and generate a plurality of the initial sub-populations.
[0120] In an embodiment of the present application, initial node data is obtained, and population initialization processing is performed based on the initial node data to obtain multiple initial sub-populations; a mutation operation is performed on each individual in the current initial sub-population to obtain a mutated sub-population; a hill climbing search is performed on the initial sub-population and the mutated sub-population according to a fitness function to update the sub-population to obtain multiple updated sub-populations; a current target population is determined according to the fitness function value and the updated sub-population, and a target optimal individual is determined from the current target population; if the current number of iterations does not reach the preset maximum number of population iterations, the individuals in the current sub-population are mutated again to obtain the target optimal individual, until the current number of iterations reaches the preset maximum number of population iterations, and the target optimal individual is converted into a corresponding network community division result. The embodiment of the present invention performs mutation operations and local hill climbing search operations on individuals in a population to identify the optimal individual from the updated sub-population, and converts the target optimal individual into a corresponding network community division result. It does not require excessive manual intervention in parameter setting issues, and does not require complex parameter calculations. At the same time, mutation operations and local hill climbing search operations are beneficial to improving the community division effect.
[0121] To solve the above technical problems, the present application also provides a computer device. Fig. 9 , Fig. 9 This is a basic structural block diagram of the computer device in this embodiment.
[0122] The computer device 7 includes a memory 71, a processor 72, and a network interface 73 which are interconnected and communicated with each other through a system bus. It should be noted that: Fig. 9 Only a computer device 7 having three components, memory 71, processor 72, and network interface 73, is shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.
[0123] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0124] The memory 71 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 71 can be an internal storage unit of the computer device 7, such as a hard disk or memory of the computer device 7. In other embodiments, the memory 71 can also be an external storage device of the computer device 7, such as a plug-in hard disk equipped on the computer device 7, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 71 can also include both the internal storage unit of the computer device 7 and its external storage device. In this embodiment, the memory 71 is generally used to store the operating system and various application software installed on the computer device 7, such as the program code of the community discovery method based on the group intelligence strategy, etc. In addition, the memory 71 can also be used to temporarily store various types of data that have been output or are to be output.
[0125] The processor 72 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 72 is generally used to control the overall operation of the computer device 7. In this embodiment, the processor 72 is used to run the program code stored in the memory 71 or process data, such as running the program code of the community discovery method based on the swarm intelligence strategy to implement various embodiments of the community discovery method based on the swarm intelligence strategy.
[0126] The network interface 73 may include a wireless network interface or a wired network interface, and the network interface 73 is generally used to establish a communication connection between the computer device 7 and other electronic devices.
[0127] The present application also provides another implementation, namely, providing a computer-readable storage medium, which stores a computer program, and the computer program can be executed by at least one processor to enable the at least one processor to perform the steps of a community discovery method based on a swarm intelligence strategy as described above.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0129] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of protection of the present application.
Claims
1. A community discovery method based on swarm intelligence strategy, characterized in that: include: Acquiring initial node data, and performing population initialization processing based on the initial node data to obtain multiple initial sub-populations; Performing a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population; Performing a hill climbing search on the initial subpopulation and the mutated subpopulation according to a fitness function to update the subpopulation to obtain a plurality of updated subpopulations; Determine a current target population according to the fitness function value and the updated subpopulation, and determine a target optimal individual from the current target population; If the current number of iterations does not reach the preset maximum number of population iterations, the individuals in the current subpopulation are mutated again to obtain the target optimal individual, until the current number of iterations reaches the preset maximum number of population iterations, and the target optimal individual is converted into the corresponding network community division result.
2. The community discovery method based on swarm intelligence strategy according to claim 1 is characterized in that: The performing a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population includes: Each individual in the current initial subpopulation randomly selects a node as the target node; Randomly select a community ID from the neighbor node set corresponding to the target node to obtain the target community ID; The community ID of the target node is assigned as the target community ID, so as to perform a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population.
3. The community discovery method based on swarm intelligence strategy according to claim 1, characterized in that: The performing of a hill climbing search on the initial sub-population and the mutated sub-population according to the fitness function to update the sub-population to obtain a plurality of updated sub-populations includes: Randomly select a node from the initial sub-population and the mutated sub-population as the current node, and determine the neighbor nodes of the current node; Calculate the objective function value of the community where the current node is located according to the fitness function to obtain a first objective function value; Calculating the objective function value when the current node joins the community where the neighbor node is located to obtain a second objective function value; The first objective function value is compared with the second objective function value to update the subpopulation to obtain a plurality of updated subpopulations.
4. The community discovery method based on swarm intelligence strategy according to claim 3 is characterized in that: The step of calculating the objective function value of the community where the current node is located according to the fitness function to obtain a first objective function value includes: Traversing all nodes in the community where the current node is located to determine the number of edges of the current community nodes; Traversing the external nodes adjacent to the current node to determine the number of external node edges; The difference between the number of edges of the current community node and the number of edges of the external node is calculated, and the first objective function value is obtained according to the ratio of the difference to the number of edges of the current community node.
5. The community discovery method based on swarm intelligence strategy according to claim 3 is characterized in that: The comparing the first objective function value with the second objective function value to update the subpopulation to obtain a plurality of updated subpopulations includes: comparing the first objective function value with the second objective function value; If the second objective function value is greater than all the first objective function values, dividing a new community according to the largest second objective function value, and moving the current node to the new community; If the preset stop condition is not met, the current node is iteratively divided again until the preset stop condition is met, thereby obtaining a plurality of updated sub-populations.
6. The community discovery method based on swarm intelligence strategy according to any one of claims 1 to 5, characterized in that: The step of determining the current target population according to the fitness function value and the updated sub-population, and determining the target optimal individual from the current target population, comprises: Selecting a preset number of individuals from each of the updated subpopulations according to the fitness function value as the current optimal individuals; Constructing the current target group according to all the current optimal individuals; The optimal target individual is determined according to the current target group.
7. The community discovery method based on swarm intelligence strategy according to any one of claims 1 to 5, characterized in that: The obtaining of initial node data and performing population initialization processing based on the initial node data to obtain multiple initial sub-populations include: Acquire the initial node data and initialize population parameters, wherein the population parameters include the preset maximum population iteration number, the population size of the subpopulation and the population number; The population is initialized according to the initial node data and the population parameters to place the initial node data in different communities and generate a plurality of the initial sub-populations.
8. A community discovery device based on swarm intelligence strategy, characterized in that: include: An initialization unit, used to obtain initial node data, and perform population initialization processing based on the initial node data to obtain multiple initial sub-populations; A mutation unit, used for performing a mutation operation on each individual in the current initial sub-population to obtain a mutated sub-population; An updating unit, configured to perform a hill climbing search on the initial subpopulation and the mutated subpopulation according to a fitness function to update the subpopulation and obtain a plurality of updated subpopulations; An individual confirmation unit, which determines a current target population according to the fitness function value and the updated sub-population, and determines a target optimal individual from the current target population; The iteration ending unit is used to mutate the individuals in the current subpopulation again to obtain the target optimal individual if the current iteration number does not reach the preset maximum population iteration number, until the current iteration number reaches the preset maximum population iteration number, and convert the target optimal individual into the corresponding network community division result.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the community discovery method based on a swarm intelligence strategy as claimed in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the community discovery method based on a swarm intelligence strategy as claimed in any one of claims 1 to 7 is implemented.