An unsupervised community discovery method and system based on a graph neural network

By combining a two-layer graph attention encoder and a multilayer perceptron model with a self-expression mechanism, the problem of integrating graph neural networks and unsupervised learning in community detection is solved, generating embeddings that are more adapted to community detection tasks and improving the accuracy and performance of community assignment.

CN115761275BActive Publication Date: 2026-07-21QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
Filing Date
2022-09-07
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively combine graph neural networks with unsupervised learning for community detection tasks, resulting in embedded systems that lack specificity and have low accuracy in community assignment.

Method used

A two-layer graph attention encoder is used to generate graph embeddings. Combining a self-expression mechanism and a multilayer perceptron model, the embeddings are constrained by the self-expression principle, and the multilayer perceptron is used to classify the node embeddings to generate community structures.

Benefits of technology

It improves the accuracy and performance of community detection, and the generated embeddings are more adapted to community detection tasks, thus improving the accuracy of community assignment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115761275B_ABST
    Figure CN115761275B_ABST
Patent Text Reader

Abstract

The application provides an unsupervised community discovery method and system based on a graph neural network, relates to the technical field of data mining, and simultaneously uses a graph structure and node information to obtain an adjacency matrix and a feature matrix of a community data undirected graph to be discovered and a node; the adjacency matrix and the feature matrix are input into a double-layer graph attention encoder to generate graph embedding; a self-expression mechanism is used to constrain the graph embedding, so that the graph embedding is more suitable for a community discovery task; a multilayer perception machine model is used to classify nodes in the constrained graph embedding, a community structure of the graph is generated, and thus the community discovery is realized; information required by the community discovery task is effectively combined, and the performance of the community discovery is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data mining technology, and in particular relates to an unsupervised community discovery method and system based on graph neural networks. Background Technology

[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.

[0003] Graph structures have wide applications in real life, representing many complex systems such as social networks, citation networks, and e-commerce networks. Community detection divides the nodes in a graph into multiple subsets, where nodes in each subset share similar characteristics and connections, and the correlation between different subsets is relatively small. These subsets are called communities. Community detection is an important task in graph analysis with significant practical implications. For example, in the real world, by identifying communities in social networks, users can be recommended people they may know; by identifying communities on shopping websites, product advertisements can be accurately pushed to consumers.

[0004] Traditional community detection methods, such as spectral clustering and graph partitioning, primarily identify communities from network structures. Spectral clustering uses normalized Laplacian matrices and regularized adjacency matrices for network partitioning. Siemon et al. used spectral analysis based on the normalized Laplacian operator to discover communities in brain networks, providing a system-level description of the network structure rather than individual nodes or edges. Graph partitioning can divide a graph into a specified number of communities. In recent years, community detection has gradually shifted from traditional methods to deep learning-based methods. Unsupervised community detection models based on deep learning have also been proposed. For example, Xie et al. incorporated transfer learning into an autoencoder framework for unsupervised community detection, addressing the issues of insufficient data and imbalanced features in graphs. Ye et al. proposed a Deep Autoencoder-like Nonnegative Matrix Factorization (DANMF) model. Unlike traditional nonnegative matrix methods, DANMF is based on an autoencoder framework, employs hierarchical mapping, and incorporates multiple factors in the mapping to generate communities.

[0005] Graph Neural Networks (GNNs) are an extension of Convolutional Neural Networks (CNNs) for graph data. They have demonstrated superior performance in processing graph data and have attracted considerable attention. GNNs aim to use deep learning methods to model the information transfer, transformation, or aggregation between nodes in a graph in an end-to-end manner, for use in downstream tasks such as node classification, link prediction, graph generation, and network embedding. GNNs are widely used in computer vision, transportation, natural language processing, and recommender systems. Recently, graph neural networks have been increasingly applied to community detection tasks. For example, Chen et al. constructed a graph neural network model using multi-scale graph operators and extended it with non-backtracking operators for supervised community detection; Jin et al. combined the GCN framework with Markov random fields for semi-supervised community detection; Shchur et al. combined the Bernoulli-Poisson (BP) probability model with a two-layer GCN, learned the community membership vector by minimizing the negative log-likelihood of BP, and set a threshold to identify and remove weak associations for overlapping community detection; Xu et al. used a graph attention autoencoder as a generator to learn discriminative community representations in an integrated self-trained adversarial learning framework, with a discriminator to ensure the diversity of community distribution.

[0006] Most community detection algorithms based on graph neural networks (GNNs) are supervised or semi-supervised methods, with few combining GNNs with unsupervised learning. However, labels are sometimes scarce in large systems, and acquiring these labels is expensive. Therefore, combining GNNs with unsupervised learning for community detection is a pressing issue. Wang et al. designed a label sampling model based on the GCN framework to locate community centers, combining it with GCN for unsupervised community detection. Bandyopadhyay et al. trained a graph representation learning algorithm on a general unsupervised loss and then applied the KMeans++ algorithm to detect communities. However, the embeddings generated by this algorithm are often general and do not provide more targeted information for downstream tasks. Perozzi et al. used local information obtained from truncated random walks, learning latent representations by treating walks as equivalents of sentences, and then used a clustering algorithm for community detection. However, this clustering algorithm did not significantly improve the accuracy of community detection.

[0007] Therefore, the urgent technical problem to be solved is:

[0008] (1) How to combine graph neural networks with unsupervised learning to perform community detection tasks.

[0009] (2) How to optimize the generated general embedding into an embedding with information specific to the community discovery task.

[0010] (3) How to improve the accuracy of community allocation during the community generation process. Summary of the Invention

[0011] To overcome the shortcomings of the prior art, this invention provides an unsupervised community detection method and system based on graph neural networks. It utilizes both graph structure and node information, inputting the graph's adjacency matrix and feature matrix into a graph attention network to generate graph embeddings. The generated embeddings are constrained using a self-expression principle to better adapt them to community detection tasks. A multilayer perceptron is used to classify the node embeddings, generating the graph's community structure. This effectively combines the information required for community detection tasks, improving the performance of community detection.

[0012] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0013] The first aspect of this invention provides an unsupervised community detection method based on graph neural networks;

