Non-enhancement dynamic community detection method based on comparative learning

By using a snapshot network of adjacent time steps as an enhancement view in graph comparison learning and introducing an unaligned neighbor comparison loss function, the challenges of graph enhancement and comparison goals in the prior art are solved, and efficient and robust dynamic community detection is achieved.

CN119598343APending Publication Date: 2025-03-11NORTHWEST NORMAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411664556.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The existing graph comparison learning technology faces two main challenges: graph enhancement and comparison goals. The manual enhancement method is sensitive to different graph data sets, limiting the efficiency and generalization of the method.

Method used

Two snapshot networks with adjacent time steps are used as enhanced views in the contrast learning framework, positive and negative sample pairs are constructed by pair sampling, the temporal properties and inherent data of the evolutionary graph are captured, and an unaligned neighbor comparison loss function is introduced.

Benefits of technology

The complex data augmentation process is eliminated, and the original semantic information in the network is accurately retained, the accuracy and robustness of community detection is improved, and the model's generalization ability on unseen data is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119598343A_ABST
    Figure CN119598343A_ABST
Patent Text Reader

Abstract

The invention discloses a non-enhanced dynamic community detection method based on comparative learning, and the method comprises the steps: carrying out the paired sampling of T snapshot networks in a dynamic network sequence according to a sequence through a non-enhanced dynamic community detection model DyCD-CL constructed by the method, constructing a network group vector with T-1 groups of comparative combinations, and after the two snapshot networks of each group of comparison combination are respectively coded by adopting an encoder network, the community membership between each snapshot network and the community center matrix of the snapshot network is calculated, and then a better community membership is taken as a community detection result of the snapshot network. According to the method, two snapshot networks of adjacent time steps are used as enhanced views in a contrast learning framework, and a non-aligned neighbor contrast loss function is introduced to maximize the similarity between a positive sample pair and a minimum negative sample pair; the accuracy and robustness of dynamic community detection through the non-enhanced dynamic community detection model DyCD-CL are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of complex networks, and in particular to a non-enhancement dynamic community detection method based on contrastive learning. Background Art

[0002] In complex network big data, the research on community detection methods involves interdisciplinary subjects such as sociology, biology, and computer science, and has broad application prospects. For example, in social networks, communities can represent friends, families, or interest-based clusters. In biological networks, communities may correspond to genomes with similar functions or proteins involved in the same biological pathways. Therefore, a deep understanding of the structure and organizational form of various complex networks is of great significance for understanding information propagation, network dynamics, and node behavior.

[0003] At present, traditional community detection methods mainly divide communities based on local or global information of graphs. Among them, the graph partitioning-based method divides communities by maximizing the internal connections within the community and minimizing the connections between communities. The spectral clustering-based method divides nodes into different communities by eigendecomposing the Laplacian matrix of the network. These methods can meet the needs of community detection to a certain extent, but there are often some challenges when facing complex social networks.

[0004] Contrastive Learning (CL) has recently revolutionized representation learning in computer vision by making unsupervised models perform on par with supervised models on several tasks. This visual contrastive learning (VCL) framework maximizes the similarity between input augmentations (positive views) while minimizing the similarity to other samples in the batch (negative views). Several theoretical and empirical studies attribute the success of VCL to two key principles: 1) training on large and diverse datasets, and 2) leveraging powerful, task-relevant augmentations. Inspired by the success of VCL and motivated by the scarcity of labels in graph applications, graph contrastive learning (GCL) has become an increasingly popular unsupervised graph representation learning technique. It is a method for learning the similarity between nodes and graphs in graph-structured data by contrasting positive samples with negative samples so that nodes or graphs with similar features are closer in the embedding space. By definition, graph contrastive learning is a self-supervised learning method that does not rely on annotated labels but instead uses the characteristics of the data itself to learn.

[0005] At present, the challenges faced by graph contrastive learning techniques mainly stem from two aspects: graph enhancement and contrastive objectives. As the key to the self-supervised learning paradigm, graph enhancement can help the model to mine deeper semantic information of the graph. In the typical GCL framework, the first step is to generate a graph enhancement view with differences through various graph enhancements. For example, DGI enhances the original graph by transforming node attributes row by row. GRACE corrupts the graph by uniformly removing edges and masking attributes. To improve GRACE, GCA adaptively removes edges and masks attributes by assigning different probabilities based on centrality heuristics. MVGRL enhances the input graph through graph diffusion and generates local and global structural views. GraphCL proposes four types of graph enhancements, including node descent, edge perturbation, attribute masking, and subgraph. However, due to the different properties of graphs, the above manual enhancements have been shown to be sensitive to different graph datasets, thus limiting the efficiency and generalizability of GCL methods. Summary of the invention

[0006] In view of the above-mentioned deficiencies of the prior art, the present invention provides a non-enhancement dynamic community detection method based on contrastive learning, which realizes accurate dynamic community detection by using two snapshot networks of adjacent time steps as enhanced views in a contrastive learning framework.

[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0008] A non-enhancement dynamic community detection method based on contrastive learning comprises the following steps:

[0009] S1. Obtain the dynamic network sequence to be detected;

