Community division method and system, electronic device and storage medium

Through the combination of social relationship edge data and community discovery algorithm and the optimization of community division with preset conditions, the accuracy and speed of social network community division methods are solved, and the performance of social relationship analysis is improved.

CN113177854BActive Publication Date: 2024-11-12CTRIP COMP TECH SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110443401.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-23
Publication Date
2024-11-12
Estimated Expiration
2041-04-23

AI Technical Summary

Technical Problem

The accuracy of existing social network community division methods is low and the generation speed is slow, resulting in lower performance.

Method used

By obtaining social relationship edge data, using the community discovery algorithm for iterative division, combining preset conditions such as the number of user IDs and the number of iterations, the community division results are optimized to improve accuracy and efficiency.

Benefits of technology

Achieve more accurate community division results and faster generation speeds, improving the performance of social relationship analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113177854B_ABST
    Figure CN113177854B_ABST
Patent Text Reader

Abstract

The present invention provides a community division method and system, an electronic device and a storage medium. The community division method comprises: obtaining social relationship edge data, the social relationship edge data comprises at least two user IDs and the relationship weights between two user IDs, the relationship weights are used to characterize the relationship intimacy between the two user IDs; performing community division iteration based on the social relationship edge data using a community discovery algorithm to obtain a community division result, the community division result comprises at least two user IDs and the community corresponding to each user ID; if the community division result meets a preset condition, the community division iteration is stopped. The present invention ends the community division iteration by the community division result meeting the preset condition, realizes the division of each user into the corresponding community, and improves the accuracy of the community division result by using the preset condition in combination with the community division algorithm to perform community division.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a community division method and system, electronic equipment and storage medium. Background Art

[0002] With the rapid development of the Internet / big data and the continuous deepening of data value mining, enterprises have gradually begun to pay attention to the social attributes of users instead of focusing only on their individual independence, trying to mine more value through their social attributes. A very important part of social attributes is the social relationship network between people, which we call social network.

[0003] As far as the OTA (Online Travel Agency) industry is concerned, by establishing a social network system, we can have a more comprehensive understanding of users, discover more potential users, and use social network data as an entry point to maximize its value in many scenarios such as data operations, marketing, and advertising.

[0004] Social networks are composed of relationships between users. The amount of user relationship data collected from various channels is often hundreds of millions. Directly analyzing and using these relationship data is very technically complex and computationally expensive. Therefore, we need to classify closely related users into the same social circle (which we call a community) from the massive relationship data, that is, to simplify the social relationships of users within a small community, so as to facilitate the analysis of users' social relationships. Summary of the invention

[0005] The technical problem to be solved by the present invention is to overcome the defects of low accuracy and slow generation speed of social network community division results in the prior art, resulting in low performance, and to provide a community division method and system, electronic device and storage medium.

[0006] The present invention solves the above technical problems through the following technical solutions:

[0007] The present invention provides a community division method, the community division method comprising:

[0008] Acquire social relationship edge data, where the social relationship edge data includes at least two user IDs (identifications) and relationship weights between any two user IDs, where the relationship weights are used to characterize the intimacy of the relationship between the two user IDs;

[0009] Performing community division iterations using a community discovery algorithm based on the social relationship edge data to obtain a community division result, wherein the community division result includes the at least two user IDs and a community corresponding to each of the user IDs;

[0010] If the community division result meets the preset condition, the community division iteration is stopped.

[0011] Preferably, the community division result also includes the relationship weights between any two user IDs in each community;

[0012] The community division method further includes:

[0013] For each community, the influence value of the user ID in the community is calculated based on the relationship weights between any two user IDs in the community.

[0014] Preferably, the preset condition includes that the number of user IDs in each community is not greater than a first threshold; and / or,

[0015] The preset condition includes that the number of community division iterations is greater than or equal to a second threshold.

[0016] Preferably, community division iteration is performed on the communities whose user ID number in the community division result is greater than the first threshold.

[0017] Preferably, the community division method further comprises the following steps:

[0018] generating a social relationship graph based on the social relationship edge data, wherein the social relationship graph includes a plurality of nodes and social relationship edges, and the social relationship edge is used to connect two nodes to represent that there is a social relationship between the two nodes;

[0019] In each round of community division iteration, if the number of user IDs in the community in the community division result is not greater than a first threshold, all first nodes in the social relationship graph are replaced with a second node, wherein the first node is used to represent the user ID in the community, and the second node is used to represent the community;