[0014] An unsupervised community detection method based on graph neural networks includes:

[0015] Obtain the undirected graph of the community data to be discovered, as well as the adjacency matrix and feature matrix of the nodes;

[0016] The adjacency matrix and feature matrix are input into a two-layer graph attention encoder to generate graph embeddings;

[0017] A self-expressive mechanism is used to constrain graph embeddings, making them more adaptable to community discovery tasks;

[0018] The nodes in the constrained graph embedding are classified using a multilayer perceptron model to generate the community structure of the graph, thereby achieving community discovery.

[0019] Furthermore, the dual-layer graph attention encoder consists of two layers of graph attention network (GAT), which combines the overall graph structure and node information; it uses the attention mechanism to aggregate the nodes' neighbors, adaptively assigns different weights to different neighbors, learns the hidden representations of the nodes, and improves the expressive power.

[0020] Further, the graph embedding is generated, and the specific steps are as follows:

[0021] Calculate the correlation between two nodes;

[0022] Normalize the relevance to generate weights;

[0023] The feature vector of a node is obtained by performing a weighted summation based on the attention mechanism.

[0024] The node embedding is generated by taking the node's feature vector as input.

[0025] Furthermore, when calculating the correlation between two nodes, the transition matrix is ​​used. To generate a new proximity matrix To obtain nodes Neighbor information.

[0026] Furthermore, the dual-layer graph attention encoder is trained using the information maximization principle:

[0027] Two corrupted views are generated by randomly corrupting the structure of the original undirected graph using a corruption function. The corruption function randomly deletes some edges in the graph and randomly masks some node features. The nodes in the two views are the same as the nodes in the original undirected graph.

[0028] After obtaining two damaged views, a two-layer graph attention encoder is used to generate two embeddings for each view. The graph embedding is learned by maximizing the mutual information between the two damaged views.