[0010] S2, input the dynamic network sequence to be detected into the trained non-enhanced dynamic community detection model DyCD-CL, and output the community detection result of the dynamic network sequence to be detected;

[0011] The training process of the non-enhanced dynamic community detection model DyCD-CL is as follows:

[0012] S201, obtain a dynamic network sequence G as a training sample = {G 1 ,G 2 ,…,G T}, as the input for training the unenhanced dynamic community detection model DyCD-CL; where G t ={A t ,X t} is the snapshot network at time step t, X t and A t Respectively represent the snapshot network G at time step t tThe feature matrix and adjacency matrix of , t=1,2,…,T, T represents the total time step; the community structure of the dynamic network sequence G is expressed as is the t-th snapshot network G t i communities, i = 1, 2, ..., K, K is the number of communities in the snapshot network;

[0013] S202, the unenhanced dynamic community detection model DyCD-CL samples T snapshot networks in the input dynamic network sequence G in pairs in sequence, and constructs a set of T-1 contrast combinations {G t ,G t+1} network group vector C:

[0014] C={{G 1 ,G 2},{G 2 ,G 3},......,{G T-1 ,G T}};

[0015] S203, the unenhanced dynamic community detection model DyCD-CL compares each group of combinations {G t ,G t +1 The two snapshot networks of} are encoded by the encoder network respectively, and each comparison combination {G t ,G t+1} corresponds to the node representing the matrix combination {Z t ,Z t+1}, Z t , Z t+1 Represent the snapshot network G t , G t+1 The nodes of represent the matrix;

[0016] S204, the non-enhanced dynamic community detection model DyCD-CL for any t-th group comparison combination {G t ,G t+1}, calculate the two node representation matrices Z respectively t , Z t+1 Each of them is the snapshot network G at time step t t Community Center Matrix T t The community affiliation of , and then take the better one as the snapshot network G at time step t+1 t+1 The community detection result; the snapshot network G at the time step t t Community Center Matrix T t is the snapshot network G at time step t. tThe community centers of each community in G are used as the matrix of elements; thus, the unenhanced dynamic community detection model DyCD-CL obtains the dynamic network sequence G in G 2 ,…,G T The community detection results of these T-1 snapshot networks are used as the community detection results of the dynamic network sequence G;

[0017] S205, using a total loss function consisting of a community snapshot cost loss and a community non-aligned neighbor comparison loss, calculating the training loss of the non-enhanced dynamic community detection model DyCD-CL, and updating the parameters of the non-enhanced dynamic community detection model DyCD-CL with the goal of minimizing the total loss;

[0018] S206: Repeat steps S201 to S205 until the unenhanced dynamic community detection model DyCD-CL converges or reaches a preset number of training times, and the training is completed.

[0019] As a preferred solution, in step S203, the encoder network adopts a graph convolutional network.

[0020] As a preferred solution, for the snapshot network G at any time step t t , use graph convolutional network for encoding, and get the node representation matrix Z corresponding to the time step t The specific method is:

[0021] The snapshot network G at time step t t The feature matrix X t Initialize the node representation matrix, then update the node representation matrix through a multi-layer graph convolution network. Finally, after L layers of graph convolution operations, the final node representation matrix Z is obtained. t ;

[0022] The specific process is expressed as:

[0023]

[0024] L represents the number of layers of the graph convolutional network;

[0025] in, represents the output of the initial layer graph convolutional network, Represents the snapshot network G of the l-th layer graph convolutional network at time step t t The corresponding nodes represent matrices, represents the node feature matrix as the output of the l+1th layer after the lth layer of graph convolutional network, σ(·) represents the activation function, represents the snapshot network G at time step t t The normalized adjacency matrix is I is the identity matrix; represents the normalized adjacency matrix degree matrix, W (l) represents the trainable transformation matrix of layer l, Represents the node representation matrix after L layers of graph convolution operations.

[0026] As a preferred solution, in step S204, the snapshot network G at any time step t is calculated. t The corresponding node represents the matrix Z t Matrix T with community center t The specific forms of community affiliation are:

[0027] For the first set of contrast combinations {G 1 ,G 2}, that is, when t = 1, the randomly initialized community center matrix T1 is used to calculate the community affiliation; for any other group comparison combination {G t ,G t+1}, that is, when t = 2, 3, ..., T, the snapshot network G at time step t obtained by community detection using the t-1th group of comparison combinations t The community center matrix T corresponding to the community detection result t Perform calculations of community affiliations.

[0028] As a preferred solution, in step S204, for any t-th comparison combination {G t ,G t+1}, community affiliation is calculated as:

[0029] R t =normalize(δ(Z t ,T t )), R t+1 =normalize(δ(Z t+1 ,T t ));

[0030] Among them, R t , R t+1 Respectively represent the t-th group comparison combination {G t ,G t+1 The two nodes of} represent the matrix Z t , Z t+1 The corresponding community affiliation matrix is ​​used to represent the two node representation matrices Z t , Z t+1 Each of them is the snapshot network G at time step t t Community Center Matrix T tThe smaller the value of the community affiliation matrix, the better the community affiliation; δ(·) is the cosine similarity function, and normalize(·) is the regularization function.

[0031] As a preferred solution, in step S205, the community snapshot cost loss function is:

[0032]