[0020] The preset condition includes that the total number of social relationship edges reduced in each round of community division iteration is less than or equal to a third threshold.

[0021] The present invention also provides a community division system, the community division system comprising: a social relationship edge acquisition module and a community division iteration module;

[0022] The social relationship edge acquisition module is used to acquire social relationship edge data, wherein the social relationship edge data includes at least two user IDs and a relationship weight between two user IDs, wherein the relationship weight is used to characterize the intimacy of the relationship between the two user IDs;

[0023] The community division iteration module is used to perform community division iteration based on the social relationship edge data using a community discovery algorithm to obtain a community division result, wherein the community division result includes the at least two user IDs and the community corresponding to each of the user IDs;

[0024] The community division iteration module is further configured to stop the community division iteration when the community division result reaches a preset condition.

[0025] Preferably, the community division result also includes the relationship weights between any two user IDs in each community;

[0026] The community division system further includes: an influence calculation module;

[0027] The influence calculation module is used to calculate, for each community, the influence value of the user ID in the community based on the relationship weights between any two user IDs in the community.

[0028] Preferably, the preset condition includes that the number of user IDs in each community is not greater than a first threshold; and / or,

[0029] The preset condition includes that the number of community division iterations is greater than or equal to a second threshold.

[0030] Preferably, the community division iteration module is specifically used to perform community division iteration on the communities whose user ID number in the community division result is greater than a first threshold.

[0031] Preferably, the community division system further comprises: a social relationship graph generation module;

[0032] The social relationship graph generation module is used to generate a social relationship graph based on the social relationship edge data, wherein the social relationship graph includes a plurality of nodes and social relationship edges, and the social relationship edge is used to connect two nodes to represent that there is a social relationship between the two nodes;

[0033] The social relationship graph generation module is also used for replacing all first nodes in the social relationship graph with a second node in each round of community division iteration if the number of user IDs in the community in the community division result is not greater than a first threshold, wherein the first node is used to represent the user ID in the community and the second node is used to represent the community;

[0034] The preset condition includes that the total number of social relationship edges reduced in each round of community division iteration is less than or equal to a third threshold.

[0035] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the aforementioned community division method when executing the program.

[0036] The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the aforementioned community division method are implemented.

[0037] The positive and progressive effect of the present invention is that the present invention inputs the acquired social relationship edge data into the community division algorithm for community division, and ends the community division iteration by the community division result reaching the preset condition, thereby realizing the division of each user into the corresponding community, and by using the preset condition in conjunction with the community division algorithm for community division, the accuracy of the community division result is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is a flow chart of a community division method according to Embodiment 1 of the present invention.

[0039] Figure 2 This is a flowchart of a specific implementation of the community division method of Example 1 of the present invention.

[0040] Figure 3 This is a social relationship graph in the community division method of embodiment 1 of the present invention.

[0041] Figure 4 This is a social relationship graph after node replacement in the community division method of embodiment 1 of the present invention.

[0042] Figure 5 This is a module diagram of the community division system of Example 2 of the present invention.

[0043] Figure 6 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0044] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.

[0045] Example 1

[0046] This embodiment provides a community division method. Figure 1 , community division methods include:

[0047] S11. Acquire social relationship edge data, where the social relationship edge data includes at least two user IDs and relationship weights between any two user IDs, where the relationship weight is used to characterize the intimacy of the relationship between the two user IDs.

[0048] Among them, the social relationship edge data can be obtained by preprocessing the acquired original social network data. The original social network data can be obtained through various channels. For example:

[0049] 1) The number of interactions in the social circle <UserID1, UserID2, number of times>, which represents the interaction operation (undirected) between UserID1 (i.e., user ID) and UserID2 or the interaction operation of UserID1 towards UserID2 (directed). The interaction operations include but are not limited to sharing, forwarding, liking, and bargaining. For example, the liking between UserID1 and UserID2 and the liking of UserID1 for UserID2.

[0050] 2) The number of orders associated <UserID1, phone number of UserID2, number of orders>, which represents the number of orders such as trips or accommodation under UserID1 for UserID2. There is a definite corresponding relationship between the phone number and UserID2, and UserID2 can be obtained by searching the corresponding database, so as to convert the data into <UserID1, UserID2, number of orders>.