[0029] Furthermore, the self-expression mechanism used to constrain graph embedding involves learning the self-expression coefficient matrix in batches to generate pairwise similarity matrices, which then constrain the graph embedding.

[0030] Furthermore, the multilayer perceptron model includes two hidden layers that map the node embeddings in the previously generated graph embeddings to their corresponding community vectors and convert the community vectors into probability distributions.

[0031] A second aspect of the present invention provides an unsupervised community detection system based on graph neural networks.

[0032] An unsupervised community detection system based on graph neural networks includes a data acquisition module, a graph embedding module, a self-expression module, and a node classification module;

[0033] The data acquisition module is configured to acquire the undirected graph of the community data to be discovered, as well as the adjacency matrix and feature matrix of the nodes.

[0034] The graph embedding module is configured to input the adjacency matrix and feature matrix into a two-layer graph attention encoder to generate graph embeddings;

[0035] The self-expressive module is configured to: use a self-expressive mechanism to constrain graph embeddings, making them more adaptable to community discovery tasks;

[0036] The node classification module is configured to classify nodes in the constrained graph embedding using a multilayer perceptron model, generate the community structure of the graph, and thus achieve community discovery.

[0037] A third aspect of the present invention provides a computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the steps of an unsupervised community detection method based on a graph neural network as described in the first aspect of the present invention.

[0038] A fourth aspect of the present invention provides an electronic device including a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of an unsupervised community detection method based on a graph neural network as described in the first aspect of the present invention.

[0039] The above one or more technical solutions have the following beneficial effects:

[0040] This invention provides an unsupervised community detection method and system based on graph neural networks. It uses graph structure and node information to input the adjacency matrix and feature matrix of the graph into a graph attention network to generate graph embeddings, thus combining graph neural networks with unsupervised learning to perform community detection tasks.

[0041] This invention uses the self-expression principle to constrain the generated embeddings, making them more adaptable to community discovery tasks. It optimizes the generated general embeddings into embeddings with information specific to community discovery tasks, thereby improving the accuracy of the method.

[0042] This invention uses a multilayer perceptron to classify node embeddings and generate community structures for graphs; it effectively combines the information required for community discovery tasks, improves the performance of community discovery, and enhances the accuracy of community allocation during the community generation process.

[0043] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0044] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0045] Figure 1 This is a flowchart of the method in the first embodiment.

[0046] Figure 2 This is a system structure diagram of the second embodiment. Detailed Implementation

[0047] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0048] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0049] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0050] Example 1

[0051] This embodiment discloses an unsupervised community detection method based on graph neural networks, such as... Figure 1 As shown, it includes:

[0052] Step S1: Obtain the undirected graph of the community data to be discovered, as well as the adjacency matrix and feature matrix of the nodes;

[0053] The node dataset to be used for community detection is represented by an undirected graph and the adjacency matrix and feature matrix of the nodes. The undirected graph is... ,in Representative Figure A set of nodes, Let the set of edges between nodes in the graph be denoted as 'edge set'. It is the feature matrix of the nodes in the graph. The feature matrix is ​​composed of F-dimensional word vectors of N nodes in the dataset. It is the adjacency matrix of the graph. The number of communities shown in the graph. The output node community matrix maps the nodes to their corresponding communities. Closely connected nodes or nodes with similar features should belong to the same community.

[0054] Step S2: Input the adjacency matrix and feature matrix into the two-layer graph attention encoder to generate graph embeddings;

[0055] To generate graph embeddings, a two-layer graph attention encoder is proposed. The encoder consists of two layers of graph attention networks (GAT), combining the overall graph structure and node information. It utilizes an attention mechanism to aggregate node neighbors, adaptively assigning different weights to different neighbors, and learning the hidden representations of nodes, thus exhibiting strong expressive power. The specific steps are as follows:

[0056] Step S2-1: Calculate the correlation between the two nodes;