[0033] Where, L SC represents the community snapshot cost loss function, L DC (·) represents the dynamic contrast loss function, D t inter Represents the snapshot network at time step t The density between communities, D t intra Represents the snapshot network at time step t The density within the community, Represents the snapshot network at time step t+1 The density between communities, Represents the snapshot network at time step t+1 The density within the community, λ w represents the weight parameter;

[0034] The non-aligned neighbor contrast loss function is:

[0035]

[0036] Where, L TC represents the non-aligned neighbor contrast loss function, Respectively represent the node representation matrix Z corresponding to the snapshot network at time step t and t+1 t and Z t+1 is the embedding representation of the i-th node in , and N represents the total number of nodes in the snapshot network.

[0037] As a preferred solution, the total loss function is:

[0038] L=L SC +L TC ;

[0039] Where L represents the total loss function.

[0040] Compared with the prior art, the present invention has the following technical effects:

[0041] (1) In the prior art, graph enhancement is usually performed manually. However, due to the different properties of graphs, manual enhancement has been shown to be sensitive to different graph datasets, thereby limiting the efficiency and generalizability of the GCL method. The present invention proposes to use two snapshot networks at adjacent time steps instead of manual enhancement to replace the enhanced view. By using network snapshots at adjacent time steps in a dynamic network as different views in a contrastive learning framework, positive sample pairs and negative sample pairs are constructed to capture the temporal properties and inherent data of the evolving graph, so that the model can not only eliminate the complex data enhancement process, but also accurately retain the original semantic information in the network.

[0042] (2) The present invention proposes a non-aligned neighbor contrast loss function (NA-NCE) that takes into account the neighbor information between the same view and different views, thereby enhancing the model's ability to fully capture the node relationships in dynamic networks, thereby significantly improving the accuracy of community detection. This method not only improves the training efficiency and the robustness of the model, but also alleviates the dimensionality collapse problem, improves the class imbalance problem in long-tail data sets, and enhances the generalization ability of the model on unseen data, making the community detection results more stable and reliable in the structural changes of dynamic networks.

[0043] (3) Experimental investigations on a large number of synthetic networks and real networks show that the proposed contrastive learning-based dynamic detection without enhancement (DyCD-CL) not only achieves excellent performance, but also reduces the data preprocessing process by avoiding the computationally expensive data enhancement process. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to make the purpose, technical solution and advantages of the invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings, in which:

[0045] Figure 1 It is a schematic diagram of the framework of the non-enhanced dynamic community detection model in the method of the present invention;

[0046] FIG2 is a comparison diagram of the results of four events in the SYN-EVENTs synthetic data set according to an embodiment of the present invention;

[0047] FIG3 is a comparison diagram of changes in mutual information values ​​of adjacent snapshots in iterative training on a Cellphone Calls dataset according to an embodiment of the present invention;

[0048] FIG4 is a comparison diagram of changes in mutual information values ​​of adjacent snapshots in iterative training on the High School dataset according to an embodiment of the present invention;

[0049] Figure 5 This is a visualization effect diagram of the community evolution of the Cellphone Calls dataset in an embodiment of the present invention;

[0050] Figure 6 This is a visualization diagram of the community evolution of the High School dataset in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0052] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0053] In order to improve the diversity and quality of training data when performing graph contrastive learning, graph data augmentation technology plays a vital role in GCL. Existing GCL frameworks mainly use three strategies to generate views: feature or topological perturbations, sampling, and diffusion processes. The most representative methods include GraphCL, InfoGraph, and MVGRL. According to the research of Trivedi et al., this domain-independent graph augmentation (DAGA) technology not only destroys task-related information, but also impairs the model's ability to learn discriminative representations. Although these graph data augmentation techniques have been proven to be effective in a large number of models, it is still necessary to manually select the enhancements for each dataset through trial and error. In short, DAGA is not conducive to dynamic community detection scenarios with strong domain relevance, such as protein interaction networks and gene regulatory networks.

[0054] In view of the above problems, the present invention proposes a non-enhanced dynamic community detection method based on contrastive learning. By using two snapshots of adjacent time steps instead of manual form to replace the enhanced view, the present invention can not only eliminate the complex data enhancement process but also accurately retain the original semantic information in the network. Prior to this, the present invention first verifies the feasibility of adjacent snapshots as enhanced views. The specific verification steps include: first, the normalized Laplace matrix L t Decompose and get the eigenvector u t and eigenvalue λ t Then, the eigenvalue λ t In ascending order, the eigenvector u tThen, we use matrix perturbation theory (consider putting it in the theoretical part) to calculate the eigenvalues ​​of the changes.

[0055]

[0056] Where, ΔA=L t+1 -L t , ΔD=D Lt+1 -D Lt , where D Lt+1 and D Lt is a diagonal matrix whose diagonal elements are L t+1 and L t The row sum of the matrix. Finally, the change value Δλ will be obtained. The results show that the dynamic changes of adjacent snapshots conform to the general graph augmentation (GAME) rule of GCL, which further proves that it is feasible to replace data augmentation with dynamic changes.

[0057] Therefore, if Figure 1 As shown, the present invention specifically includes:

[0058] S1. Obtain the dynamic network sequence to be detected;