[0051] The social relationship edge data obtained after preprocessing has a unified format, which can be <UserID1, UserID2, relationship weight between UserID1 and UserID2>.

[0052] S12. Use the community discovery algorithm to perform community division iteration based on the social relationship edge data to obtain the community division result. The community division result includes at least two user IDs and the community corresponding to each user ID.

[0053] Among them, the community discovery algorithm can be the GN (agglomerative community structure discovery algorithm) algorithm, the LPA (label propagation algorithm) algorithm, or the SLPA (extended label propagation algorithm) algorithm, preferably the Louvain algorithm. The Louvain algorithm is an algorithm based on multi-level optimization of modularity. Compared with the GN algorithm, the LPA algorithm, or the SLPA algorithm, it has higher accuracy, faster processing speed, and better performance.

[0054] The following uses a simple example 1 to illustrate an implementation method of the Louvain algorithm.

[0055] In Example 1, there are UserIDs corresponding to 6 users. In the undirected case, the social relationship edge data is shown in Table 1:

[0056] Table 1

[0057] One of two user IDs The other of the two user IDs Relationship Weight UserID1 UserID2 5 UserID1 UserID3 4 UserID1 UserID5 1 UserID2 UserID3 2 UserID3 UserID4 7 UserID4 UserID6 3 UserID5 UserID6 8

[0058] Among them, the combination of two user IDs that is not listed means that the relationship weight between the two user IDs is 0, that is, there is no social relationship. For example, the combination of UserID1 and UserID4 is not listed in the above table, which means that the relationship weight between UserID1 and UserID4 is 0.

[0059] i and j represent one of the six user IDs respectively, and both i and j are positive integers from 1 to 6. For example, when i=1, i represents UserID1, and when i=6, i represents UserID6. Aij represents the relationship weight between i and j. If i=j, then Aij=0.

[0060] The total weight m:

[0061] Calculation yields m=30.

[0062] Let ki represent the sum of the relationship weights between i and other user IDs, kj represent the sum of the relationship weights between j and other user IDs, and Qij represent the maximum modularity gain from i to j.

[0063] Qij=Aij-ki*kj / m.

[0064] Calculation shows that Q12=5-10*7 / 30=2.667, Q13=4-10*13 / 30=-0.333, Q15=1-10*9 / 30=-2, Q23=2-7*13 / 30=-1.033, Q34=7-13*10 / 30=2.667, Q46=3-10*11 / 30=-0.667, Q56=8-9*11 / 30=4.7.

[0065] If Qij is less than 0, no community division is performed. If Qij is greater than 0, the user IDs corresponding to the maximum modularity gain are merged. Then, UserID1 and UserID2 are merged, UserID3 and UserID4 are merged, and UserID5 and UserID6 are merged. That is, UserID1 and UserID2 are divided into one community (assuming community A), UserID3 and UserID4 are divided into one community (assuming community B), and UserID5 and UserID6 are divided into one community (assuming community C). After the merger, the weight sum m should be updated, that is, the weights between the merged user IDs are subtracted. In this example, the weight sum m is updated to 10, that is, 30-5-7-8=10.

[0066] Example 1 is a calculation performed according to the Louvain algorithm in one round of community division iteration. The next round of community division iteration is similar to this and will not be described in detail.

[0067] S13. If the community division result meets the preset conditions, the community division iteration is stopped.

[0068] This embodiment inputs the acquired social relationship edge data into the community division algorithm for community division, and ends the community division iteration when the community division result reaches the preset condition, thereby achieving the division of each user into the corresponding community. By using the preset conditions in conjunction with the community division algorithm for community division, the accuracy of the community division result is improved.

[0069] In specific implementation, the community division result also includes the relationship weights between any two user IDs in each community.

[0070] After step S13, the community division method further includes:

[0071] S14. For each community, the influence value of the user IDs in the community is calculated based on the relationship weights between any two user IDs in the community.

[0072] Among them, the influence value of the user ID in the community is the key indicator of the corresponding user in the community. The larger the influence value, the greater the influence of the corresponding user in the community, which is a measure of the user's community influence. Based on the influence value, the user's influence ranking in the community and the top percentage of the quantile value can be output to meet further analysis needs, converting complex user social relationships into quantifiable influence indicators, so that the data can be directly applied to actual business scenarios.

[0073] This embodiment calculates the influence value of user IDs in the community to understand the influence of user IDs in the community to which they belong, and converts complex user social relationships into quantifiable influence indicators, so that the data can be directly applied to actual business scenarios.