[0057] For nodes ,use It represents its neighboring nodes, and uses a single fully connected layer for computation. arrive The weighting coefficient, which is the correlation between two nodes:

[0058] (1)

[0059] in, , Representing nodes respectively , In the The length corresponding to the layer is Feature vectors, weight parameters Used for feature transformation of nodes Here are the weight parameters, and LeakyReLU is the activation function.

[0060] Traditional GAT-based systems only consider the first-order neighbors of a node. However, in most graphs, nodes have more than one first-order neighbor, leading to a lack of information. This embodiment addresses this by utilizing the transition matrix. To generate a new proximity matrix To obtain nodes Neighbor information:

[0061] (2)

[0062] Among them, B ij Transition matrix The Line number The elements of the column, when the node With nodes When there is an edge between them, ,otherwise , For nodes The degree; Representative node Its highest Neighbors of the class Topological relevance, Then it means and Adjacent, different values ​​can be selected based on different datasets. .

[0063] Step S2-2: Normalize the relevance to generate weights;

[0064] To better allocate weights, the calculated relevance with all neighbors is normalized using softmax.

[0065] (3)

[0066] in, Let be the weight coefficient, and exp be an exponential function with base e. The above formula guarantees that the sum of the weight coefficients of all the neighbors of a node is 1.

[0067] Add topological weights in Formula 2 Combining formulas 1, 2, and 3, the complete formula for the weighting coefficients is as follows:

[0068] (4)

[0069] Step S2-3: Perform weighted summation based on the attention mechanism to obtain the feature vector of the node;

[0070] After the weight coefficients are calculated, a weighted sum is performed based on the attention mechanism to obtain the node values. In the Feature vectors of the layer:

[0071] (5)

[0072] Step S2-4: Using the feature vector of the node as input, generate the node embedding.

[0073] Using a two-layer graph attention network to generate node embeddings, As input, the resulting node embedding is:

[0074] (6)

[0075] in, This represents the weight parameters of the first layer of feature transformation. The weight parameters represent the second-layer feature transformation, which utilize both graph structure and node attributes during the node embedding generation process.

[0076] To better utilize the graph structure and node content to generate embeddings, a two-layer graph attention encoder is trained using the information maximization principle:

[0077] (1) Randomly destroy the original undirected graph using a destruction function. The structure is used to generate two damaged views. and The destructive function randomly deletes some edges and randomly masks some node features in the graph, resulting in two views. and The nodes in the original undirected graph The nodes are consistent;

[0078] (2) After obtaining two damaged views, use a two-layer graph attention encoder to generate two views respectively. and Two embeddings and The embedding of a graph is learned by maximizing the mutual information between two damaged views.

[0079] node In the two views, they are respectively represented as and The corresponding embeddings are respectively , ,Will Considered as positive samples, in both views except for nodes Embeddings of nodes other than the target node are considered negative samples, and negative sample nodes are represented as follows: Noise contrast is used as the objective function:

[0080] (7)

[0081] in, , representing the cosine similarity between two embeddings. It is a temperature coefficient. This represents the parameters in the two-layer graph attention encoder; all nodes in the two views, excluding positive sample pairs, are considered negative samples, with negative samples coming from the two views corresponding to the second and third terms of the denominator, respectively; this essentially maximizes the node... Consistency of node embedding in the two views and Its purpose is solely to train the loss function in the objective function.

[0082] Step S3: Use a self-expressive mechanism to constrain the graph embedding, making it more adaptable to community discovery tasks;

[0083] A two-layer graph attention encoder is used to generate node embeddings; however, these embeddings are too general and lack information specific to community discovery tasks. To address this issue, a self-representation mechanism is introduced, which represents data points from multiple linear subspaces as a linear combination of the remaining nodes in one of the subspaces.

[0084] Based on the principle that one node can be used to reconstruct another node, a pairwise similarity matrix is ​​learned. The embeddings generated by the encoder are used to perform community detection tasks. However, computing pairwise similarity matrices for the entire graph is expensive and requires a lot of memory and time. To solve this problem, a batch learning method is introduced to learn the self-expression coefficient matrix, generate pairwise similarity matrices, and constrain the graph embeddings.