[0059] S2, input the dynamic network sequence to be detected into the trained non-enhanced dynamic community detection model DyCD-CL, and output the community detection result of the dynamic network sequence to be detected;

[0060] The framework of the unenhanced dynamic community detection model DyCD-CL is as follows Figure 1 As shown, the training process is as follows:

[0061] S201, obtain a dynamic network sequence G as a training sample = {G 1 ,G 2 ,…,G T}, as the input for training the unenhanced dynamic community detection model DyCD-CL; where G t ={A t ,X t} is the snapshot network at time step t, X t and A t Respectively represent the snapshot network G at time step t t The feature matrix and adjacency matrix of , t=1,2,…,T, T represents the total time step; the community structure of the dynamic network sequence G is expressed as is the t-th snapshot network G t i communities, i = 1, 2, ..., K, K is the number of communities in the snapshot network;

[0062] S202, the unenhanced dynamic community detection model DyCD-CL samples T snapshot networks in the input dynamic network sequence G in pairs in sequence, and constructs a set of T-1 contrast combinations {G t ,G t+1} network group vector C:

[0063] C={{G 1 ,G 2},{G 2 ,G 3},......,{G T-1 ,G T}};

[0064] S203, the unenhanced dynamic community detection model DyCD-CL compares each group of combinations {G t ,G t +1 The two snapshot networks of} are encoded by the encoder network respectively, and each comparison combination {G t ,G t+1} corresponds to the node representing the matrix combination {Z t ,Z t+1}, Z t , Z t+1 Represent the snapshot network G t , G t+1 The nodes of represent the matrix;

[0065] S204, the non-enhanced dynamic community detection model DyCD-CL for any t-th group comparison combination {G t ,G t+1}, calculate the two node representation matrices Z respectively t , Z t+1 Each of them is the snapshot network G at time step t t Community Center Matrix T t The community affiliation of , and then take the better one as the snapshot network G at time step t+1 t+1 The community detection result; the snapshot network G at the time step t t Community Center Matrix T t is the snapshot network G at time step t. t The community centers of each community in G are used as the matrix of elements; thus, the unenhanced dynamic community detection model DyCD-CL obtains the dynamic network sequence G in G 2 ,…,G T The community detection results of these T-1 snapshot networks are used as the community detection results of the dynamic network sequence G;

[0066] S205, using a total loss function consisting of a community snapshot cost loss and a community non-aligned neighbor comparison loss, calculating the training loss of the non-enhanced dynamic community detection model DyCD-CL, and updating the parameters of the non-enhanced dynamic community detection model DyCD-CL with the goal of minimizing the total loss;

[0067] S206: Repeat steps S201 to S205 until the unenhanced dynamic community detection model DyCD-CL converges or reaches a preset number of training times, and the training is completed.

[0068] Through the above-mentioned process of the present invention, it can be seen that the present invention constructs the non-enhanced dynamic community detection model DyCD-CL based on the non-enhanced dynamic community detection method of contrastive learning, sequentially samples T snapshot networks in pairs in the dynamic network sequence, constructs a network group vector with T-1 sets of contrast combinations, and respectively encodes the two snapshot networks of each set of contrast combinations using the encoder network, calculates the community affiliation of each with the community center matrix of the snapshot network, and then takes the better community affiliation as the community detection result of the snapshot network. The present invention uses two snapshot networks of adjacent time steps as enhanced views in the contrastive learning framework to construct positive sample pairs and negative sample pairs to capture the temporal attributes and inherent data of the evolutionary graph, and introduces a non-aligned neighbor contrast loss function to maximize the similarity between the positive sample pairs and minimize the negative sample pairs, so that the model can not only eliminate the complex data enhancement process, but also accurately retain the original semantic information in the network, thereby improving the accuracy and robustness of dynamic community detection by the non-enhanced dynamic community detection model DyCD-CL.

[0069] In this embodiment, in step S203, the encoder network adopts a graph convolutional network.

[0070] In this embodiment, for the snapshot network G at any time step t t , use graph convolutional network for encoding, and get the node representation matrix Z corresponding to the time step t The specific method is:

[0071] The snapshot network G at time step t t The feature matrix X t Initialize the node representation matrix, then update the node representation matrix through a multi-layer graph convolution network. Finally, after L layers of graph convolution operations, the final node representation matrix Z is obtained. t ;

[0072] The specific process is expressed as:

[0073]

[0074] L represents the number of layers of the graph convolutional network;

[0075] in, represents the output of the initial layer graph convolutional network, Represents the snapshot network G of the l-th layer graph convolutional network at time step t t The corresponding nodes represent matrices, represents the node feature matrix as the output of the l+1th layer after the lth layer of graph convolutional network, σ(·) represents the activation function, represents the snapshot network G at time step t t The normalized adjacency matrix is I is the identity matrix; represents the normalized adjacency matrix degree matrix, W (l) represents the trainable transformation matrix of layer l, Represents the node representation matrix after L layers of graph convolution operations.

[0076] In this embodiment, in step S204, the snapshot network G at any time step t is calculated. t The corresponding node represents the matrix Z t Matrix T with community center t The specific forms of community affiliation are:

[0077] For the first set of contrast combinations {G 1 ,G 2}, that is, when t = 1, the randomly initialized community center matrix T1 is used to calculate the community affiliation; for any other group comparison combination {G t ,G t+1}, that is, when t = 2, 3, ..., T, the snapshot network G at time step t obtained by community detection using the t-1th group of comparison combinations t The community center matrix T corresponding to the community detection result t Perform calculations of community affiliations.

[0078] For any t-th contrast combination {G t ,G t+1}, community affiliation is calculated as:

[0079] R t =normalize(δ(Z t ,T t )), R t+1 =normalize(δ(Z t+1 ,T t ));

[0080] Among them, Rt , R t+1 Respectively represent the t-th group comparison combination {G t ,G t+1 The two nodes of} represent the matrix Z t , Z t+1 The corresponding community affiliation matrix is ​​used to represent the two node representation matrices Z t , Z t+1 Each of them is the snapshot network G at time step t t Community Center Matrix T t The smaller the value of the community affiliation matrix, the better the community affiliation; δ(·) is the cosine similarity function, and normalize(·) is the regularization function.

[0081] In this specific embodiment, for the dynamic community detection task, the two objective functions SC and TC are processed and improved in detail, specifically:

[0082] The community snapshot cost loss function is:

[0083]

[0084] Where, L SC represents the community snapshot cost loss function, L DC (·) represents the dynamic contrast loss function, D t inter Represents the snapshot network at time step t The density between communities, D t intra Represents the snapshot network at time step t The density within the community, Represents the snapshot network at time step t+1 The density between communities, Represents the snapshot network at time step t+1 The density within the community, λ w Represents the weight parameter.

[0085] Among them, SC aims to find the best community structure in the current snapshot network. It is divided into two objective functions: intra-community density and inter-community density to train community division. The specific calculation method is as follows:

[0086] Snapshot network at time step t middle:

[0087]

[0088] In the formula, A t [i,j] represents the snapshot network at time step t Is there an edge between node i and node j? t [i,j]=1 means there is an edge between node i and node j, otherwise A t [i,j]=0 means there is no edge between node i and node j; d t (k) represents the snapshot network G at time step t i t The expected density of the kth community in [A t [i,j]-d t (k)] indicates A t [i,j] and the expected density d of the kth community t (k) The gap between; [A t The 0 in [i,j]-0] represents the expected density between communities, [A t [i,j]-0] represents A t The gap between [i,j] and the expected density between communities; R t [i,k] represents the snapshot network at time step t The community affiliation matrix R of the middle node i t The affiliation of the kth community in R t [j,k] represents the snapshot network at time step t The community affiliation matrix R of the middle node j t The affiliation of the kth community in R t [i,k1] represents the snapshot network at time step t The community affiliation matrix R of the middle node i t The affiliation of the k1th community in R t [j,k2] represents the snapshot network at time step t The community affiliation matrix R of the middle node j t The affiliation of the k2th community in .

[0089] Snapshot network at time step t+1 middle:

[0090]

[0091] In the formula, A t+1 [i,j] represents the snapshot network at time step t+1 Is there an edge between node i and node j? t+1 [i,j]=1 means there is an edge between node i and node j, otherwise A t+1 [i,j]=0 means there is no edge between node i and node j; d t+1 (k) represents the snapshot network at time step t+1 The expected density of the kth community in [A t+1[i,j]-d t+1 (k)] indicates A t +1 [i,j] and the expected density d of the kth community t+1 (k) The gap between; [A t+1 The 0 in [i,j]-0] represents the expected density between communities, [A t+1 [i,j]-0] represents A t+1 The gap between [i,j] and the expected density between communities; R t+1 [i,k] represents the snapshot network at time step t+1 The community affiliation matrix R of the middle node i t+1 The affiliation of the kth community in R t+1 [j,k] represents the snapshot network at time step t+1 The community affiliation matrix R of the middle node j t+1 The affiliation of the kth community in R t+1 [i,k1] represents the snapshot network at time step t+1 The community affiliation matrix R of the middle node i t+1 The affiliation of the k1th community in R t+1 [j,k2] represents the snapshot network at time step t+1 The community affiliation matrix R of the middle node j t+1 The affiliation of the k2th community in .

[0092] In addition, TC is measured by the consistency of node embeddings between adjacent snapshots in most previous methods, which is consistent with the objective of graph contrastive learning at the node-node level. Obviously, this further proves the adaptability of GCL to the dynamic community detection task while reducing the number of objective functions. GCL aims to maximize the mutual information (MI) between different augmented views by comparing positive and negative pairs. Two self-supervised contrastive losses, namely InfoNCE and NT-Xent, have been widely used in recent node-node level graph contrastive learning methods. However, both InfoNCE and NT-Xent only allow one positive pair for each anchor point. Specifically, the embeddings of the same node in two views are defined as positive pairs, while the embeddings of all different nodes are defined as negative pairs. In such a definition, the neighbors of the anchor point will be regarded as negative values ​​and then pushed away from the anchor point. This obviously does not conform to the principle of graph homogeneity. In addition, the practice of using adjacent snapshot networks as augmented views will also cause the problem of non-alignment of nodes in the contrasting views, which further increases the difficulty of training.