[0074] In a specific implementation example, the preset conditions include preset condition 1, that is, the number of user IDs in each community is not greater than a first threshold. If preset condition 1 is met, the community division iteration is stopped.

[0075] The first threshold is a positive integer. The first threshold represents the expected value of the maximum number of people in the community after the community division, that is, the expected community size. If the first threshold is set too large, the community division effect will be poor, and the community division result will not accurately reflect the closeness of the social relationship between the people; if the first threshold is set too small, the community division result will not correctly reflect the stable social relationship between the people.

[0076] In a specific implementation, the first threshold value may be set as required. Preferably, the first threshold value may be set to 500.

[0077] In a specific implementation example, the preset condition includes preset condition 2, that is, the number of community division iterations is greater than or equal to a second threshold. If preset condition 2 is met, the community division iteration is stopped.

[0078] The second threshold is a positive integer. If the number of community division iterations is greater than or equal to the second threshold, it means that the community division iteration has reached a certain number of times. If the iteration continues, it will take a long time and the iteration efficiency is not high. In order to avoid the iteration not converging and causing the calculation time to be too long, the community division iteration needs to be stopped in time. The second threshold can be set as needed.

[0079] In a specific implementation example, the preset condition includes preset condition 1 and preset condition 2. If one of the preset condition 1 and the preset condition 2 is met, the community division iteration is stopped.

[0080] In specific implementation, community division iteration is performed on the communities whose user ID number is greater than the first threshold in the community division result.

[0081] In order to prevent the community size from being too large, this embodiment continues to use a community discovery algorithm (such as the Louvain algorithm) to further split the community if the community size exceeds the specified threshold until the community size is within the range of the first threshold.

[0082] In the specific implementation, in step S12, refer to Figure 2 , the community division method also includes the following steps:

[0083] S121. Generate a social relationship graph based on the social relationship edge data, where the social relationship graph includes a number of nodes and social relationship edges. The social relationship edge is used to connect two nodes to represent the existence of a social relationship between the two nodes.

[0084] Taking the data in Example 1 of this embodiment as an example, the generated social relationship graph is as follows: Figure 3 As shown in the figure, a circle represents a node, and the number inside the node represents the corresponding user ID. For example, the number 1 inside the node represents UserID1. The line between two nodes is a social relationship edge, and the number marked next to the social relationship edge is the relationship weight between the user IDs corresponding to the two nodes. For example, the line between node 1 and node 2 is marked with the number 5, which represents that the relationship weight between UserID1 and UserID2 is 5.

[0085] S122. In each round of community division iteration, if the number of user IDs in the community in the community division result is not greater than a first threshold, all first nodes in the social relationship graph are replaced with a second node, wherein the first node is used to represent the user ID in the community, and the second node is used to represent the community.

[0086] Here, taking the data in Example 1 in this embodiment as an example, Figure 3 The effect after the first node represented by the circle is replaced by the second node is as follows Figure 4 shown. Specifically, Figure 3 The first node 1 in is used to represent UserID1, the first node 2 is used to represent UserID2…, and so on, the first node 6 is used to represent UserID6. According to the calculation result in Example 1, UserID1 and UserID2 are classified into a community (assuming community A), UserID3 and UserID4 are classified into a community (assuming community B), and UserID5 and UserID6 are classified into a community (assuming community C). Figure 4 The second node A in is used to represent community A, the second node B is used to represent community B, and the second node C is used to represent community C.

[0087] In a specific implementation example, the preset condition includes preset condition 3, that is, the total number of social relationship edges reduced in each round of community division iteration is less than or equal to a third threshold. If preset condition 3 is met, the community division iteration is stopped.

[0088] The third threshold is a positive integer. If the total number of social relationship edges reduced in each round of community division iteration is less than or equal to the third threshold, it indicates that the community division effect in this round of community division iteration is not good and a considerable number of new communities cannot be divided. In order to avoid the iteration not converging all the time and causing the calculation time to be too long, it is necessary to stop the community division iteration in time. The third threshold can be set as needed.

[0089] In a specific implementation example, the preset condition includes preset condition 1 and preset condition 3. If one of the preset condition 1 and the preset condition 3 is met, the community division iteration is stopped.