[0085] Embedding of nodes obtained in step S2 By concatenating the data, a matrix consisting of the embeddings of N nodes is obtained. The self-expression mechanism can be mathematically represented by a simple equation, namely... ,in This is the self-expression coefficient matrix; for each node... It is represented by a linear combination of the other nodes in its subset, i.e. ,in For matrix No. Line number The elements of the column, in order to avoid The trivial solutions are assigned to the identity matrix, and the following is set. .

[0086] Learning self-expression coefficient matrix Finally, a pairwise similarity matrix is ​​generated. If the subspaces are independent, minimize Certain norms can guarantee There is a diagonal structure (until a definite permutation is generated), that is, when the point... With point When belonging to the same subspace ;in this case, Each block structure in the algorithm corresponds to a subset of nodes, which can be mathematically formalized as an optimization problem, as shown in Equation 8.

[0087] (8)

[0088] in, represent The matrix norm, Minimize Certain norms, where st means such that, For embedding of all nodes, This is the self-expression coefficient matrix. Representative matrix Elements on the diagonal express For matrices The specification uses the nuclear norm of low-rank representation (LRR) and sparse subspace clustering (SSC). Norms, the Frobenius norm of least squares regression (LSR), etc. Here, the squared Frobenius matrix norm is chosen; however, this cannot accurately reconstruct the matrix. To solve this problem, soft constraints are used. The squared Frobenius matrix norm is used to relax the hard constraints. Therefore, a new objective loss function is introduced:

[0089] (9)

[0090] in, These are the weight parameters.

[0091] Pairwise similarity matrices It is usually constructed as Recently, many heuristic algorithms have been proposed to enhance block structures, which can improve... The clustering performance is poor; therefore, a heuristic method is used to construct pairwise similarity matrices, first calculating the matrix... of Singular value decomposition of order 1, i.e. ,set up , The largest intrinsic dimension of the subspace. Representing the number of communities, we obtain a matrix. After the singular value decomposition, let and will Normalize each row to the identity norm; finally, normalize the matrix... Setting the negative values ​​in the matrix to 0 yields the matrix. Set the similarity matrix as , making .

[0092] During the calculation of the pairwise similarity matrix, calculation is performed for each node. Pairwise similarity matrices are expensive, consuming a lot of time and memory. Therefore, batch learning is used to solve this problem.

[0093] In quantity From the set of nodes, a batch size of is randomly selected. The node, In Equation 9, the training loss for each batch has a complexity of O(n). It is far less than the complexity. However, this does not yield the complete similarity matrix of the graph, when nodes... With nodes When they belong to the same batch, it only calculates... ,use This represents the set of node pairs used to calculate similarity in batch learning. hour, This embodiment does not require the use of the similarity of all nodes; instead, it utilizes batch learning to calculate the similarity.

[0094] Step S4: Use a multilayer perceptron model to classify the nodes in the constrained graph embedding, generate the community structure of the graph, and thus realize community discovery.

[0095] The multilayer perceptron model contains two hidden layers, which map the node embeddings in the previously generated graph embeddings to their corresponding community vectors, and convert the community vectors into probability distributions.

[0096] Community detection is performed using a multilayer perceptron model with trainable parameters based on a neural network. This model contains two hidden layers that map the node embeddings in the previously generated graph embeddings to their corresponding community vectors and convert the community vectors into a probability distribution. The specific formula is as follows:

[0097] (10)

[0098] in, , , , These are the weight parameters and bias parameters of the two hidden layers, respectively. , These are the weight and bias parameters of the output layer, respectively; these parameters are trainable. LeakyReLU is the activation function of the hidden layer, and softmax is the activation function of the output layer, which transforms the community vector into a probability distribution. , The first in element Representing the The node belongs to the node. The probability of each community; Formula 10 can ensure that nodes with similar embeddings can be mapped to the same community vector element. However, the embeddings generated in the early stage are relatively general. For the community detection task, these embeddings lack relevant task information and may not be the best choice for generating communities. Therefore, the pairwise similarity information of nodes learned in step S3 is used to generate the community of nodes by training the parameters in Formula 10 and optimizing the embedding.