[0093] To this end, this embodiment proposes a non-aligned neighbor contrast loss function (NA-NCE) to solve the above problem. In the non-aligned neighbor contrast loss function, the node representation matrix Z is selectedt The embedding representation of the i-th node of the snapshot network at time step t As an anchor point, then:

[0094]

[0095] The denominator details can be further elaborated as follows:

[0096]

[0097] Then, the final non-aligned neighbor contrast loss function suitable for dynamic networks is as follows:

[0098]

[0099] Since the two views are symmetric, given the embedding in view 2, that is, taking view 2 as the anchor point, the non-aligned neighbor contrast loss can be defined similarly according to the above formula, then the non-aligned neighbor contrast loss function is:

[0100]

[0101] Where, L TC represents the non-aligned neighbor contrast loss function, Respectively represent the node representation matrix Z corresponding to the snapshot network at time step t and t+1 t and Z t+1 is the embedding representation of the i-th node in , and N represents the total number of nodes in the snapshot network.

[0102] Then the total loss function is:

[0103] L=L SC +L TC ;

[0104] Where L is the total loss function.

[0105] Verification Example

[0106] The scheme of the present invention introduces some synthetic networks and real-world dynamic networks to evaluate the performance of the DyCD-CL model in the dynamic community detection task. Table 1 lists the detailed statistics of the data set. First, for the synthetic network G1, the dynamic benchmark network generator provided by Greene et al. is used to synthesize the network. This tool can generate a set of unweighted and undirected time-evolving networks in which real communities are embedded. Here, the SYN-Events data set considers four evolutionary events in the evolution of synthetic networks: birth and death, expansion and contraction, intermittent communities, and mergers and splits of communities. This embodiment selects two real-world dynamic networks G2 and G3 as the data sets of the DyCD-CL model of this embodiment to compare with five dynamic community detection algorithms: DYNMOGA, DyCID, IncNSA, SE-Autoencoder and DGCN, which cover classic evolutionary clustering methods, incremental clustering methods, dynamic embedding methods, and dynamic community detection methods using deep learning technology.

[0107] Table 1 Dataset statistics

[0108]

[0109] In this example, NMI is used as an evaluation metric. As mentioned in the study by Shchur et al., metrics such as Jaccard and F1 scores are often used to quantify the consistency between true communities and detected communities, which can assign arbitrarily high scores to communities with no information at all. As an alternative, the normalized information (NMI) is rewritten:

[0110]

[0111] Among them C A ={C A1 ,C A2 ,...,C Aa} and C B ={C B1 ,C B2 ,...,C Bb} represents two partitions of the network. I is a confusion matrix whose elements I ij is also from community C Ai and C Bj The number of nodes. A (I B ) is the number of communities in each partition, I i. (I .j ) is the sum of the elements in the i-th row (j-th column) of the confusion matrix I, and |V| is the number of nodes. NMI measures the similarity between A and B. The higher the NMI value, the more similar the two community structures are.

[0112] In this embodiment, each synthetic network contains 10 snapshots, each with 1000 nodes, an average degree of 20, a maximum degree of 50, and a mixing parameter μ = 0.2. Specifically, the value of the mixing parameter μ controls the proportion of edges of each node connected to other community nodes, and it is the default value in this generator. In the model of this embodiment, a 2-layer GCN is used as a graph encoder for each deep learning baseline, and each model is optimized using the Adam optimizer. Before applying the SC objective, the representations of the two graph views are passed through a fragment projection module (a 2-layer MLP) with the same input, hidden layer, and output dimensions. The number of communities is set according to the number of classes in each graph. For parameter settings, the learning rate is set to 0.01 and α is set to 0.5.

[0113] As shown in Figure 2, the model of this embodiment is compared with 5 baseline models to show the advantages of the method of this embodiment. First, 4 types of events are embedded in the synthetic network SYN-EVENTS. Figure 2 shows the NMI values ​​obtained from these 4 different types of data sets, among which the DyCD-CL model has achieved good performance on these 4 time-evolving networks.

[0114] Figure 2(a) shows the network results considering the birth and death of communities, where DyCD-CL identifies the same results as the real communities in almost all snapshots, successfully revealing the birth and death of communities. Figure 2(b) shows the network results considering the expansion and contraction of communities, where DyCD-CL also achieves good results and successfully reveals the expansion and contraction of communities. In terms of comparison algorithms, SE-Autoencoder, IncNSA and DGCN all perform well on this series of networks, while the results of DyCID and DYNMOGA are less satisfactory. In particular, the DyCID model shows a gradual decline in performance as the time step length increases. Figure 2(c) shows the network results considering intermittent communities, where DyCD-CL also achieves good results, but the DGCN method is obviously not good at handling such networks. On the time-evolving network reflecting community mergers and splits, the detection results are shown in Figure 2(d). In this series of networks, the NMI values ​​of each method decrease over time. This trend indicates that over time, as communities merge and split, the community structure becomes more chaotic and increasingly difficult to detect. All NMI values ​​detected by the DyCD-CL model from each snapshot are greater than 0.95, reflecting higher stability.