[0090] In a specific implementation example, the preset condition includes preset condition 2 and preset condition 3. If one of the preset condition 2 and the preset condition 3 is met, the community division iteration is stopped.

[0091] The preset conditions may include preset conditions 1-3. As long as one of the preset conditions 1-3 is met, the community division iteration is stopped. For example, if the first threshold is 500 and preset condition 2 is met first, even if preset condition 1 is not met, that is, there are still communities with a population greater than 500, even if preset condition 3 is not met, that is, the community division effect is good in this round of community division iteration and a considerable number of new communities can be divided, the community division iteration should be stopped, and the community division result can indicate that the divided communities include communities with a population greater than 500 and communities with a population not greater than 500.

[0092] Since the amount of social network data easily reaches hundreds of millions and continues to increase, and the social relationship edge data can be obtained from the social network data. To implement the community division iteration based on the massive social relationship edge data in this embodiment, the Spark engine (a fast and general computing engine designed specifically for large-scale data processing) can be used. Through the distributed mechanism of SparkSQL (the module in the overall Spark architecture for processing structured data) + GraphX (a distributed graph processing framework that provides simple, easy-to-use, and rich interfaces for graph computing and graph mining based on the Spark platform), the processing of massive social network data can be realized.

[0093] In this embodiment, the obtained social relationship edge data is input into the community division algorithm for community division. The community division iteration is ended when the community division result meets the preset conditions, realizing the division of each user into the corresponding community and outputting the community division result. By using the preset conditions in cooperation with the community division algorithm for community division, the accuracy of the community division result is improved, the division speed is increased, the performance is optimized, and the dual improvement of the effect and efficiency of community division is taken into account.

[0094] Embodiment 2

[0095] This embodiment provides a community division system. Refer to Figure 3 , the community division system includes: a social relationship edge acquisition module 101 and a community division iteration module 102.

[0096] The social relationship edge acquisition module 101 is used to acquire social relationship edge data. The social relationship edge data includes at least two user IDs and the relationship weight between every two user IDs. The relationship weight is used to characterize the intimacy of the relationship between the two user IDs.

[0097] Among them, the social relationship edge data can be obtained by preprocessing the acquired original social network data. The original social network data can be obtained through various channels, for example:

[0098] 1) The number of interactions in the social circle <UserID1, UserID 2, number>, indicating the interaction operation (undirected) between UserID1 (i.e., the user ID) and UserID2 or the interaction operation of UserID1 for UserID2 (directed). The interaction operations include, but are not limited to, sharing, forwarding, liking, and bargaining. For example, the liking between UserID1 and UserID2 and the liking of UserID1 for UserID2.

[0099] 2) The number associated with the order <UserID1, the phone numbers of UserID 2, the order quantity> indicates the number of orders such as trips or accommodations under UserID 1 for UserID 2. There is a definite corresponding relationship between the phone number and UserID 2, and UserID 2 can be obtained by searching the corresponding database, thus converting the data into <UserID1, UserID 2, order quantity>.

[0100] The social relationship edge data obtained after preprocessing has a unified format, which can be <UserID1, UserID 2, the relationship weight between UserID1 and UserID 2>.

[0101] The community division iteration module 102 is used to perform community division iteration based on the social relationship edge data using a community discovery algorithm to obtain a community division result, which includes at least two user IDs and the community corresponding to each user ID.

[0102] Among them, the community discovery algorithm can be the GN algorithm, the LPA algorithm or the SLPA algorithm, preferably the Louvain algorithm. The Louvain algorithm is an algorithm based on multi-level optimized modularity. Compared with the GN algorithm, the LPA algorithm or the SLPA algorithm, it has higher accuracy, faster processing speed and better performance.

[0103] The following uses a simple example 1 to illustrate an implementation manner of the Louvain algorithm.

[0104] In Example 1, there are UserIDs corresponding to 6 users. In the undirected case, the social relationship edge data is shown in Table 2:

[0105] Table 2

[0106] One of two user IDs The other of the two user IDs Relationship Weight UserID1 UserID2 5 UserID1 UserID3 4 UserID1 UserID5 1 UserID2 UserID3 2 UserID3 UserID4 7 UserID4 UserID6 3 UserID5 UserID6 8

[0107] Among them, the combination of two user IDs not listed means that the relationship weight between the two user IDs is 0, that is, there is no social relationship. For example, the combination of UserID1 and UserID4 is not listed in the above table, indicating that the relationship weight between UserID1 and UserID4 is 0.