[0099] Set the community member matrix as follows , Depend on Each node Composed of dimensional vectors, This represents the parameters in the community detection module; if a complete node similarity matrix is ​​available. Then minimize the following objective function:

[0100] (11)

[0101] However, the objective function described above requires the complete node similarity matrix, which has high complexity. Furthermore, due to noise in the dataset, partial pairwise similarity cannot represent the similarity between nodes, making it unsuitable for community detection. Therefore, only the set of node pairs used in batch learning in S3 is employed. The data is in [the data set]. In addition, two thresholds are introduced. and This is to remove some pairwise similarity caused by noise in the dataset. For example, a pairwise similarity close to 1 indicates strong similarity between nodes, while a pairwise similarity close to 0 indicates weak similarity. A pairwise similarity of 0.5 neither represents similarity nor dissimilarity between node pairs; it contains little information and can affect the parameters of the multilayer perceptron model. Therefore, it is removed to improve the model's accuracy. Let... , After removing useless node similarities, the remaining set of paired nodes... Represented as:

[0102] (12)

[0103] Among them, greater than or equal to Connected pairs of nodes are grouped into a cluster, and those less than or equal to Unconnected node pairs are assigned to different clusters. A set of soft constraints with and without connections is derived using an unsupervised approach to guide community generation, and the following optimization is designed:

[0104] (13)

[0105] Formula 13 discards node pairs with less information and only uses node pairs that are connected or not connected, in order to ensure that each node... exist The probability distributions of different communities are more similar, avoiding the formation of fragmented communities. Formula 13 is optimized as follows:

[0106] (14)

[0107] The second term in Formula 14 ensures that the community distribution is approximately orthogonal and the community size is balanced; the total training loss for node embedding and community discovery is formulated as a weighted sum of their losses:

[0108] (15)

[0109] in, The community detection method involved in this embodiment is encapsulated into a separate community detection model, USCom, which uses an iterative method. First, the self-expression layer is calculated for each batch, and then the parameters of the community generation neural network are updated by minimizing Equation 15.

[0110] Experimental Evaluation

[0111] The effectiveness of the proposed unsupervised community detection method based on graph neural networks is evaluated using four datasets. The effectiveness of the proposed method is demonstrated by performing community detection operations on these datasets. The structure of the datasets is shown in Table 1. These four datasets are among the most popular and classic datasets in graph neural networks.

[0112] Table 1: Statistical information of the dataset

[0113] Dataset Type Nodes Edges Features Labels Cora Citation 2708 5429 1433 7 Citeseer Citation 3327 4732 3703 6 Pubmed Citation 19717 44338 500 3 Wiki webpages 2405 17981 4973 17

[0114] To demonstrate the effectiveness of the method, the USCom model was compared with nine baseline models.

[0115] K-means: K-means is the foundation of many clustering algorithms. It uses node features to cluster nodes.

[0116] DeepWalk: Based on random walks, DeepWalk is a representation learning model with graph structures at its core.

[0117] VGAE: VGAE also adopts the method of encoding first and then decoding. Unlike GAE, VGAE's encoder learns the normal distribution of the low-dimensional vector representation and samples it in the decoder to obtain the final vector representation.

[0118] MGAE: Based on an autoencoder, MGAE learns the graph representation by combining graph structure information with node content information in an unsupervised manner. The learned feature representation is then input into a spectral clustering algorithm to obtain graph clusters.

[0119] ARGE: ARGE is a graph embedding framework with added adversarial mechanisms. The framework encodes the overall structure of the graph and the content of its nodes to obtain a graph representation, which is then input into a decoder for graph structure reconstruction. The adversarial mechanism is used to normalize the underlying data distribution, making it match the prior distribution.

