Modularity maximization community discovery method and system based on attribute distance constraint
By introducing attribute distance thresholds and hierarchical iteration processes into community discovery using graph data, combined with outer-layer filtering and inner-layer pruning mechanisms, the problems of semantic inconsistency and high computational overhead in community discovery are solved. This enables the identification of communities with tight structures and similar attributes, improving algorithm efficiency and the semantic interpretability of the results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI JIAOTONG UNIV
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies struggle to effectively combine topological structure and attribute information in community discovery of attributed graph data, leading to semantic inconsistencies in community segmentation results. Furthermore, the computational overhead is excessive in high-dimensional attribute scenarios, impacting scalability.
We adopt a community discovery method based on attribute distance constraints to maximize modularity. By setting an attribute distance threshold and introducing a hierarchical iterative process, combined with local movement and aggregation stages, we use outer filtering and inner pruning mechanisms to quickly screen candidate communities and perform modularity gain and attribute distance feasibility verification to ensure the consistency of communities in terms of structure and semantics.
It effectively reduces the time complexity of community discovery algorithms, ensures that communities are tightly connected in network structure and highly similar in attribute characteristics, avoids forcibly dividing nodes with huge attribute differences, and improves the semantic interpretability of communities and the scalability of algorithms.
Smart Images

Figure CN122175573A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically, to a community discovery method and system based on attribute distance constraints to maximize modularity. Background Technology
[0002] With the rapid growth of complex network data such as social networks, collaborative networks, transaction networks, and biological networks, graph structures have become an important data model for characterizing entity relationships and interactions. In graph data mining and network analysis, community discovery aims to identify groups of nodes with tightly connected internal connections and relatively sparse external connections within the overall network to support structural understanding, pattern analysis, and downstream applications. Modularity, as one of the classic metrics for measuring the quality of community partitioning, is widely used to evaluate and drive the optimization of community partitioning results due to its strong interpretability and wide applicability. Maximizing modularity has therefore become one of the commonly used approaches to community discovery in practice.
[0003] In many real-world scenarios, networks consist of more than just topological connections; nodes often carry attribute information, such as user profiles, text content, business characteristics, or high-dimensional vector embeddings obtained through representation learning. In this type of attributed graph data, attribute information can provide crucial supplementary signals for the semantic consistency of communities: relying solely on topological structure for partitioning may result in structurally close but semantically inconsistent communities. Especially in systems focused on knowledge organization and retrieval, it is necessary to partition entity relationship graphs into more semantically consistent communities to facilitate further induction, summarization, and retrieval services. This makes the rational utilization of attribute information during community discovery a critical requirement.
[0004] For community discovery with attribute graphs, existing techniques fall into two categories. One category integrates attribute similarity into the optimization process within a modularity optimization framework, using methods such as joint objectives, regularization terms, or distance-aware expectation models to balance structural tightness and attribute consistency. However, since attribute homogeneity is often treated as a "soft incentive," these methods typically struggle to provide deterministic constraints guaranteeing the semantic consistency of the resulting communities. Another category emphasizes explicit attribute constraints. A typical example is not maximizing modularity, but rather combining dense subgraph structures (such as k-core) with attribute distance thresholds, using pruning strategies to extract dense subgraphs that satisfy the constraints or query-oriented communities. However, directly applying explicit attribute distance threshold constraints to the modularity iterative optimization process can generate a large amount of threshold feasibility verification and distance calculations in local iterations, especially in high-dimensional attribute scenarios, where the overhead is more pronounced, thus affecting scalability.
[0005] Patent CN117808616A discloses a community discovery method and system based on graph embedding and node affinity. This method aims to solve the problem of how to more accurately divide communities in unweighted, undirected social networks. Its technical solution adopts a three-stage paradigm of graph embedding, similarity calculation, and clustering. It does not directly optimize any community quality indicators, but proposes a weight allocation algorithm based on node degree product. The invention does not disclose the technical solution of using a hierarchical clustering framework based on maximizing modularity, which guides node movement and community merging by iteratively calculating modularity gain.
[0006] In summary, given the problems of the existing technologies, researching a community discovery method and system based on attribute distance constraints to maximize modularity has become a critical task that urgently needs to be addressed. Summary of the Invention
[0007] To address the shortcomings of existing technologies, the purpose of this invention is to provide a community discovery method and system based on attribute distance constraints that maximizes modularity.
[0008] A community discovery method based on maximizing modularity using attribute distance constraints, according to the present invention, includes the following steps:
[0009] Step S1: Obtain graph data with attributes, configure attribute vectors for each node in the graph, and set the attribute distance threshold r; Step S2, with modularity as the optimization objective, and the attribute distance threshold as the optimization target. As a constraint, the community is divided through a hierarchical iterative process, which includes a local movement phase and an aggregation phase. Step S3: Execute the local movement phase, traverse the nodes in the graph or the super nodes generated after aggregation, identify the communities to which the current node's neighbor nodes belong as candidate communities, perform outer filtering on the candidate communities, calculate the modularity gain generated by moving the current node to each candidate community for the candidate communities retained after outer filtering, perform attribute distance feasibility verification on the candidate migrations with positive modularity gains, and only execute node migration if the candidate migration satisfies both positive modularity gain and passes the attribute distance feasibility verification. Step S4: Perform the aggregation phase to aggregate the communities at the current level into super nodes and construct the attributed graph data for the next level. Step S5: Repeat the local movement phase and aggregation phase until the preset convergence condition is met, and output the community partitioning result that satisfies the attribute distance constraint.
[0010] Preferably, in step S3, the outer filtering process for the candidate communities includes: quickly filtering the candidate migration community set to remove candidate migrations that do not meet the distance attribute constraints; introducing a feasibility result reuse mechanism, establishing a cache space to store historical results of attribute distance feasibility verification for the candidate communities; for candidate migrations that have passed the initial screening, querying the pre-established cache space and performing cache reuse processing; for candidate communities that remain after quick filtering and cache reuse processing, calculating the modularity gain generated by moving the current node to each candidate community; sorting the candidate communities from high to low according to the modularity gain to form a priority queue, and triggering the feasibility verification of the candidate communities in sequence.
[0011] Preferably, for candidate migrations that have passed the initial screening, querying the pre-established cache space and performing cache reuse processing includes: if there is a historical verification record for the candidate community that has not expired in the cache space, then the cache result is directly reused; if the cache result is feasible, then the candidate migration can directly enter the subsequent modularity gain calculation and migration decision; if the cache result is infeasible, then the candidate migration is directly discarded without further processing; when the node composition in the candidate community changes in a way that would cause the cache to expire, the corresponding cache record is marked.
[0012] Preferably, in step S3, the feasibility verification of the candidate migration with positive modularity gain is performed by attribute distance, including: performing a fast boundary judgment on the candidate migration based on a preset vector boundary; when the fast boundary judgment cannot be directly judged, a double pivot boundary is introduced for further judgment; when the above two layers of pruning cannot determine feasibility, a precise distance calculation is performed.
[0013] Preferably, the step of quickly determining the candidate migration based on a preset vector limit includes: if it can be directly determined that the distance between all point pairs is less than or equal to r according to the preset vector limit, then it is directly marked as feasible, and the feasibility authentication result of the candidate migration is output; if it can be directly determined that there are point pairs with a distance exceeding r according to the preset vector limit, then it is directly marked as infeasible, and the feasibility authentication of the candidate migration is terminated.
[0014] Preferably, when the fast boundary judgment cannot be directly judged, a dual-pivot boundary is introduced for further judgment, including: if the upper boundary of the distance obtained based on the dual-pivot boundary is less than or equal to r, it is marked as feasible, and the feasibility authentication result of the candidate migration is output; if the lower boundary of the distance obtained based on the dual-pivot boundary is greater than r, it is marked as infeasible, and the feasibility authentication of the candidate migration is terminated.
[0015] Preferably, step S4 includes: when the local movement phase iterates to a stable state, shrinking each currently divided community into a super node to obtain a new aggregated graph, wherein the stable state means that further migration cannot bring about modularity improvement or there is no migration that can be verified for feasibility; constructing the edge relationships of the new aggregated graph, summarizing the edges between different communities in the original graph into the edges between super nodes in the new graph, and summarizing the edges within communities in the original graph into the self-loops of super nodes in the new graph; using the new graph as the input for the next iteration, continuing to execute the local movement and aggregation process on a coarser-grained representation.
[0016] This invention also provides a community discovery system based on attribute distance constraints that maximizes modularity, the system comprising: The data acquisition module is used to acquire graph data with attributes, configure attribute vectors for each node in the graph, and set attribute distance thresholds. ; The community segmentation module is used to optimize based on modularity and the distance threshold of the aforementioned attributes. As a constraint, the community is divided through a hierarchical iterative process, which includes a local movement phase and an aggregation phase. The local migration module, built into the community partitioning module, is used to execute the local migration phase. It traverses the nodes in the graph or the super nodes generated after aggregation, identifies the communities to which the current node's neighbor nodes belong as candidate communities, performs outer filtering on the candidate communities, calculates the modularity gain generated by moving the current node to each candidate community for the candidate communities retained after outer filtering, performs attribute distance feasibility verification on the candidate migrations with positive modularity gain, and executes node migration only when the candidate migration satisfies both positive modularity gain and passes the attribute distance feasibility verification. The aggregation module, built into the community segmentation module, is used to execute the aggregation phase, aggregating the communities at the current level into super nodes and constructing attributed graph data for the next level. The iterative control module is used to repeatedly execute the local movement phase and the aggregation phase until the preset convergence condition is met, and output the community partitioning result that satisfies the attribute distance constraint.
[0017] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described community discovery method based on attribute distance constraints for maximizing modularity.
[0018] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the above-described community discovery method based on attribute distance constraints for maximizing modularity.
[0019] Compared with the prior art, the present invention has the following beneficial effects: This invention introduces an attribute distance threshold as a hard constraint into the modularity optimization process, overcoming the limitation of traditional community discovery that only focuses on topological structure while ignoring node attributes. This is achieved by setting a clear attribute distance threshold. This ensures that the identified communities are not only tightly connected in terms of network structure but also highly similar in terms of attribute characteristics. This "double standard" makes the mined communities more semantically interpretable and effectively avoids the phenomenon of forcibly classifying nodes with huge attribute differences into the same community.
[0020] This invention addresses the technical pain point of excessive computational cost in "all-to-all" distance calculations in community discovery with attribute constraints. It innovatively designs a two-layer acceleration mechanism of "outer filtering + inner pruning": Before verification, a coarse-grained screening of candidate communities quickly eliminates obviously unsuitable migrations, significantly reducing the number of candidates entering the substantive verification stage. Then, a hierarchical strategy of "boundary determination first, followed by precise distance backoff" is adopted, particularly by introducing a dual-pivot boundary technique to construct tighter upper and lower bounds on the distance. This allows the algorithm to skip unnecessary computational steps without changing the objective function of modularity optimization or relaxing attribute constraints. In most cases, feasibility can be confirmed solely by extremely low-cost boundary determination, thus avoiding a large amount of expensive high-dimensional attribute vector precise distance calculation and significantly reducing the algorithm's time complexity. Attached Figure Description
[0021] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart of the community discovery method based on attribute distance constraints for maximizing modularity according to the present invention.
[0022] Figure 2 This is a schematic diagram illustrating the working process of the community discovery method based on attribute distance constraints for maximizing modularity in an embodiment of the present invention.
[0023] Figure 3 This is a schematic diagram of the outer filter structure in this invention.
[0024] Figure 4 This is a schematic diagram of the two-stage hierarchical iterative optimization algorithm based on modularity gain in this invention.
[0025] Figure 5 This is a schematic diagram of the outer layer filtering algorithm in this invention.
[0026] Figure 6 This is a schematic diagram of the pivot selection method for the double pivot boundary in this invention.
[0027] Figure 7 This is a schematic diagram illustrating an example of DBLP analysis in an embodiment of the present invention.
[0028] Figure 8 This is a schematic diagram illustrating the community identification under different algorithms and parameters in the DBLP example analysis provided in this embodiment of the invention.
[0029] Figure 9 This diagram illustrates the number of precise distance calculations for all datasets provided in this embodiment of the invention.
[0030] Figure 10 This diagram illustrates the total time taken for community discovery across all datasets provided in this embodiment of the invention. Detailed Implementation
[0031] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0032] Figure 1 The flowchart below shows the community discovery method based on attribute distance constraints for maximizing modularity of graph data according to the present invention. The method aims to achieve efficient modularity optimization of graph data while satisfying attribute distance constraints within the community. The specific steps are as follows: Step 1: Determining modeling and optimization objectives, specifically including: First, the graph data to be analyzed is acquired, which includes a set of nodes and their connections, and attribute information associated with at least some nodes. The attribute information can be user features, text representations, business features, or vector embeddings obtained through representation learning. Then, an attribute distance threshold is set to characterize the attribute consistency constraints within the community. The feasibility of the community is defined as: the attribute distance between nodes within the community satisfies the threshold constraint, thereby providing a clear constraint on the semantic consistency within the community. Finally, under the premise of satisfying the above attribute distance constraints, modularity is determined as the quality evaluation index for community partitioning, and the entire graph is partitioned into communities with the goal of optimizing modularity.
[0033] Common symbol definitions are shown in Table 1. In this embodiment, the network data to be analyzed is modeled as an undirected graph with attributes. .in, For a set of nodes, Indicates the number of nodes. Let be the set of edges. Indicates the number of edges. Represents a collection of node attributes. Each node Mapped to its attribute vector The attribute vector dimension is ,Right now .
[0034] Table 1 Commonly Used Symbols
[0035] In this embodiment, the distance between node attributes is represented by Euclidean distance, denoted as . Its definition is ,in This represents the Euclidean norm. The attribute vectors do not require pre-normalization; in a common representation learning scenario, if the attribute vectors are... With norm-normalized embeddings, Euclidean distance and cosine similarity are equivalent under monotonic transformation; therefore, the constraint modeling in this embodiment can also be applied to this type of embedding representation. A "community" is defined as a subset of the node set. , Representing community size. The result of partitioning the entire graph is represented as a set of communities. , It consists of and covers several non-overlapping communities. That is, each node belongs to exactly A community within it.
[0036] In this embodiment, modularity is used. As a quality metric for community partitioning, modularity characterizes the degree of deviation of the proportion of internal connections within a community from a randomly distributed graph with similar degree. The calculation formula is as follows:
[0037] in, For the adjacency matrix in The value at that location, For nodes The degree, exist and The value is 1 if the members belong to the same community, and 0 otherwise. Furthermore, to provide a deterministic constraint on semantic consistency within a community, an attribute distance threshold is introduced. and define Constraining a community: if and only if the community Any two nodes inside satisfy At that time, the community was referred to as Restricting the community.
[0038] Based on the above definition, the attribute distance-constrained modularity optimization community discovery problem considered in this embodiment can be described as: given an attribute graph With threshold In all coverage community collection In the middle, seeking to make "every community a Under the condition of "constrained community", modularity The community partitioning result that achieves the maximum value.
[0039] For example Figure 2 In this embodiment, a network with 10 points is presented for demonstration purposes. Assuming that the attributes of the points in this network reside in a two-dimensional space, without applying an attribute distance threshold constraint, the modularity maximization method will yield two communities as shown in the left figure. However, with the application of an attribute distance threshold constraint (e.g., ...), the modularity maximization method will result in two communities. After that, in order to ensure that the distance between any two nodes does not exceed the threshold within each community, the result of modularity optimization becomes more and more detailed community divisions, as shown in the right figure, forming four communities.
[0040] Step 2: Two-stage hierarchical iterative optimization based on modularity gain.
[0041] In this embodiment, based on the "attribute distance threshold constraint + modularity optimization objective" determined in step 1, a hierarchical iterative two-stage process is used to optimize the community partitioning of the entire graph. The two-stage process includes a "local movement stage" and an "aggregation stage," and is repeated at multiple levels until the termination condition is met. After the aggregation process, nodes will form super nodes. The nodes mentioned below can refer to the original nodes or the super nodes formed after aggregation.
[0042] (1) During the local migration phase, for a node or a super node obtained by aggregation from the previous layer, construct a set of candidate communities that can be migrated, and evaluate the migration benefit based on the modularity gain; only when the migration brings improvement in modularity and satisfies the attribute distance threshold constraint described in step 1, the corresponding migration is performed and the current partition is updated.
[0043] In this embodiment, during initialization, each node can be treated as an initial community. Subsequently, using nodes as the basic migration targets, candidate communities to which they may migrate are evaluated. Candidate communities are preferably constructed from the communities of their topologically adjacent nodes to ensure locality of the migration evaluation. During the evaluation process, the modularity gain that migration to each candidate community may bring is calculated, denoted as . The migration target is selected based on the candidate with the better modularity gain. For any candidate migration, its feasibility is verified by an attribute distance threshold before submission: only migrations that simultaneously satisfy both the "modularity improvement condition" and the "..." The migration and current partitioning are only executed when "feasibility conditions are met"; otherwise, the migration is not executed and other candidates are evaluated. It should be noted that this embodiment introduces outer filtering in step 3 and inner filtering in step 4 for the feasibility certification process during the local movement phase, in order to reduce certification overhead without changing the feasibility certification conclusion.
[0044] (2) In the aggregation phase, the local movement phase iterates to a stable state, that is, after further migration cannot bring about modularity improvement or there is no migration that can be verified for feasibility, each community obtained by the current partitioning is shrunk into a super node, resulting in a new graph after aggregation, and this new graph is used as the input for the next layer of iteration. The edge relationships of the new graph after aggregation can be obtained by summing the edges between different communities in the original graph, including self-loops formed by edges between communities and edges within communities, so that the next layer of iteration can continue to perform the local movement and aggregation process on a coarser-grained representation.
[0045] (3) Repeat the above hierarchical iterative process of "local movement phase + aggregation phase" until the termination condition is met, such as when the modularity no longer increases or the iteration reaches a stable state, and output the final community partitioning result. Since the distance constraint feasibility verification is completed before each migration, the output community partitioning satisfies the attribute distance threshold constraint described in step 1.
[0046] Step 3: To reduce the number of candidates that need to be verified for attribute distance constraints during local migration, an outer filtering process is performed on the candidate migration communities.
[0047] Specifically, this includes: generating a candidate migration community set based on nodes / super nodes and their adjacency relationships, and quickly filtering out candidates to avoid performing subsequent verification on candidates that are obviously unlikely to meet constraints or have no optimization significance; then introducing a feasibility result reuse mechanism to cache historical verification results and reuse cached results when no changes occur in the candidate community that affect the feasibility judgment, thereby reducing duplicate verification; prioritizing the screened candidate communities according to modularity gain and triggering feasibility verification in priority order to find a migratable target or determine that there is no feasible migration with as few verifications as possible.
[0048] In this embodiment, outer filtering is used to filter the current supernode without performing or with minimal high-dimensional attribute distance calculations. Move to a neighboring community This candidate operation performs a rapid screening, and candidates that still need further judgment are handed over to the inner filtering process in step 4.
[0049] The structure of the outer filter is as follows Figure 3 As shown, the algorithm flow for steps 2 and 3 is as follows: Figure 4 and Figure 5 The outer layer of filtering includes the following mechanisms: (1) Feasibility caching and reuse. This differs from caching and reuse for each access. The approach of temporarily reconstructing neighboring community sets from their adjacent supernodes is implemented in this way, with each supernode... Maintain a "super node - community adjacency" structure: record Adjacent community sets And in each pair Save on Item With community The aggregated edge weight information between them, and " Merging The historical judgment results and logical timestamps for "whether the attribute distance threshold constraint is met" are used. When community members change, the logical timestamps are used to determine whether the cache is still valid: if the historical judgment is "not met", the conclusion is still valid if no members are deleted from the target community; if the historical judgment is "met", the conclusion is still valid if no new members are added to the target community. Candidate communities that are cached and "not met" can be directly discarded; candidate communities that are cached and "met" can skip the feasibility judgment by only calculating the modularity gain, thereby reducing the overhead of repeated checks.
[0050] (2) Pruning and cache initialization based on edge distance summary. Since candidate moves will only... The node moves to the community of its adjacent supernodes, and since the aggregated edges between supernodes can correspond to multiple original edges, the attribute distance of the endpoints of the original edges can serve as a strong signal for fast rejection. This implementation checks each original edge when reading graph data. Pre-calculate the attribute distance and assign it to each supernode-supernode edge on each level of the hierarchy graph. Maintain a distance summary , which means and The maximum distance between all original edge endpoints; if Exceeding the threshold Then any simultaneously containing and The community will inevitably violate distance constraints. At the beginning of each round of local movement phase, all supernode-supernode edges can be scanned. If the threshold is exceeded, the corresponding... The symmetric terms are written into the cache record of "not satisfied" and reused in subsequent iterations according to the above cache validity rules, thereby pruning a batch of impossible target communities at a lower cost.
[0051] (3) Inertial candidate checking order based on modularity gain. Given that distance feasibility determination at higher levels is usually significantly more important than modularity gain calculation, this implementation method calculates the modularity gain of the remaining candidate communities based only on the aggregated edge weights after completing "cache pruning + edge summary pruning", and retains candidates with positive gains; then, a max heap is constructed with modularity gain as the key, and candidate communities are taken out in descending order of gain for judgment: candidates that are valid for cache and "satisfied" can be directly accepted; for candidates that cannot be directly judged by the outer layer, the inner layer filtering in step 4 is called to verify the distance constraint; once the first feasible candidate is found, the remaining low-gain candidates are stopped from being checked, so as to avoid making a lot of expensive judgments on "target communities that will not be selected in the end".
[0052] Step 4: When performing attribute distance threshold feasibility verification on a candidate migration, an inner filtering mechanism is used to reduce the number of times high-dimensional distance is accurately calculated.
[0053] Specifically, this includes: First, a rapid boundary determination is performed during the verification process: based on pre-maintained or pre-processed distance-related boundary information, the feasibility of candidate migrations is judged as either "directly satisfying the constraints" or "directly not satisfying the constraints"; when the rapid boundary cannot be directly determined, a dual-pivot boundary is introduced for further pruning: by selecting a pivot and pre-processing pivot-related information, the dual-pivot boundary is used during the verification phase to more tightly define the possible attribute distance range within the community, thereby eliminating infeasible cases without precise distance calculation; precise distance calculation is performed only for a small number of cases that still cannot be determined by the above boundary to complete feasibility verification; after completing feasibility verification, the modularity gain determination in step 2 is combined to determine whether to perform migration, thereby ensuring that the final output community partitioning meets the attribute distance threshold constraints described in step 1.
[0054] In this embodiment, step 4 is used to select "candidate moves". → The inner feasibility verification process checks whether the attribute distance threshold constraint is met. If the outer filtering in step 3 cannot directly determine feasibility (or the cache is not reusable), the inner feasibility verification subroutine is called to process the candidate set after merging. Is it Constraints are used for authentication. The inner layer filtering adopts a hierarchical strategy of "first determining the boundary, then calculating the exact distance" to minimize the number of calculations for high-dimensional exact distances.
[0055] (1) Rapid determination of vector boundaries. The inner feasibility verification first performs rapid filtering of the point pairs to be checked based on vector boundaries: for candidate node pairs attribute vector Vector pruning is performed before calculating the exact Euclidean distance. This is done using the squared distance expansion formula. And use Hölder's inequality Give upper and lower bounds for the inner product terms, so that... Time intervals are obtained from the squared distance intervals. Required statistics During graph reading, pre-calculation and storage can be performed in one pass without changing the time complexity of the graph reading stage. Cases that can be directly determined by the boundary to "inevitably violate the threshold constraint" are directly returned as infeasible; cases that can be directly determined by the boundary to "inevitably satisfy the threshold constraint" are directly passed; only uncertain point pairs that cannot be covered by the boundary are retained for subsequent processes.
[0056] (2) Double pivot boundaries are used as backsliding pruning. Record the nodes. The attribute vector is ,node The attribute vector is And so on. For point pairs that still cannot be determined by vector boundaries, this implementation further introduces double pivot boundaries for backtracking pruning: within a given attribute space, two pivot points... (forming the pivot axis) When ), for any two points It can be based on five pivot distance scalars ,in, , , , , By using the law of cosines, we can obtain the scalar projection of two points along the pivot axis. , Define rotation invariants and vertical radius. Then the square of the distance between the two points satisfies the following double pivot upper and lower bounds: . and Relying solely on the five scalars mentioned above, it is possible to This is obtained within a time period. Therefore, for the threshold... This can be used to make a judgment: if If, then that point necessarily violates the constraint; if If the condition is met, then the point pair must satisfy the constraint; otherwise, it remains uncertain, and the process proceeds to precise distance calculation.
[0057] (3) Precise distance calculation rollback. This is only performed on the retained point pairs when neither the vector limit nor the double pivot limit can provide a definite conclusion. 3D precise distance calculation, and complete the selection of candidate moves based on the precise calculation results. Feasibility verification. This process is equivalent to "replacing precise distance calculations with boundaries as much as possible without changing the feasibility assessment conclusion," thereby significantly reducing the number of precise distance assessments in practice.
[0058] (4) Pivot initialization and pivot selection, such as Figure 6 As shown, to enable efficient evaluation of the dual-pivot limits, this implementation allows for a one-time initialization: performing an initialization on the node attribute vectors. Clustering is used to obtain a set of pivot centers, and the distance from each node to each pivot center is pre-calculated, thus enabling the evaluation of the bipivot bound on any pair of points to be achievable. Time; this pre-computation depends only on the attribute vector and the selected pivot, and the threshold. It is irrelevant; it can be done at different levels and in different ways. Value reuse. For a given pair of points. The center of each of their respective clusters can be selected as the... and with As a pivot axis.
[0059] The following is an example analysis and efficiency verification of this embodiment: The DBLP co-authorship network is selected as the example dataset, and a local subgraph of a certain central author is constructed to intuitively show the community division effect. The experimental dataset is shown in Table 2. Nodes represent authors, edges represent co-authorship relationships, and node attributes are vector representations generated from the author's relevant paper text information.
[0060] Table 2 Experimental Dataset Information
[0061] Based on this example subgraph, we will explore the scenarios with no attribute distance constraints and with different attribute distance thresholds. In the case of [specific circumstances], the method of this invention is run to obtain the corresponding community segmentation results. For example... Figure 7 As shown, the attribute-free distance constraint method groups scholars with inconsistent research fields into the same community, but the constraint method divides them into two communities that primarily study computer vision and data mining, respectively. Figure 8 As shown, with the attribute distance threshold As the classification becomes increasingly tighter, the results show a more pronounced trend of refinement: the overall size of the communities decreases, and the consistency of attributes within the communities is enhanced. At the same time, compared with unconstrained or soft fusion methods based solely on attribute similarity, this invention can further decompose the originally larger communities into multiple sub-communities with more consistent themes under explicit distance threshold constraints, thus better meeting the community identification requirements of "tight structure and semantic consistency".
[0062] To verify the computational efficiency of this invention in the scenario of "attribute distance threshold constraint + modularity optimization", two types of indicators can be statistically analyzed on multiple datasets: one is the number of precise attribute distance calculations triggered during the community segmentation process, and the other is the total running time to complete the community segmentation.
[0063] The comparison results are as follows Figure 9 , Figure 10 As shown, the method of this invention exhibits fewer precise distance calculations across different datasets, resulting in a lower overall runtime; this advantage is even more pronounced on large-scale graphs with high attribute dimensions. Furthermore, with increasing distance thresholds... With gradual relaxation of restrictions, candidate moves are more difficult to reject early, and the number of accurate distance calculations and running time for various methods generally show an upward trend; however, in different... Under the given conditions, the method of this invention can still maintain a lower computational cost for accurate distance calculations and achieve shorter runtime in most cases. On some large-scale datasets, the comparison method failed to complete within the preset time limit, while the method of this invention can complete and output community partitioning results that meet the distance threshold constraints, thus demonstrating better scalability.
[0064] This invention also provides a community discovery system based on attribute distance constraints to maximize modularity. This system can be implemented by executing the steps of the method for maximizing modularity based on attribute distance constraints. That is, those skilled in the art can understand the method for maximizing modularity based on attribute distance constraints as a preferred embodiment of the system. The system includes: The data acquisition module is used to acquire graph data with attributes, configure attribute vectors for each node in the graph, and set attribute distance thresholds. ; The community segmentation module is used to optimize based on modularity and attribute distance thresholds. As a constraint, the community is divided through a hierarchical iterative process, which includes a local movement phase and an aggregation phase. The local migration module, built into the community partitioning module, is used to perform the local migration phase. It traverses the nodes in the graph, identifies the communities to which the current node's neighboring nodes belong as candidate communities, and calculates the modularity gain resulting from moving the current node to each candidate community. For candidate migrations with positive modularity gains, it performs attribute distance feasibility verification. Attribute distance feasibility verification requires that the attribute distance between the current node (or every node contained in the supernode) and every node in the candidate community does not exceed a threshold. Node migration is performed only if the candidate migration simultaneously satisfies a positive modularity gain and passes attribute distance feasibility verification. The aggregation module, built into the community segmentation module, is used to perform the aggregation phase, aggregating the communities at the current level into super nodes and constructing attributed graph data for the next level. The iterative control module is used to repeatedly execute the local movement phase and the aggregation phase until the preset convergence condition is met, and output the community partitioning result that satisfies the attribute distance constraint.
[0065] Those skilled in the art will understand that, besides implementing the system and its various devices, modules, and units provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, making the system and its various devices, modules, and units of this invention function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices, modules, and units provided by this invention can be considered as a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices, modules, and units for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0066] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A community discovery method based on maximizing modularity using attribute distance constraints, characterized in that, include: Step S1: Obtain graph data with attributes, configure attribute vectors for each node in the graph, and set attribute distance thresholds. ; Step S2, with modularity as the optimization objective, and the attribute distance threshold as the optimization target. As a constraint, the community is divided through a hierarchical iterative process, which includes a local movement phase and an aggregation phase. Step S3: Execute the local movement phase, traverse the nodes in the graph or the super nodes generated after aggregation, identify the communities to which the current node's neighbor nodes belong as candidate communities, perform outer filtering on the candidate communities, calculate the modularity gain generated by moving the current node to each candidate community for the candidate communities retained after outer filtering, perform attribute distance feasibility verification on the candidate migrations with positive modularity gains, and only execute node migration if the candidate migration satisfies both positive modularity gain and passes the attribute distance feasibility verification. Step S4: Perform the aggregation phase to aggregate the communities at the current level into super nodes and construct the attributed graph data for the next level. Step S5: Repeat the local movement phase and aggregation phase until the preset convergence condition is met, and output the community partitioning result that satisfies the attribute distance constraint.
2. The community discovery method based on attribute distance constraints for maximizing modularity according to claim 1, characterized in that, In step S3, an outer filtering process is performed on the candidate communities, including: The candidate migration community set is quickly screened out to remove candidate migrations that do not meet the distance attribute constraint; A feasibility result reuse mechanism is introduced, and a cache space is established to store historical results of attribute distance feasibility verification for the candidate communities. For candidate migrations that pass the initial screening, query the pre-established cache space and perform cache reuse processing; For candidate communities that remain after fast filtering and cache reuse, calculate the modularity gain generated by moving the current node to each candidate community; Based on the modularity gain, the candidate communities are sorted from high to low to form a priority queue, and the feasibility verification of the candidate communities is triggered sequentially.
3. The community discovery method based on attribute distance constraints for maximizing modularity according to claim 2, characterized in that, The step of querying the pre-established cache space and performing cache reuse processing for candidate migrations that have passed the initial screening includes: If there is a valid historical verification record for the candidate community in the cache space, the cache result is reused directly. If the cache result is feasible, the candidate migration can directly enter the subsequent modularity gain calculation and migration decision. If the cache result is not feasible, the candidate migration is discarded directly without further processing. When changes occur in the node composition of a candidate community that would invalidate the cache, the corresponding cache record is marked.
4. The community discovery method based on attribute distance constraints for maximizing modularity according to claim 1, characterized in that, In step S3, attribute distance feasibility verification is performed on the candidate migrations with positive modularity gain, including: The candidate migration is quickly determined based on a preset vector limit. When the fast limit judgment cannot be directly determined, a double pivot limit is introduced for further judgment. If the feasibility of pruning at both of the above levels cannot be determined, perform precise distance calculation.
5. The community discovery method based on attribute distance constraints for maximizing modularity according to claim 4, characterized in that, The method of quickly determining the boundary of the candidate migration based on a preset vector boundary includes: If it can be directly determined that the distance between all point pairs is less than or equal to r based on the preset vector limit, then it is directly marked as feasible, and the feasibility verification result of the candidate migration is output. If, based on the preset vector limits, it can be directly determined that there are point pairs whose distance exceeds r, then they are directly marked as infeasible, and the feasibility verification of the candidate migration is terminated.
6. The community discovery method based on attribute distance constraints for maximizing modularity according to claim 4, characterized in that, When the rapid boundary judgment cannot be directly determined, a dual-pivot boundary is introduced for further judgment, including: If the upper bound of the distance obtained based on the dual-pivot limit is less than or equal to r, it is marked as feasible, and the feasibility verification result of the candidate migration is output. If the lower bound of the distance obtained based on the dual-pivot limit is greater than r, it is marked as infeasible, and the feasibility verification of the candidate migration is terminated.
7. The community discovery method based on attribute distance constraints for maximizing modularity according to claim 1, characterized in that, Step S4 includes: When the local movement phase iterates to a stable state, each community obtained from the current division is shrunk into a super node, resulting in a new aggregated graph. The stable state refers to a state where further migration cannot bring about modularity improvement or there is no migration that can be verified for feasibility. Construct the edge relationships of the new graph after aggregation, and summarize the edges between different communities in the original graph into the edges between super nodes in the new graph, and summarize the edges within communities in the original graph into the self-loops of super nodes in the new graph. Using the new graph as input for the next iteration, the local movement and aggregation process continues on a coarser-grained representation.
8. A community discovery system based on maximizing modularity using attribute distance constraints, characterized in that, include: The data acquisition module is used to acquire graph data with attributes, configure attribute vectors for each node in the graph, and set attribute distance thresholds. ; The community segmentation module is used to optimize based on modularity and the distance threshold of the aforementioned attributes. As a constraint, the community is divided through a hierarchical iterative process, which includes a local movement phase and an aggregation phase. The local migration module, built into the community partitioning module, is used to execute the local migration phase. It traverses the nodes in the graph or the super nodes generated after aggregation, identifies the communities to which the current node's neighbor nodes belong as candidate communities, performs outer filtering on the candidate communities, calculates the modularity gain generated by moving the current node to each candidate community for the candidate communities retained after outer filtering, performs attribute distance feasibility verification on the candidate migrations with positive modularity gain, and executes node migration only when the candidate migration satisfies both positive modularity gain and passes the attribute distance feasibility verification. The aggregation module, built into the community segmentation module, is used to execute the aggregation phase, aggregating the communities at the current level into super nodes and constructing attributed graph data for the next level. The iterative control module is used to repeatedly execute the local movement phase and the aggregation phase until the preset convergence condition is met, and output the community partitioning result that satisfies the attribute distance constraint.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the community discovery method based on attribute distance constraints for maximizing modularity as described in any one of claims 1 to 7.
10. 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 computer program is executed by a processor, it implements the steps of the community discovery method based on attribute distance constraints for maximizing modularity as described in any one of claims 1 to 7.
Citation Information
Patent Citations
CN117808616A