[0108] Let i and j respectively represent one of these 6 user IDs, and both i and j are positive integers from 1 to 6. For example, when i = 1, i represents UserID1, and when i = 6, i represents UserID6. Let Aij represent the relationship weight between i and j. If i = j, then Aij = 0.

[0109] The total weight m:

[0110] Calculation yields m=30.

[0111] Let ki represent the sum of the relationship weights between i and other user IDs, kj represent the sum of the relationship weights between j and other user IDs, and Qij represent the maximum modularity gain from i to j.

[0112] Qij=Aij-ki*kj / m.

[0113] Calculation shows that Q12=5-10*7 / 30=2.667, Q13=4-10*13 / 30=-0.333, Q15=1-10*9 / 30=-2, Q23=2-7*13 / 30=-1.033, Q34=7-13*10 / 30=2.667, Q46=3-10*11 / 30=-0.667, Q56=8-9*11 / 30=4.7.

[0114] If Qij is less than 0, no community division is performed. If Qij is greater than 0, the user IDs corresponding to the maximum modularity gain are merged. Then, UserID1 and UserID2 are merged, UserID3 and UserID4 are merged, and UserID5 and UserID6 are merged. That is, UserID1 and UserID2 are divided into one community (assuming community A), UserID3 and UserID4 are divided into one community (assuming community B), and UserID5 and UserID6 are divided into one community (assuming community C). After the merger, the weight sum m should be updated, that is, the weights between the merged user IDs are subtracted. In this example, the weight sum m is updated to 10, that is, 30-5-7-8=10.

[0115] Example 1 is a calculation performed according to the Louvain algorithm in one round of community division iteration. The next round of community division iteration is similar to this and will not be described in detail.

[0116] The community division iteration module 102 is further configured to stop the community division iteration when the community division result reaches a preset condition.

[0117] This embodiment inputs the acquired social relationship edge data into the community division algorithm for community division, and ends the community division iteration when the community division result reaches the preset condition, thereby achieving the division of each user into the corresponding community. By using the preset conditions in conjunction with the community division algorithm for community division, the accuracy of the community division result is improved.

[0118] In specific implementation, the community division result also includes the relationship weights between any two user IDs in each community.

[0119] The community division system further includes: an influence calculation module 103 .

[0120] The influence calculation module 103 is used to calculate the influence value of the user ID in each community based on the relationship weights between any two user IDs in the community.

[0121] Among them, the influence value of the user ID in the community is the key indicator of the corresponding user in the community. The larger the influence value, the greater the influence of the corresponding user in the community, which is a measure of the user's community influence. Based on the influence value, the user's influence ranking in the community and the top percentage of the quantile value can be output to meet further analysis needs, converting complex user social relationships into quantifiable influence indicators, so that the data can be directly applied to actual business scenarios.

[0122] This embodiment calculates the influence value of user IDs in the community to understand the influence of user IDs in the community to which they belong, and converts complex user social relationships into quantifiable influence indicators, so that the data can be directly applied to actual business scenarios.

[0123] In a specific implementation example, the preset conditions include preset condition 1, that is, the number of user IDs in each community is not greater than a first threshold. If preset condition 1 is met, the community division iteration is stopped.

[0124] The first threshold is a positive integer. The first threshold represents the expected value of the maximum number of people in the community after the community division, that is, the expected community size. If the first threshold is set too large, the community division effect will be poor, and the community division result will not accurately reflect the closeness of the social relationship between the people; if the first threshold is set too small, the community division result will not correctly reflect the stable social relationship between the people.

[0125] In a specific implementation, the first threshold value may be set as required. Preferably, the first threshold value may be set to 500.

[0126] In a specific implementation example, the preset condition includes preset condition 2, that is, the number of community division iterations is greater than or equal to a second threshold. If preset condition 2 is met, the community division iteration is stopped.

[0127] The second threshold is a positive integer. If the number of community division iterations is greater than or equal to the second threshold, it means that the community division iteration has reached a certain number of times. If the iteration continues, it will take a long time and the iteration efficiency is not high. In order to avoid the iteration not converging and causing the calculation time to be too long, the community division iteration needs to be stopped in time. The second threshold can be set as needed.

[0128] In a specific implementation example, the preset condition includes preset condition 1 and preset condition 2. If one of the preset condition 1 and the preset condition 2 is met, the community division iteration is stopped.