[0120] ARVGE: Similar to ARGE, ARVGA incorporates an adversarial mechanism into the variational graph autoencoder, jointly learning the adversarial module and the graph variational autoencoder.

[0121] AGC: AGC uses high-order graph convolution to obtain graph embeddings and adaptively selects different orders for different graphs. Finally, it uses spectral clustering to discover communities.

[0122] GUCD: GUCD uses an autoencoder framework to directly obtain the community assignment of nodes.

[0123] SENet: SENet improves the graph structure by utilizing shared neighbor information. It uses a three-layer embedding network to generate node representations under the constraint of spectral clustering loss, and finally uses the k-means algorithm to obtain the community assignment of nodes.

[0124] Three commonly used metrics are accuracy (Acc), normalized mutual information (NMI), and macro F1-score (F1). Higher scores indicate better community discovery results in the model.

[0125] The experimental results are shown in Table 2:

[0126] Table 2 Results of USCom and baseline in the community discovery task

[0127]

[0128] Table 2 shows the performance of model USCom compared to nine other baseline models on four datasets for community detection tasks, with bold numbers indicating the best results. USCom was run ten times on each of the four datasets, and the average of the results was taken. The results show that USCom achieved the best results in all categories except for the NMI metric on the Cora dataset. Specifically, on the Cora dataset, compared to the second-best baseline, USCom improved the F1-score by 8.75% and the Acc by 2.63%. On the PubMed dataset, USCom's Acc was 5.37% higher than the second-best SENet and its NMI was 3.63% higher. This is because this embodiment introduces an attention mechanism that adaptively assigns different weights to a node's neighboring nodes, better integrating the graph's structure and node feature information. On the Wiki dataset, model USCom outperformed the second-best AGC by 5.15% in Acc, 6.23% in NMI, and 4.24% in F1-score, confirming that incorporating a self-expression mechanism into the model effectively combines the information required for the community detection task, improving the model's performance. The results show that models that use both graph structural information and node feature information generally outperform k-means models that use only node features and DeepWalk models that use only graph structure in community detection. This confirms the superiority of the model in this embodiment that uses both graph structural information and node feature information.

[0129] Example 2

[0130] This embodiment discloses an unsupervised community detection system based on graph neural networks;

[0131] like Figure 2 As shown, an unsupervised community detection system based on graph neural networks includes a data acquisition module, a graph embedding module, a self-expression module, and a node classification module.

[0132] The data acquisition module is configured to acquire the undirected graph of the community data to be discovered, as well as the adjacency matrix and feature matrix of the nodes.

[0133] The graph embedding module is configured to input the adjacency matrix and feature matrix into a two-layer graph attention encoder to generate graph embeddings;

[0134] The self-expressive module is configured to: use a self-expressive mechanism to constrain graph embeddings, making them more adaptable to community discovery tasks;

[0135] The node classification module is configured to classify nodes in the constrained graph embedding using a multilayer perceptron model, generate the community structure of the graph, and thus achieve community discovery.

[0136] Example 3

[0137] The purpose of this embodiment is to provide a computer-readable storage medium.

[0138] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of an unsupervised community detection method based on a graph neural network as described in Embodiment 1 of this disclosure.

[0139] Example 4

[0140] The purpose of this embodiment is to provide an electronic device.

[0141] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in an unsupervised community detection method based on a graph neural network as described in Embodiment 1 of this disclosure.