[0115] Table 2 shows the NMI values ​​obtained for each snapshot network in the Cellphone Calls dataset, where the DyCD-CL model has achieved good performance in terms of both the average NMI value and the NMI value of a single snapshot. Especially in the first two time slice networks (T1 and T2), compared with the traditional community detection model based on evolutionary clustering ideas, DyCD-CL can obtain efficient and stable community structures at the initial moment. Table 3 shows the NMI values ​​obtained for each snapshot network in the High School dataset, where the DyCD-CL model also achieved good performance.

[0116] Therefore, whether in synthetic networks or real networks, the DyCD-CL model can not only obtain efficient community detection results, but also achieve better accuracy and higher stability in the initial few snapshots.

[0117] Table 2 Comparative experiment NMI (%) of Cellphone Call dataset

[0118]

[0119]

[0120] As shown in Figure 3, the change of mutual information values ​​between adjacent snapshots in the Cellphone Calls dataset within 1000 iterations is shown. The dynamic dataset is divided into 10 snapshot networks. According to the combination rule of {Tt, Tt+1}, 9 different comparison schemes can be formed. The experimental results of each comparison scheme correspond to the 9 figures in Figure 3. Taking the comparison view composed of T1 and T2 snapshots in Figure 3 (a) as an example, the NMI value between the two groups of signals gradually tends to be consistent and stable with the increase of training rounds. Looking at the 9 groups of schemes in the Cellphone Calls dataset, such effects are achieved. Figure 4 shows the change of mutual information values ​​between adjacent snapshots in the High School dataset within 800 iterations. The dynamic dataset is divided into 9 snapshot networks. According to the combination rule of {Tt, Tt+1}, 8 different comparison schemes can be combined. The experimental results of each comparison scheme correspond to the 8 figures in Figure 4. Looking at the 8 groups of schemes in the High School dataset, the effects achieved are consistent with the above expression.

[0121] As shown in Table 4, the ablation experiment using different contrast loss functions instead of time cost (TC) on the Cellphone Calls dataset is shown. The experimental results show that in processing various combination scenarios such as non-aligned and graph domains, the non-aligned neighborhood contrast loss function is more suitable for complex and variable contrast scenarios and achieves better results. Table 5 shows the ablation experiment using different contrast loss functions instead of time cost (TC) on the HighSchool dataset, and the same effect as in the Cellphone Calls dataset is achieved. In short, the introduction of the non-aligned neighborhood contrast loss function makes it more suitable for processing graph domains and non-aligned task scenarios, and also provides a basis for more complex tasks in the later stage.

[0122] Table 4 Ablation experiment NMI (%) of Cellphone Call dataset

[0123]

[0124] Table 5 Ablation experiment NMI (%) of High School dataset

[0125]

[0126] Aiming at practical problems such as it is difficult to track communities and reflect their effects in dynamic networks, a visualization study of the community evolution process on two real datasets was conducted. Figure 5 The visualization effect of the community evolution of the Cellphone Calls dataset is shown. It takes advantage of the impact map and, from a local perspective, allows you to intuitively understand the flow direction of nodes in each community at different time states. From a global perspective, you can intuitively understand the flow volume and migration direction of the entire node at the current moment, which is conducive to the detailed observation of special nodes or communities in the later stage. Figure 6 The visualization effect of the community evolution of the High School dataset is shown. Compared with the Cellphone Calls dataset, the flow of nodes in the High School dataset is obviously simpler.

[0127] In summary, the proposed contrastive learning-based dynamic community detection method (DyCD-CL) eliminates the reliance on traditional data augmentation techniques. This method uses adjacent snapshots as different contrast views in a contrastive learning framework to construct positive and negative sample pairs to capture the temporal properties and inherent structure of the evolutionary graph, enabling the model to perform accurate community detection while learning discriminative features. In addition, experimental exploration on a large number of synthetic and real networks shows that this method not only achieves excellent performance, but also reduces the data preprocessing process by avoiding the computationally expensive data augmentation process.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described with reference to the preferred embodiments of the present invention, it should be understood by those skilled in the art that various changes may be made in form and details without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A non-enhancement dynamic community detection method based on contrastive learning, characterized in that: The steps include: S1. Obtain the dynamic network sequence to be detected; S2, input the dynamic network sequence to be detected into the trained non-enhanced dynamic community detection model DyCD-CL, and output the community detection result of the dynamic network sequence to be detected; The training process of the non-enhanced dynamic community detection model DyCD-CL is as follows: S201, obtain a dynamic network sequence G as a training sample = {G 1 ,G 2 ,…,G T }, as the input for training the unenhanced dynamic community detection model DyCD-CL; where G t ={A t ,X t } is the snapshot network at time step t, X t and A t Respectively represent the snapshot network G at time step t t The feature matrix and adjacency matrix of , t=1,2,…,T, T represents the total time step; the community structure of the dynamic network sequence G is expressed as is the t-th snapshot network G t i communities, i = 1, 2, ..., K, K is the number of communities in the snapshot network; S202, the unenhanced dynamic community detection model DyCD-CL samples T snapshot networks in the input dynamic network sequence G in pairs in sequence, and constructs a set of T-1 contrast combinations {G t ,G t+1 } network group vector C: C={{G 1 ,G 2 },{G 2 ,G 3 },......,{G T-1 ,G T }}; S203, the unenhanced dynamic community detection model DyCD-CL compares each group of combinations {G t ,G t+1 The two snapshot networks of} are encoded by the encoder network respectively, and each comparison combination {G t ,G t+1 } corresponds to the node representing the matrix combination {Z t ,Z t+1 }, Z t , Z t+1 Represent the snapshot network G t , G t+1 The nodes of represent the matrix; S204, the non-enhanced dynamic community detection model DyCD-CL for any t-th group comparison combination {G t ,G t+1 }, calculate the two node representation matrices Z respectively t , Z t+1 Each of them is the snapshot network G at time step t t Community Center Matrix T t The community affiliation of , and then take the better one as the snapshot network G at time step t+1 t+1 The community detection result; the snapshot network G at the time step t t Community Center Matrix T t is the snapshot network G at time step t. t The community centers of each community in G are used as the matrix of elements; thus, the unenhanced dynamic community detection model DyCD-CL obtains the dynamic network sequence G in G 2 ,…,G T The community detection results of these T-1 snapshot networks are used as the community detection results of the dynamic network sequence G; S205, using a total loss function consisting of a community snapshot cost loss and a community non-aligned neighbor comparison loss, calculating the training loss of the non-enhanced dynamic community detection model DyCD-CL, and updating the parameters of the non-enhanced dynamic community detection model DyCD-CL with the goal of minimizing the total loss; S206: Repeat steps S201 to S205 until the unenhanced dynamic community detection model DyCD-CL converges or reaches a preset number of training times, and the training is completed.