[0129] In specific implementation, the community division iteration module 102 is specifically used to perform community division iteration on the communities whose user ID number is greater than the first threshold in the community division result.

[0130] In order to prevent the community size from being too large, this embodiment continues to use a community discovery algorithm (such as the Louvain algorithm) to further split the community if the community size exceeds the specified threshold until the community size is within the range of the first threshold.

[0131] During specific implementation, the community division system further includes: a social relationship graph generation module 104 .

[0132] The social relationship graph generation module 104 is used to generate a social relationship graph based on the social relationship edge data. The social relationship graph includes a number of nodes and social relationship edges. The social relationship edge is used to connect two nodes to represent the existence of a social relationship between the two nodes.

[0133] Taking the data in Example 1 of this embodiment as an example, the generated social relationship graph is similar to that in Example 1. Figure 3 The circle represents a node, and the number inside the node represents the corresponding user ID. For example, the number 1 inside the node represents UserID1. The line between two nodes is a social relationship edge, and the number marked next to the social relationship edge is the relationship weight between the user IDs corresponding to the two nodes. For example, the line between node 1 and node 2 is marked with the number 5, which represents that the relationship weight between UserID1 and UserID2 is 5.

[0134] The social relationship graph generation module 104 is also used to replace all first nodes in the social relationship graph with a second node in each round of community division iteration if the number of user IDs in the community in the community division result is not greater than the first threshold, wherein the first node is used to represent the user ID in the community and the second node is used to represent the community.

[0135] Here, taking the data in Example 1 in this embodiment as an example, Figure 3 The effect after the first node represented by the circle is replaced by the second node is the same as that in Example 1. Figure 4 Specifically, Figure 3 The first node 1 in is used to represent UserID1, the first node 2 is used to represent UserID2…, and so on, the first node 6 is used to represent UserID6. According to the calculation result in Example 1, UserID1 and UserID2 are classified into a community (assuming community A), UserID3 and UserID4 are classified into a community (assuming community B), and UserID5 and UserID6 are classified into a community (assuming community C). Figure 4The second node A in is used to represent community A, the second node B is used to represent community B, and the second node C is used to represent community C.

[0136] In a specific implementation example, the preset condition includes preset condition 3, that is, the total number of social relationship edges reduced in each round of community division iteration is less than or equal to a third threshold. If preset condition 3 is met, the community division iteration is stopped.

[0137] The third threshold is a positive integer. If the total number of social relationship edges reduced in each round of community division iteration is less than or equal to the third threshold, it indicates that the community division effect in this round of community division iteration is not good and a considerable number of new communities cannot be divided. In order to avoid the iteration not converging all the time and causing the calculation time to be too long, it is necessary to stop the community division iteration in time. The third threshold can be set as needed.

[0138] In a specific implementation example, the preset condition includes preset condition 1 and preset condition 3. If one of the preset condition 1 and the preset condition 3 is met, the community division iteration is stopped.

[0139] In a specific implementation example, the preset condition includes preset condition 2 and preset condition 3. If one of the preset condition 2 and the preset condition 3 is met, the community division iteration is stopped.

[0140] The preset conditions may include preset conditions 1-3. As long as one of the preset conditions 1-3 is met, the community division iteration is stopped. For example, if the first threshold is 500 and preset condition 2 is met first, even if preset condition 1 is not met, that is, there are still communities with a population greater than 500, even if preset condition 3 is not met, that is, the community division effect is good in this round of community division iteration and a considerable number of new communities can be divided, the community division iteration should be stopped, and the community division result can indicate that the divided communities include communities with a population greater than 500 and communities with a population not greater than 500.

[0141] Since the amount of social network data is often hundreds of millions and will continue to increase, and the social relationship edge data can be obtained based on the social network data, in order to realize the community division iteration based on the massive social relationship edge data in this embodiment, the Spark engine (a fast and general computing engine designed for large-scale data processing) can be used to realize the processing of massive social network data through the distributed mechanism of SparkSQL (a module used by the Spark overall architecture to process structured data) + GraphX ​​(a distributed graph processing framework, which is based on the Spark platform to provide simple, easy-to-use and rich interfaces for graph computing and graph mining).