[0142] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An unsupervised community detection method based on graph neural networks, characterized in that, include: Obtain the undirected graph of the community data to be discovered, as well as the adjacency matrix and feature matrix of the nodes; An undirected graph is ,in Representative Figure A set of nodes, Let the set of edges between nodes in the graph be denoted as 'edge set'. It is the feature matrix of the nodes in the graph. The feature matrix is ​​composed of F-dimensional word vectors of N nodes in the dataset. It is the adjacency matrix of the graph. The number of communities shown in the graph. The system outputs a community matrix of nodes, ultimately mapping each node to its corresponding community; it identifies communities in social networks to recommend people users may know; and it accurately pushes product advertisements to consumers by identifying communities on shopping websites. The adjacency matrix and feature matrix are input into a two-layer graph attention encoder to generate graph embeddings; The dual-layer graph attention encoder consists of two layers of graph attention network (GAT), and combines the overall graph structure and node information. It uses the attention mechanism to aggregate the neighbors of nodes, adaptively assigns different weights to different neighbors, and learns the hidden representation of nodes. A self-expressive mechanism is used to constrain graph embedding; The method of constraining graph embedding by employing a self-expression mechanism involves learning the self-expression coefficient matrix in batches, generating pairwise similarity matrices, and then constraining the graph embedding. The nodes in the constrained graph embedding are classified using a multilayer perceptron model to generate the community structure of the graph, thereby achieving community discovery.

2. The unsupervised community detection method based on graph neural networks as described in claim 1, characterized in that, The specific steps for generating graph embeddings are as follows: Calculate the correlation between two nodes; Normalize the relevance to generate weights; The feature vector of a node is obtained by performing a weighted summation based on the attention mechanism. The node embedding is generated by taking the node's feature vector as input.

3. The unsupervised community detection method based on graph neural networks as described in claim 2, characterized in that, When calculating the correlation between two nodes, the transition matrix is ​​used. To generate a new proximity matrix To obtain nodes Neighbor information.

4. The unsupervised community detection method based on graph neural networks as described in claim 1, characterized in that, The dual-layer graph attention encoder is trained using the information maximization principle: Two corrupted views are generated by randomly corrupting the structure of the original undirected graph using a corruption function. The corruption function randomly deletes some edges in the graph and randomly masks some node features. The nodes in the two views are the same as the nodes in the original undirected graph. After obtaining two damaged views, a two-layer graph attention encoder is used to generate two embeddings for each view. The graph embedding is learned by maximizing the mutual information between the two damaged views.

5. The unsupervised community detection method based on graph neural networks as described in claim 1, characterized in that, The multilayer perceptron model contains two hidden layers, which map the node embeddings in the previously generated graph embeddings to their corresponding community vectors, and convert the community vectors into probability distributions.

6. An unsupervised community detection system based on graph neural networks, characterized in that, It includes a data acquisition module, a graph embedding module, a self-expression module, and a node classification module; The data acquisition module is configured to acquire the undirected graph of the community data to be discovered, as well as the adjacency matrix and feature matrix of the nodes. An undirected graph is ,in Representative Figure A set of nodes, Let the set of edges between nodes in the graph be denoted as 'edge set'. It is the feature matrix of the nodes in the graph. The feature matrix is ​​composed of F-dimensional word vectors of N nodes in the dataset. It is the adjacency matrix of the graph. The number of communities shown in the graph. The system outputs a community matrix of nodes, ultimately mapping each node to its corresponding community; it identifies communities in social networks to recommend people users may know; and it accurately pushes product advertisements to consumers by identifying communities on shopping websites. The graph embedding module is configured to input the adjacency matrix and feature matrix into a two-layer graph attention encoder to generate graph embeddings; The dual-layer graph attention encoder consists of two layers of graph attention network (GAT), and combines the overall graph structure and node information. It uses the attention mechanism to aggregate the neighbors of nodes, adaptively assigns different weights to different neighbors, and learns the hidden representation of nodes. The self-expressive module is configured to constrain graph embeddings using a self-expressive mechanism; The method of constraining graph embedding by employing a self-expression mechanism involves learning the self-expression coefficient matrix in batches, generating pairwise similarity matrices, and then constraining the graph embedding. The node classification module is configured to classify nodes in the constrained graph embedding using a multilayer perceptron model, generate the community structure of the graph, and thus achieve community discovery.

7. A computer-readable storage medium having a program stored thereon, characterized in that, When executed by a processor, the program implements the steps of an unsupervised community detection method based on graph neural networks as described in any one of claims 1-5.

8. An electronic device, comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the unsupervised community detection method based on graph neural networks as described in any one of claims 1-5.