2. According to claim 1, the non-enhancement dynamic community detection method based on contrastive learning is characterized in that: In step S203, the encoder network adopts a graph convolutional network.

3. According to claim 2, the non-enhancement dynamic community detection method based on contrastive learning is characterized in that: For the snapshot network G at any time step t t , use graph convolutional network for encoding, and get the node representation matrix Z corresponding to the time step t The specific method is: The snapshot network G at time step t t The feature matrix X t Initialize the node representation matrix, then update the node representation matrix through a multi-layer graph convolution network. Finally, after L layers of graph convolution operations, the final node representation matrix Z is obtained. t ; The specific process is expressed as: L represents the number of layers of the graph convolutional network; in, represents the output of the initial layer graph convolutional network, Represents the snapshot network G of the l-th layer graph convolutional network at time step t t The corresponding nodes represent matrices, represents the node feature matrix as the output of the l+1th layer after the lth layer of graph convolutional network, σ(·) represents the activation function, represents the snapshot network G at time step t t The normalized adjacency matrix is I is the identity matrix; represents the normalized adjacency matrix degree matrix, W (l) represents the trainable transformation matrix of layer l, Represents the node representation matrix after L layers of graph convolution operations.

4. According to claim 1, the non-enhancement dynamic community detection method based on contrastive learning is characterized in that: In step S204, the snapshot network G at any time step t is calculated. t The corresponding node represents the matrix Z t Matrix T with community center t The specific forms of community affiliation are: For the first set of contrast combinations {G 1 ,G 2 }, that is, when t = 1, the randomly initialized community center matrix T1 is used to calculate the community affiliation; for any other group comparison combination {G t ,G t +1 }, that is, when t = 2, 3, ..., T, the snapshot network G at time step t obtained by community detection using the t-1th group of comparison combinations t The community center matrix T corresponding to the community detection result t Perform calculations of community affiliations.

5. The non-enhancement dynamic community detection method based on contrastive learning according to claim 4 is characterized in that: In step S204, for any t-th comparison combination {G t ,G t+1 }, community affiliation is calculated as: R t =normalize(δ(Z t ,T t )),R t+1 =normalize(δ(Z t+1 ,T t )); Among them, R t , R t+1 Respectively represent the t-th group comparison combination {G t ,G t+1 The two nodes of} represent the matrix Z t , Z t+1 The corresponding community affiliation matrix is ​​used to represent the two node representation matrices Z t , Z t+1 Each of them is the snapshot network G at time step t t Community Center Matrix T t The smaller the value of the community affiliation matrix, the better the community affiliation; δ(·) is the cosine similarity function, and normalize(·) is the regularization function.

6. According to claim 1, the non-enhancement dynamic community detection method based on contrastive learning is characterized in that: In step S205, the community snapshot cost loss function is: L DC (R t )−λ w D t inter -D t intra , Where, L SC represents the community snapshot cost loss function, L DC (·) represents the dynamic contrast loss function, D t inter Represents the snapshot network at time step t The density between communities, D t intra Represents the snapshot network at time step t The density within the community, Represents the snapshot network at time step t+1 The density between communities, Represents the snapshot network at time step t+1 The density within the community, λ w represents the weight parameter; The non-aligned neighbor contrast loss function is: Where, L TC represents the non-aligned neighbor contrast loss function, Respectively represent the node representation matrix Z corresponding to the snapshot network at time step t and t+1 t and Z t+1 is the embedding representation of the i-th node in , and N represents the total number of nodes in the snapshot network.

7. The non-enhancement dynamic community detection method based on contrastive learning according to claim 6, characterized in that: The total loss function is: L=L SC +L TC ; Where L represents the total loss function.