[0142] This embodiment inputs the acquired social relationship edge data into the community division algorithm for community division, and ends the community division iteration when the community division result reaches the preset condition, thereby achieving the division of each user into the corresponding community and outputting the community division result. By using the preset conditions in conjunction with the community division algorithm for community division, the accuracy of the community division result is improved, the division speed is increased, the performance is optimized, and the dual improvement of the effect and efficiency of community division is taken into account.

[0143] Example 3

[0144] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the community division method in Embodiment 1 is implemented when the processor executes the program. Figure 6 The electronic device 30 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0145] The electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).

[0146] The bus 33 includes a data bus, an address bus, and a control bus.

[0147] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .

[0148] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0149] The processor 31 executes various functional applications and data processing by running the computer programs stored in the memory 32, such as the community division method in Embodiment 1 of the present invention.

[0150] The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the model-generated device 30 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. As shown, the network adapter 36 communicates with other modules of the model-generated device 30 via a bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (RAID) systems, tape drives, and data backup storage systems.

[0151] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.

[0152] Example 4

[0153] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the community division method in Embodiment 1 are implemented.

[0154] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0155] In a possible implementation manner, the present invention may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of implementing the community division method in Example 1.

[0156] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0157] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.

Claims

1. A community division method, characterized in that: The community division method includes: Acquire social relationship edge data, where the social relationship edge data includes at least two user IDs and relationship weights between two user IDs, where the relationship weights are used to characterize the intimacy of the relationship between the two user IDs; Performing community division iterations using a community discovery algorithm based on the social relationship edge data, and obtaining a community division result according to a maximum modularity gain between two user IDs, wherein the community division result includes the at least two user IDs and a community corresponding to each of the user IDs; If the community division result meets the preset condition, the community division iteration is stopped; The community division method further comprises the following steps: generating a social relationship graph based on the social relationship edge data, wherein the social relationship graph includes a plurality of nodes and social relationship edges, and the social relationship edge is used to connect two nodes to represent that there is a social relationship between the two nodes; In each round of community division iteration, if the number of user IDs in the community in the community division result is not greater than a first threshold, all first nodes in the social relationship graph are replaced with a second node, wherein the first node is used to represent the user ID in the community, and the second node is used to represent the community; The preset condition includes that the total number of social relationship edges reduced in each round of community division iteration is less than or equal to a third threshold.

2. The community division method according to claim 1, characterized in that: The community division result also includes the relationship weights between any two user IDs in each community; The community division method further includes: For each community, the influence value of the user ID in the community is calculated based on the relationship weights between any two user IDs in the community.

3. The community division method according to claim 1, characterized in that: The preset condition includes that the number of user IDs in each community is not greater than a first threshold; and / or, The preset condition includes that the number of community division iterations is greater than or equal to a second threshold.

4. The community division method according to claim 1, characterized in that: Iterate community division for communities whose number of user IDs in the community division result is greater than a first threshold.

5. A community division system, characterized in that: The community division system includes: a social relationship edge acquisition module and a community division iteration module; The social relationship edge acquisition module is used to acquire social relationship edge data, wherein the social relationship edge data includes at least two user IDs and a relationship weight between two user IDs, wherein the relationship weight is used to characterize the intimacy of the relationship between the two user IDs; The community division iteration module is used to perform community division iteration based on the social relationship edge data using a community discovery algorithm, and obtain a community division result according to the maximum modularity gain between two user IDs, wherein the community division result includes the at least two user IDs and the community corresponding to each of the user IDs; The community division iteration module is also used to stop the community division iteration when the community division result reaches a preset condition; The community division system also includes: a social relationship graph generation module; The social relationship graph generation module is used to generate a social relationship graph based on the social relationship edge data, wherein the social relationship graph includes a plurality of nodes and social relationship edges, and the social relationship edge is used to connect two nodes to represent that there is a social relationship between the two nodes; The social relationship graph generation module is also used for replacing all first nodes in the social relationship graph with a second node in each round of community division iteration if the number of user IDs in the community in the community division result is not greater than a first threshold, wherein the first node is used to represent the user ID in the community and the second node is used to represent the community; The preset condition includes that the total number of social relationship edges reduced in each round of community division iteration is less than or equal to a third threshold.

6. The community division system according to claim 5, characterized in that: The preset condition includes that the number of user IDs in each community is not greater than a first threshold; and / or, The preset condition includes that the number of community division iterations is greater than or equal to a second threshold.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the community division method described in any one of claims 1 to 4 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the community division method described in any one of claims 1 to 4 are implemented.