Graph representation learning method, device and equipment based on consistency and diversity cooperation
By introducing feature occlusion and edge occlusion into graph neural networks, and combining cross-view comparison optimization with mutual information and orthogonality constraints, the problem of limited information propagation in complex graph structures is solved. This achieves semantic alignment between the enhanced view and the original view, and improves the accuracy of node classification and the stability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-06
- Publication Date
- 2026-03-17
AI Technical Summary
When processing complex graph structures, existing graph neural networks suffer from limited information propagation due to highly similar features between nodes or excessive differences between categories. This leads to oversmoothing, semantic drift, and decreased generalization ability. Furthermore, the lack of explicit constraints on semantic consistency causes the enhanced view to deviate from the original semantic distribution.
By acquiring the original graph structure dataset, feature occlusion and edge occlusion are performed to generate an enhanced graph structure dataset. Combining the maximization of mutual information and orthogonality constraints of semantically related nodes, cross-view comparison optimization is performed. A graph encoder with shared parameters is used to minimize the difference in representation distribution between the enhanced view and the original view, generating an enhanced graph structure dataset that retains the original semantic information, which is then input into a graph neural network for training.
It achieves graph representation learning that balances consistency and diversity in complex graph structures, improves node classification accuracy and model robustness, avoids the augmented view from deviating from the original semantics, and enhances the diversity and stability of feature representations.
Smart Images

Figure CN121482504B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph neural network technology, and more specifically, to a graph representation learning method, apparatus, and device based on consistency and diversity collaboration. Background Technology
[0002] With the rapid development of artificial intelligence and big data technologies, graph neural networks (GNNs), as the core model for processing graph-structured data, have demonstrated powerful representation learning capabilities in many fields such as social network analysis, recommender systems, bioinformatics, knowledge graph construction, and traffic network optimization.
[0003] Generative Neural Networks (GNNs) update node representations by aggregating information from neighboring nodes, effectively capturing the complex topological structures and relationships between node features in graphs. However, in real-world applications, graph data often exhibits high heterogeneity and complexity: some graph datasets have excessively high feature similarity among nodes, making it difficult to distinguish between different categories of nodes; others suffer from excessively large cross-category differences or sparse connections, limiting information propagation and leading to "oversmoothing" or "underpropagation" phenomena. These problems significantly weaken the performance of traditional GNNs in tasks such as node classification and link prediction, limiting their generalization ability and robustness.
[0004] To address these challenges, researchers have proposed various graph data augmentation strategies, including node feature perturbation, edge masking, subgraph sampling, and view generation based on contrastive learning. These methods aim to expand training samples and improve the model's tolerance to noise and structural variations. However, existing augmentation methods generally face a key contradiction: overemphasizing diversity may cause the augmented view to deviate from the original semantics, disrupting the graph's inherent structural consistency; while excessive pursuit of consistency can limit the ability to explore the feature space and weaken the model's expressive diversity. Especially in complex scenarios with uneven node distribution, blurred class boundaries, or sparse graph structures, traditional augmentation methods struggle to achieve an effective balance between semantic consistency and feature diversity, leading to unstable augmentation results or even the introduction of harmful noise. Furthermore, most methods lack explicit constraints on the semantic alignment between the augmented view and the original view, which may cause the augmented representation to lose key discriminative information, affecting the accuracy of downstream tasks.
[0005] In view of the above, this application is hereby submitted. Summary of the Invention
[0006] The present invention aims to provide a graph representation learning method, apparatus and device based on consistency and diversity collaboration, in order to solve the defects of existing methods when processing complex graph structures, such as information propagation being limited due to the high similarity of features between nodes or the large differences between categories, which leads to oversmoothing, semantic drift and reduced generalization ability, as well as the lack of explicit constraints on semantic consistency, resulting in the enhanced view deviating from the original semantic distribution.
[0007] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution:
[0008] A graph representation learning method based on the synergy of consistency and diversity includes:
[0009] S1, Obtain the original graph structure dataset to be enhanced, and extract the initial node feature matrix, adjacency matrix and original classification labels;
[0010] S2, feature masking and edge masking are performed on the initial node feature matrix and the adjacency matrix respectively to randomly discard some node features and edges, generating two different views of the enhanced graph structure dataset;
[0011] S3, by maximizing the mutual information of semantically related nodes, suppressing the similarity of irrelevant nodes, and introducing orthogonality constraints in conjunction with the original classification labels, cross-view comparison optimization is performed on the node representations of the augmented graph structure datasets of two different views, so as to balance the semantic consistency of nodes and the diversity between views;
[0012] S4. The enhanced graph structure dataset after comparison and optimization and the original graph structure dataset are respectively input into the graph encoder with shared parameters. The difference in representation distribution between the enhanced view and the original view is calculated and minimized to obtain the enhanced graph structure dataset that retains the original semantic information.
[0013] S5 inputs the enhanced graph structure dataset that retains the original semantic information into the graph neural network model for graph representation learning and training, in order to optimize the graph representation of the dataset and obtain the optimal node representation and the trained graph representation learning model, which is then used for node classification task prediction.
[0014] Preferably, feature and edge masking is performed on the initial node feature matrix and the adjacency matrix respectively to randomly discard some node features and edges, specifically as follows:
[0015] A feature masking strategy is adopted, in which some elements in the initial node feature matrix are randomly set to zero with a preset probability, so as to randomly discard some node features and generate the first enhanced feature;
[0016] An edge occlusion strategy is adopted, which randomly sets some non-zero elements in the adjacency matrix to zero with a preset probability, thereby randomly removing some edges and generating a first enhanced adjacency matrix.
[0017] Based on the first enhanced features and the first enhanced adjacency matrix, a first enhanced graph structure dataset is reconstructed; similarly, a second enhanced graph structure dataset is reconstructed.
[0018] Preferably, this is achieved by maximizing the mutual information of semantically related nodes and suppressing the similarity of irrelevant nodes, specifically:
[0019] First, calculate the mutual information of the node pairs, expressed as:
[0020] ;
[0021] in, This represents the feature representation of node i; This represents the positive sample features of node j; Node feature representation With node positive sample features Mutual information; This refers to the SoftPlus function; Discriminator built for neural networks These are the parameters for the discriminator; Represents the expected value of the negative sample distribution; These are the negative sample features obtained by sampling from the negative sample distribution;
[0022] Then, the mutual information loss is minimized using the cross-view collaboration loss function, expressed as:
[0023] ;
[0024] in, This is the cross-view collaboration loss.
[0025] Preferably, an orthogonality constraint is introduced in conjunction with the original classification labels, specifically:
[0026] Within a single enhanced view, pairs of nodes of the same type and pairs of nodes of different types are first constructed based on the original classification labels;
[0027] Then, a contrastive optimization loss training process is performed. Orthogonal regularization constraints are applied to the weight matrix of each layer of the contrastive optimization model. The orthogonality loss function brings similar nodes closer together and pushes dissimilar nodes further apart, thus maintaining the diversity of node features and avoiding over-smoothing. The expression for the orthogonality loss function is:
[0028] ;
[0029] in, Orthogonality loss; These are hyperparameters used to control the strength of orthogonal constraints; To compare and optimize the model Layer weight matrix; For the first A learnable scalar for each layer, used to control the norm of the weight matrix; It is the identity matrix; The Frobenius norm of the matrix; This is the transpose symbol.
[0030] Preferably, S4 specifically comprises:
[0031] First, the enhanced node feature matrix corresponding to the optimized enhanced graph structure dataset and the initial node feature matrix of the original graph structure dataset are input in parallel into a graph encoder with shared weights to obtain the enhanced view representation and the original view representation, respectively.
[0032] Then, the KL divergence loss between the enhanced view representation and the original view representation is calculated, expressed as:
[0033] ;
[0034] in, For KL divergence loss; This represents the total number of nodes in the graph; A set of nodes; Let i be the set of neighboring nodes of node i; The true distribution of node i; The predicted distribution of node i is characterized by the features of its neighbor node j;
[0035] The parameters of the graph encoder are updated in reverse with the goal of minimizing the KL divergence loss to ensure that the augmented view retains the original semantics, thus generating an augmented graph structure dataset that combines augmented information with the original semantics.
[0036] Preferably, the graph neural network model includes several Dropout layers, several graph convolutional layers, ReLU activation layers, and an output layer;
[0037] The Dropout layer is used to randomly discard some of the outputs of neurons during training to prevent overfitting.
[0038] The graph convolutional layer is used to update the representation of each node by aggregating information from the node's neighbors, thereby extracting effective features from the graph structure.
[0039] The ReLU activation layer is used to introduce a non-linear transformation to set the part of the input value that is less than zero to zero and retain the part that is greater than zero, thereby enhancing the model's ability to learn complex features.
[0040] The output layer is used to predict the category of each node and generate the final prediction result;
[0041] The diagram illustrates the specific process of learning and training:
[0042] First, the input node feature matrix is processed by the Dropout layer and then input into the first graph convolutional layer for feature extraction. After feature normalization by the batch normalization layer, the first output feature is obtained.
[0043] Next, the first output feature is subjected to a nonlinear transformation through the ReLU activation function and then processed by the Dropout layer. The output data is input into the second graph convolutional layer for feature aggregation. After downsampling and batch normalization, the feature is normalized to obtain the second output feature.
[0044] The first output feature and the second output feature are concatenated along the channel dimension;
[0045] The features after convolution in each layer are extracted layer by layer through residual connections;
[0046] The features output from each layer are concatenated again and processed through multiple bridging modules. Each bridging module includes a convolutional layer, a batch normalization layer, and an activation function. By reducing the spatial dimension of the features, feature compression and integration are performed to obtain the final node feature representation.
[0047] The final node feature representation is input into a fully connected layer for processing to further compress the channel dimension of the features and reduce the number of parameters; after batch normalization and activation functions, a stable optimal node representation is obtained.
[0048] The present invention also provides a graph representation learning device based on consistency and diversity collaboration, comprising:
[0049] The data acquisition unit is used to acquire the original graph structure dataset to be enhanced and extract the initial node feature matrix, adjacency matrix and original classification labels;
[0050] The graph data augmentation unit is used to perform feature occlusion and edge occlusion on the initial node feature matrix and the adjacency matrix respectively, so as to randomly discard some node features and edges and generate two augmented graph structure datasets with different views.
[0051] The consistency-diversity balancing unit is used to optimize the node representations of two different views of the augmented graph structure dataset by maximizing the mutual information of semantically related nodes, suppressing the similarity of irrelevant nodes, and introducing orthogonality constraints in conjunction with the original classification labels, so as to balance the semantic consistency of nodes and the diversity between views.
[0052] The semantic preservation unit is used to input the contrast-optimized enhanced graph structure dataset and the original graph structure dataset into a graph encoder with shared parameters, calculate and minimize the difference in representation distribution between the enhanced view and the original view, and obtain an enhanced graph structure dataset that retains the original semantic information.
[0053] The model training unit is used to input the enhanced graph structure dataset that retains the original semantic information into the graph neural network model for graph representation learning and training, so as to optimize the graph representation of the dataset, obtain the optimal node representation and the trained graph representation learning model, and use it for node classification task prediction.
[0054] The present invention also provides a graph representation learning device based on consistency and diversity collaboration, including a processor and a memory, wherein the memory stores a computer program that can be executed by the processor to realize a graph representation learning method based on consistency and diversity collaboration as described above.
[0055] The present invention also provides a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor of the device in which the computer-readable storage medium resides, implement a graph representation learning method based on consistency and diversity collaboration as described above.
[0056] In summary, compared with the prior art, the present invention has the following beneficial effects:
[0057] This invention explicitly models the semantic relationships between different augmented views through a cross-view collaboration method, and strengthens the consistent representation of semantically related nodes by utilizing the mutual information maximization criterion. It effectively improves the diversity of feature representations and suppresses oversmoothing by applying intra-class compactness and inter-class separation geometric constraints within a single view, combined with orthogonality regularization to maintain feature independence. Furthermore, it uses KL divergence as a supervision signal to constrain the alignment of the predicted distributions of the augmented views with those of the original views, ensuring that the augmentation process does not destroy the original semantic structure. The synergistic effect of these three factors enables the method to improve classification accuracy while maintaining consistency and diversity in complex graph structures. Attached Figure Description
[0058] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0059] Figure 1 This is a flowchart illustrating a graph representation learning method based on consistency and diversity collaboration, as provided in Example 1.
[0060] Figure 2 This is a schematic diagram of a graph representation learning method based on consistency and diversity collaboration, provided in Example 1.
[0061] Figure 3 This is a schematic diagram illustrating the training process of the graph neural network model provided in Example 1.
[0062] Figure 4 The image shows the classification results of the test set provided in Example 1 after being enhanced by the method of the present invention.
[0063] Figure 5 This is a schematic diagram of a graph representation learning device based on consistency and diversity collaboration, provided in Embodiment 2.
[0064] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0066] Example 1
[0067] Embodiment 1 of the present invention provides a graph representation learning method based on consistency and diversity collaboration, which can be implemented by a graph representation learning device based on consistency and diversity collaboration (hereinafter referred to as graph representation learning device), specifically, executed by one or more processors within the graph representation learning device.
[0068] In this embodiment, the graph representation learning device may be an electronic device equipped with a processor, the processor having a computer program for the graph representation learning method based on consistency and diversity collaboration, and the computer program being executable, such as a computer, smartphone, smart tablet, workstation, etc., without limitation.
[0069] In this embodiment, graph structure data is a data structure composed of nodes (or vertices) and edges, where nodes represent entities or objects, and edges represent relationships or connections between these entities or objects. Graph structure data can be used for social network analysis to reveal community structure, influence propagation, and key nodes in social networks; it can be used to build recommendation systems to provide personalized recommendations by analyzing relationships between users and items; it can be used to analyze bioinformatics data such as genomes, protein-protein interaction networks, and metabolic networks; it can be used to optimize transportation networks by analyzing road connections and traffic flow to provide more efficient traffic planning and route recommendations; it can be used to analyze risk propagation and correlations in banking systems; and it can be used to build knowledge graphs, organizing knowledge into graph structures to better represent relationships and semantic information between entities, etc.
[0070] like Figures 1-2 As shown, a graph representation learning method based on consistency and diversity collaboration includes steps S1 to S5.
[0071] S1: Obtain the original graph structure dataset to be enhanced, and extract the initial node feature matrix, adjacency matrix, and original classification labels.
[0072] In this embodiment, based on the obtained graph structure dataset to be enhanced, an initial node feature matrix and adjacency matrix are constructed, and the dataset is divided into a training set, a validation set, and a test set.
[0073] The initial node feature matrix is used to describe the feature information of the nodes, and the adjacency matrix is used to represent the adjacency relationship between nodes.
[0074] The initial node feature matrix can be obtained by feature extraction and normalization of multi-view or multi-source graph data.
[0075] The adjacency matrix is obtained through the following steps:
[0076] First, based on the feature similarity between nodes (such as Euclidean distance or cosine similarity) in the initial node feature matrix, the neighbor relationships of each node are determined and an initial adjacency graph is constructed.
[0077] Next, structural pruning strategies can be used to remove redundant or low-relevance connections and form key adjacency subgraphs to improve the effectiveness and interpretability of the graph structure.
[0078] Finally, the key adjacency graph is normalized to obtain an adjacency matrix with a complete structure that can be used for subsequent graph representation learning.
[0079] Based on the original classification labels, the node samples can be randomly divided into training set, validation set and test set according to the proportion of categories; the training set is used for model parameter learning, the validation set is used for hyperparameter tuning and model selection, and the test set is used for final model performance evaluation.
[0080] S2, feature masking and edge masking are performed on the initial node feature matrix and the adjacency matrix respectively to randomly discard some node features and edges, generating two enhanced graph structure datasets with different views.
[0081] like Figure 2 As shown, the training set data is first loaded, and existing graph data augmentation methods are used to generate and reconstruct the node feature space, as detailed below:
[0082] A feature masking strategy is adopted, in which some elements in the initial node feature matrix are randomly set to zero with a preset probability, so as to randomly discard some node features and generate the first enhanced feature;
[0083] An edge occlusion strategy is adopted, which randomly sets some non-zero elements in the adjacency matrix to zero with a preset probability, thereby randomly removing some edges and generating a first enhanced adjacency matrix.
[0084] Based on the first enhanced features and the first enhanced adjacency matrix, a first enhanced graph structure dataset is reconstructed; similarly, a second enhanced graph structure dataset is reconstructed.
[0085] In this way, the model can capture more diverse graph structure information and improve the representation ability of graph data.
[0086] S3, by maximizing the mutual information of semantically related nodes, suppressing the similarity of irrelevant nodes, and introducing orthogonality constraints in conjunction with the original classification labels, performs cross-view comparison optimization of the node representations of the augmented graph structure datasets of two different views, so as to balance the semantic consistency of nodes and the diversity between views.
[0087] In this step, augmented graph structure datasets from two different views are input into the cross-view collaboration module. The node representations obtained by different augmentation strategies are compared across views to maximize the mutual information of semantically relevant nodes across different views, while suppressing the similarity of semantically irrelevant nodes, thus preserving the visual integrity of the graph. Figure 1 This ensures consistency, thereby balancing semantic consistency at the node level with diversity between views.
[0088] Specifically, first, the mutual information of the node pairs is calculated, expressed as:
[0089] ;
[0090] in, This represents the feature representation of node i; This represents the positive sample features of node j; Node feature representation (Node Embedding 1) and Positive Node Sample Features Mutual information of (node embedding 2); This refers to the SoftPlus function. ; Discriminator built for neural networks These are the parameters for the discriminator; Represents the expected value of the negative sample distribution; These are the negative sample features obtained by sampling from the negative sample distribution;
[0091] Then, the mutual information loss is minimized using the cross-view collaboration loss function, expressed as:
[0092] ;
[0093] in, This is the cross-view collaboration loss.
[0094] The in-graph calibration module constructs pairs of similar and dissimilar nodes within a single enhanced view based on node pseudo-labels. By bringing similar nodes closer together and dissimilar nodes further apart, orthogonality constraints are introduced. Maintaining the independence between node features ensures not only the diversity of node representations but also avoids excessive smoothing, thus effectively improving feature separation during enhancement. Furthermore, orthogonal loss further constrains the embedding independence during feature transformation, promoting the stability of the graph representation.
[0095] Specifically, within a single enhanced view, pairs of nodes of the same type and pairs of nodes of different types are first constructed based on the original classification labels;
[0096] Then, a contrastive optimization loss training process is performed. Orthogonal regularization constraints are applied to the weight matrix of each layer of the contrastive optimization model. The orthogonality loss function brings similar nodes closer together and pushes dissimilar nodes further apart, thus maintaining the diversity of node features and avoiding over-smoothing. The expression for the orthogonality loss function is:
[0097] ;
[0098] in, Orthogonality loss; These are hyperparameters used to control the strength of orthogonal constraints; To compare and optimize the model Layer weight matrix; For the first A learnable scalar for each layer, used to control the norm of the weight matrix; It is the identity matrix; The Frobenius norm of the matrix; This is the transpose symbol.
[0099] Orthogonal regularization constraints ensure that the weight matrices of each layer remain orthogonal, preventing excessive smoothing of node representations in the network and maintaining diversity, thereby achieving a balance between consistency and diversity in the enhancement effect.
[0100] Traditional graph augmentation methods (such as simple feature perturbation and edge masking) either excessively pursue view diversity, causing the augmented view to deviate from the semantics of the original graph and destroy structural consistency; or they overemphasize semantic consistency, limiting feature space exploration and weakening the model's generalization ability, especially in scenarios with uneven node distribution and sparse structure, where the effect is unstable.
[0101] This application achieves collaborative balance through a two-stage constraint mechanism: first, it ensures node-level semantic consistency by maximizing mutual information between semantically related nodes, and then introduces orthogonality constraints to push away features of dissimilar nodes and maintain feature diversity between views, avoiding oversmoothing; it explicitly constrains the difference in representation distribution between the enhanced view and the original view through KL divergence loss, ensuring that the enhanced view does not deviate from the original semantics, thus solving the dilemma of "consistency-diversity" from a mechanism perspective, making the enhancement effect more stable and controllable.
[0102] Traditional GNNs are prone to "oversmoothing" (convergence of node features and blurring of category boundaries) or "underpropagation" (limited information transmission in sparse graphs) due to defects in information propagation mechanisms, which leads to a decline in the performance of node classification tasks.
[0103] This application introduces orthogonality loss constraints, applying orthogonal regularization to the weight matrix of each layer of the model. This forces the features of nodes of the same type to be brought closer together and the features of nodes of different types to be pushed further away. This preserves the consistency of features within a category and enhances the feature discrimination between categories, thus suppressing oversmoothing at the feature space level. By generating diverse views through feature occlusion and edge occlusion, the information propagation path of the sparse graph is supplemented, alleviating the underpropagation problem. The residual connection and bridging modules of the model can aggregate multi-scale features layer by layer, further improving the discriminativeness and robustness of node features.
[0104] S4. The enhanced graph structure dataset after comparison and optimization and the original graph structure dataset are respectively input into the graph encoder with shared parameters. The difference in representation distribution between the enhanced view and the original view is calculated and minimized to obtain the enhanced graph structure dataset that retains the original semantic information.
[0105] In this embodiment, to maintain the semantic correspondence between the enhanced features and the original features, an original semantic preservation module is introduced. This module processes the enhanced node features and the initial node features in parallel to achieve consistency constraints on the feature distribution of the two, ensuring that the enhanced features improve expressive power while retaining semantic information.
[0106] Specifically, firstly, the enhanced node feature matrix corresponding to the optimized enhanced graph structure dataset and the initial node feature matrix of the original graph structure dataset are input in parallel into a graph encoder with shared weights to obtain the enhanced view representation and the original view representation, respectively.
[0107] Since the two sets of inputs are structurally consistent but differ in feature space, the model can learn the distribution mapping relationship between the enhanced view and the original view while maintaining parameter sharing, thereby ensuring that the enhanced node representation does not deviate from the original semantics.
[0108] Then, the KL divergence loss between the enhanced view representation and the original view representation is calculated, expressed as:
[0109] ;
[0110] in, For KL divergence loss; This represents the total number of nodes in the graph; A set of nodes; Let i be the set of neighboring nodes of node i; The true distribution of node i; The predicted distribution of node i is characterized by the features of its neighbor node j;
[0111] The parameters of the graph encoder are updated in reverse with the goal of minimizing the KL divergence loss to ensure that the augmented view retains the original semantics. Based on the augmented node features and adjacency matrix after minimizing the KL divergence loss, an augmented graph structure dataset that combines augmented information and original semantics is generated.
[0112] Most traditional augmentation methods lack semantic alignment constraints between the augmented view and the original view, which makes it easy for the augmented node representation to lose key topological and feature information of the original graph, affecting the accuracy of downstream tasks.
[0113] This application designs an alignment mechanism using a shared parametric graph encoder and KL divergence loss. The augmented view and the original view are input into the same encoder in parallel. By minimizing the difference in their representation distributions, the augmented view accurately preserves the original semantics. This explicit alignment constraint solves the problem of "augmentation loss" in traditional methods, ensuring that the augmented dataset possesses both diversity and the core discriminative information required for node classification.
[0114] S5 inputs the enhanced graph structure dataset that retains the original semantic information into the graph neural network model for graph representation learning and training, in order to optimize the graph representation of the dataset and obtain the optimal node representation and the trained graph representation learning model, which is then used for node classification task prediction.
[0115] In this embodiment, the enhanced graph structure dataset, optimized by the consistency module, the difference module, and the original semantic preservation module, is input into the graph neural network model for feature learning and node classification training. Through joint optimization of enhanced features and adjacency structure by the graph neural network model, the model can balance the integrity of node feature representation with the consistency of graph structure information, thereby obtaining the optimal node representation and a stable graph representation learning model.
[0116] Specifically, the graph neural network model includes several Dropout layers, several graph convolutional layers (GNNConv), ReLU activation layers, and an output layer. The Dropout layers are used to randomly discard the outputs of some neurons during training with a set probability (e.g., 0.5), preventing them from participating in computation during forward and backward propagation and thus preventing overfitting. During the testing phase, the outputs of all neurons are retained and adjusted by scaling to ensure that the expected values of the input and output are consistent.
[0117] Graph Convolutional Layers (GNNConv) are a core component of graph neural networks. They are used to update the representation of each node by aggregating information from its neighbors, thereby extracting effective features from the graph structure. This layer updates the representation of each node by aggregating information from its neighbors, thus extracting effective features from the graph structure. GNNConv layers can efficiently learn the relationships between nodes and the structural features of the graph from graph data, and are widely used in tasks such as node classification, graph classification, and link prediction. By stacking multiple GNNConv layers, the model can learn more complex graph structural features.
[0118] The ReLU (Rectified Linear Unit) activation layer is used to introduce a non-linear transformation, setting the portion of the input value less than zero to zero and retaining the portion greater than zero, thereby enhancing the model's ability to learn complex features. ReLU layers are widely used in graph neural networks due to their simple calculation method and fast training speed, and can effectively alleviate the gradient vanishing problem. Typically, the ReLU layer follows the graph convolutional layer to introduce necessary non-linear characteristics into the network.
[0119] The output layer is used to predict the category of each node and generate the final prediction result.
[0120] like Figure 3 As shown in the diagram, the learning and training process is as follows:
[0121] First, the input node feature matrix is processed by the Dropout layer and then input into the first graph convolutional layer for feature extraction. After feature normalization by the batch normalization layer, the first output feature is obtained.
[0122] Next, the first output feature is subjected to a nonlinear transformation through the ReLU activation function and then processed by the Dropout layer. The output data is input into the second graph convolutional layer for feature aggregation. After downsampling and batch normalization, the feature is normalized to obtain the second output feature.
[0123] The first output feature and the second output feature are concatenated along the channel dimension;
[0124] The features after convolution in each layer are extracted layer by layer through residual connections;
[0125] The features output from each layer are concatenated again and processed through multiple bridging modules. Each bridging module includes a convolutional layer, a batch normalization layer, and an activation function. By reducing the spatial dimension of the features, feature compression and integration are performed to obtain the final node feature representation.
[0126] The final node feature representation is input into a fully connected layer for processing to further compress the channel dimension of the features and reduce the number of parameters. After batch normalization and activation functions, a stable optimal node representation is obtained, which is then used for prediction in node classification tasks.
[0127] During training, the cross-entropy loss for feature enhancement and node classification is calculated via backpropagation. The final joint optimization loss function is then used. as follows:
[0128] ;
[0129] in, , , These are the weight hyperparameters for cross-view collaboration, intra-graph calibration, and semantic preservation-related losses, respectively. For mutual information loss in cross-view collaboration modules, This represents the orthogonality loss of the in-figure calibration module; This is the KL divergence loss during the semantic preservation phase.
[0130] By minimizing this joint optimization loss function, the model can maintain the consistency of the graph structure while preserving the diversity of enhanced features, thereby obtaining the optimal node representation and the trained graph representation learning model.
[0131] The cross-entropy loss function can be used to optimize the final node classification results during training. Alternatively, other existing loss functions, such as mean squared error loss, root mean square error loss, and Huber loss, can also be selected for optimization training; no specific limitation is made here. During actual training, the weight coefficients α, β, and γ can be dynamically adjusted based on data features and task complexity to further improve model performance, ensuring the stability and high accuracy of graph representation learning under multi-view augmentation conditions.
[0132] The test set is input into the trained graph representation learning model for testing and evaluation to obtain the evaluated graph representation learning model.
[0133] During evaluation, four key metrics—Classification Accuracy (ACC), Mean Precision (MaP), Mean Recall (MaR), and Macro-mean F1 Score (MaF)—are used to comprehensively assess the model's node classification performance and overall generalization ability under multi-view augmentation conditions. Specifically, ACC reflects overall prediction accuracy, MAP measures the predictive balance between categories, MAR reflects the model's recall ability, and MAF is used to evaluate overall classification robustness.
[0134] Some complex augmentation methods (such as subgraph sampling and view generation based on generative models) have high computational costs and are highly dependent on the structure of GNN models, making them difficult to adapt to graph networks with different architectures.
[0135] The enhancement operations in this application are based solely on feature occlusion and edge occlusion, eliminating the need for complex subgraph partitioning or generation models. This results in low computational overhead and ease of engineering implementation. The graph neural network architecture (including Dropout, residual connections, and bridging modules) is a general modular design that is compatible with mainstream models such as GCN / GAT / GraphSAGE. Furthermore, by using channel concatenation and feature compression to reduce parameter size, performance is improved while controlling training costs and avoiding overfitting.
[0136] The augmented samples generated by traditional methods are prone to introducing harmful noise, and the models have low tolerance for graph structure changes and feature noise, resulting in weak generalization ability on heterogeneous and sparse complex graph data.
[0137] This application enables the model to learn more robust node representations through multi-view comparison optimization and semantic alignment, which can effectively resist feature noise and structural perturbations. The combination of orthogonality constraints and cross-view collaborative loss allows the model to capture the topological relationships of the graph and distinguish the feature differences of different types of nodes. The final generated "optimal node representation" takes into account semantic consistency, feature diversity and discriminability, which can directly improve the accuracy and stability of node classification tasks, and is especially suitable for complex scenarios with uneven node distribution and blurred category boundaries.
[0138] In a preferred embodiment, the method of the present invention is tested using publicly available standard graph neural network datasets, including four commonly used single-view graph datasets: ACM, CiteSeer, Cora_ML, and Twitch_DE. Specifically, the ACM dataset contains 3025 nodes and 13843 edges, with a node feature dimension of 1870; the LastFMAsia dataset contains 7624 nodes and 55612 edges, with a node feature dimension of 3703; the Cora_ML dataset contains 2995 nodes and 16516 edges, with a node feature dimension of 2879; and the Twitch_DE dataset contains 9498 nodes and 153138 edges, with a node feature dimension of 3177.
[0139] During training and testing, the model uses standard graph construction methods, representing the relationships between nodes in the form of an adjacency matrix, and performs graph convolution propagation based on the enhanced node features.
[0140] like Figure 4 As shown, the comparison results of the graph representation learning model optimized by consistency and diversity on different datasets are presented. It can be seen that the method proposed in this invention significantly improves node classification accuracy and overall performance on multiple public graph datasets. Through the collaborative optimization of the consistency module and the diversity module, the model can enhance feature diversity while maintaining semantic consistency, thereby achieving classification performance superior to traditional graph neural networks (such as GCN, GAT, GraphSAGE, APPNP, etc.) on the aforementioned datasets.
[0141] in, Figure 4 The English meanings of the characters are as follows:
[0142] GCN (Graph Convolutional Network): The core of GCN is to perform convolution operations based on the aggregation of information in the neighborhood of nodes. It updates the node representation by weighted summation of the node’s own features and the features of its neighboring nodes, and then by nonlinear transformation. It can effectively explore the local correlations of the graph structure and is suitable for basic tasks such as node classification and graph classification.
[0143] GAT (Graph Attention Network): The core of a graph attention network is to assign adaptive weights to different neighbor nodes. When aggregating neighborhood information, GAT calculates the attention coefficient between the target node and each neighbor, giving higher weights to important neighbors, thus solving the problem of fixed neighbor weights in GCN.
[0144] GraphSAGE (Graph Sample and Aggregate): A graph embedding learning model based on sampling and aggregation, with the core strategy of "sampling + aggregation". Traditional GCN requires loading the entire graph for computation, while GraphSAGE randomly samples the neighborhood of each node and then integrates the neighborhood features through aggregation functions such as mean and pooling. It is suitable for large-scale graph scenarios such as social networks and recommendation systems.
[0145] APPNP (Approximate Personalized Propagation of Neural Predictions): This graph neural network optimizes node representations through approximate personalized propagation. It propagates the initial predicted features of nodes across the graph multiple times, while retaining node information through residual connections. This balances the transmission of local structure and global information, resulting in a simple and computationally efficient model commonly used for node classification tasks.
[0146] Original: The handling method without graph enhancement was not added.
[0147] GAUGM is a graph augmentation method based on augmented view filtering. Its core principle is to generate multiple augmented graph views and filter out low-quality views. Different views are generated by perturbing node features and adding / removing edges from the original graph. Invalid views are then filtered out based on view validity metrics, retaining only high-quality views for model training, thus improving the model's robustness.
[0148] LAGNN: Local Augmentation Graph Neural Network. Its core principle is to enhance the local neighborhood of nodes. For each node's local subgraph, it generates enhanced subgraphs by randomly adding / removing edges and perturbing node features. Then, it combines these with aggregation mechanisms like GCN or GAT to learn node representations, strengthening the model's adaptability to changes in local structure.
[0149] NodeMixup is a linear interpolation enhancement method for node features. Its core principle is to generate new nodes by linearly interpolating the features of two nodes. Borrowing the Mixup concept from the image processing domain, it randomly selects a pair of nodes and interpolates their feature vectors according to certain weights. Simultaneously, the corresponding labels are also weighted, effectively mitigating overfitting and improving the model's generalization ability.
[0150] DropMessage: A graph augmentation strategy based on message dropping, its core is to randomly discard some messages during message passing in the graph model. In the neighborhood aggregation stage, the feature transmission of some neighboring nodes is blocked with a certain probability, forcing the model to learn more robust node representations and avoiding over-reliance on specific neighbors, similar to the Dropout mechanism in deep learning.
[0151] The experimental results show that the graph representation learning method based on consistency and diversity collaboration described in this invention is superior to existing technologies in terms of node classification accuracy, generalization ability and model stability, and achieves the organic unity of enhancing graph structure semantic preservation and learning diverse features.
[0152] In summary, compared with the prior art, the present invention has the following beneficial effects:
[0153] (1) This invention solves the core contradiction of “consistency-diversity” in traditional enhancement methods, achieves a synergistic balance between the two, and resolves the dilemma of “consistency-diversity” from a mechanism perspective, making the enhancement effect more stable and controllable.
[0154] (2) The present invention can effectively alleviate the “oversmoothing / underpropagation” problem of traditional GNN and improve the discriminative power of node features.
[0155] (3) The present invention can achieve explicit semantic alignment between the enhanced view and the original view, avoiding the loss of key discrimination information.
[0156] (4) This invention can enhance the lightweight and universality of the strategy, while taking into account both training efficiency and model adaptability.
[0157] (5) This invention enhances the robustness and generalization ability of node representation, thereby improving the performance of downstream node classification tasks.
[0158] Example 2
[0159] like Figure 5 As shown, the second embodiment of the present invention also provides a graph representation learning device based on consistency and diversity collaboration, comprising:
[0160] The data acquisition unit is used to acquire the original graph structure dataset to be enhanced and extract the initial node feature matrix, adjacency matrix and original classification labels;
[0161] The graph data augmentation unit is used to perform feature occlusion and edge occlusion on the initial node feature matrix and the adjacency matrix respectively, so as to randomly discard some node features and edges and generate two augmented graph structure datasets with different views.
[0162] The consistency-diversity balancing unit is used to optimize the node representations of two different views of the augmented graph structure dataset by maximizing the mutual information of semantically related nodes, suppressing the similarity of irrelevant nodes, and introducing orthogonality constraints in conjunction with the original classification labels, so as to balance the semantic consistency of nodes and the diversity between views.
[0163] The semantic preservation unit is used to input the contrast-optimized enhanced graph structure dataset and the original graph structure dataset into a graph encoder with shared parameters, calculate and minimize the difference in representation distribution between the enhanced view and the original view, and obtain an enhanced graph structure dataset that retains the original semantic information.
[0164] The model training unit is used to input the enhanced graph structure dataset that retains the original semantic information into the graph neural network model for graph representation learning and training, so as to optimize the graph representation of the dataset, obtain the optimal node representation and the trained graph representation learning model, and use it for node classification task prediction.
[0165] Example 3
[0166] The third embodiment of the present invention also provides a graph representation learning device based on consistency and diversity collaboration, which includes a memory and a processor. The memory stores a computer program that can be executed by the processor to implement the graph representation learning method based on consistency and diversity collaboration as described above.
[0167] Example 4
[0168] The fourth embodiment of the present invention also provides a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor of the device where the computer-readable storage medium is located, implement the graph representation learning method based on consistency and diversity collaboration as described above.
[0169] In the several embodiments provided in this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus and method embodiments described above are merely illustrative. For example, the flowcharts in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0170] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0171] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0172] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0173] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0174] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0175] The use of "first" and "second" in the embodiments is merely to distinguish similar objects and does not represent a specific ordering of objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permitted. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments described herein can be implemented in an order other than those illustrated or described herein.
[0176] 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. A graph representation learning method based on consistency and diversity collaboration, characterized in that, The method comprises the following steps: S1, obtaining an original graph structure data set to be enhanced, and extracting an initial node feature matrix, an adjacency matrix and an original classification label; S2, performing feature masking and edge masking on the initial node feature matrix and the adjacency matrix respectively to randomly discard part of the node features and edges, and generating two enhanced graph structure data sets of different views; S3, optimizing the node representation of the two enhanced graph structure data sets of different views by maximizing the mutual information of semantically related nodes, suppressing the similarity of irrelevant nodes, and introducing orthogonality constraints combined with the original classification label, to balance the node-level semantic consistency and the diversity between views; S4, inputting the contrast-optimized enhanced graph structure data set and the original graph structure data set into a graph encoder with shared parameters respectively, calculating and minimizing the representation distribution difference between the enhanced view and the original view, and obtaining an enhanced graph structure data set that retains the original semantic information; S5, inputting the enhanced graph structure data set that retains the original semantic information into a graph neural network model for graph representation learning and training, to optimize the graph representation of the data set, and obtain an optimal node representation and a trained graph representation learning model for node classification task prediction; Wherein, by maximizing the mutual information of semantically related nodes and suppressing the similarity of irrelevant nodes, the specific steps are as follows: First, calculate the mutual information of node pairs, the expression is: ; wherein, represents a feature representation of node i; represents a positive sample feature of node j; represents a node feature representation mutual information of a node positive sample feature ; represents a SoftPlus function; is a discriminator constructed for the neural network, is a discriminator parameter; represents an expectation of a negative sample distribution; is a negative sample feature sampled from the negative sample distribution; Then minimize the mutual information loss by a cross-view collaborative loss function, the expression is: ; wherein, is a cross-view collaborative loss; Introducing orthogonality constraints combined with the original classification label, the specific steps are as follows: First, within a single enhanced view, construct same-class node pairs and different-class node pairs according to the original classification label; Then, perform contrast optimization loss training, apply orthogonal regularization constraints to each layer weight matrix of the contrast optimization model, and use an orthogonality loss function to bring same-class node features closer and different-class node features farther apart, to maintain the diversity of node features and avoid over-smoothing; the expression of the orthogonality loss function is: ; in, Orthogonality loss; These are hyperparameters used to control the strength of orthogonal constraints; To compare and optimize the model Layer weight matrix; For the first A learnable scalar for each layer, used to control the norm of the weight matrix; It is the identity matrix; The Frobenius norm of the matrix; This is the transpose symbol.
2. The method of claim 1, wherein the method is based on consistency and diversity collaboration. Respectively performing feature and edge masking on the initial node feature matrix and the adjacency matrix to randomly discard part of the node features and edges, the specific steps are as follows: Using a feature masking strategy, randomly set part of the elements in the initial node feature matrix to zero with a preset probability, to randomly discard part of the node features and generate a first enhanced feature; Using an edge masking strategy, randomly set part of the non-zero elements in the adjacency matrix to zero with a preset probability, to randomly remove part of the edges and generate a first enhanced adjacency matrix; According to the first enhanced feature and the first enhanced adjacency matrix, a first enhanced graph structure data set is reconstructed; similarly, a second enhanced graph structure data set is reconstructed.
3. The method of claim 1, wherein the method is based on consistency and diversity collaboration. The S4 specifically comprises: First, input the enhanced node feature matrix corresponding to the contrast-optimized enhanced graph structure data set and the initial node feature matrix of the original graph structure data set into a graph encoder with shared weights in parallel, to obtain an enhanced view representation and an original view representation respectively; Then, calculate the KL divergence loss of the enhanced view representation and the original view representation, the expression is: ; wherein, is the KL divergence loss; is the total number of nodes in the graph; is the set of nodes; is the set of neighbor nodes of node i; is the true distribution of node i; is the predicted distribution of node i, characterized by the features of neighbor node j; The parameters of the graph encoder are updated in reverse to minimize the KL divergence loss, to ensure that the enhanced view retains the original semantics, and to generate an enhanced graph structure dataset that combines enhanced information and original semantics.
4. The method of claim 1, wherein the method is based on consistency and diversity collaboration. The graph neural network model comprises a plurality of Dropout layers, a plurality of graph convolution layers, a ReLU activation layer, and an output layer. The Dropout layer is used to randomly discard the outputs of part of the neurons during the training process to prevent overfitting. The graph convolution layer is used to update the representation of each node by aggregating the information of the node neighbors, thereby extracting effective features in the graph structure. The ReLU activation layer is used to introduce a nonlinear transformation by setting the part of the input value less than zero to zero and retaining the part greater than zero, to enhance the ability of the model to learn complex features. The output layer is used to predict the category of each node and generate the final prediction result. The process of graph representation learning and training is as follows: First, the input node feature matrix is processed by the Dropout layer and then input into the first graph convolution layer for feature extraction, and the feature normalization is performed by the batch normalization layer to obtain the first output feature. Next, the first output feature is introduced into the nonlinear transformation by the ReLU activation function, and then processed by the Dropout layer again, and the output data is input into the second graph convolution layer for feature aggregation, and the feature normalization is performed by the down-sampling processing and the batch normalization layer to obtain the second output feature. The first output feature and the second output feature are spliced in the channel dimension. The features of each layer after convolution processing are connected by residual connection for feature extraction. The features output by each layer are spliced in the channel again and processed by a plurality of bridge modules; each bridge module comprises a convolution layer, a batch normalization layer, and an activation function, which reduces the spatial dimension of the features for feature compression and integration to obtain the final node feature representation. The final node feature representation is input into the fully connected layer for processing to further compress the channel dimension of the features and reduce the number of parameters; after batch normalization and activation function, the stable optimal node representation is obtained.
5. An apparatus for graph representation learning based on consistency and diversity collaboration, configured to implement the method for graph representation learning based on consistency and diversity collaboration according to any one of claims 1-4. The data acquisition unit is configured to acquire the original graph structure dataset to be enhanced, and extract the initial node feature matrix, the adjacency matrix, and the original classification label. The graph data enhancement unit is configured to perform feature masking and edge masking on the initial node feature matrix and the adjacency matrix respectively to randomly discard part of the node features and edges, and generate two enhanced graph structure datasets in different views. The consistency and diversity balancing unit is configured to maximize the mutual information of the semantically related nodes, suppress the similarity of the irrelevant nodes, and introduce orthogonal constraints combined with the original classification label, to compare and optimize the node representations of the two enhanced graph structure datasets in different views across views, to balance the node-level semantic consistency and the diversity between views. The semantic preservation unit is configured to input the contrast-optimized enhanced graph structure dataset and the original graph structure dataset into the graph encoder sharing the parameters, calculate and minimize the representation distribution difference between the enhanced view and the original view, to obtain the enhanced graph structure dataset retaining the original semantic information. The model training unit is configured to input the enhanced graph structure data set retaining the original semantic information into a graph neural network model to perform graph representation learning and training, so as to optimize the graph representation of the data set, obtain optimal node representation and a trained graph representation learning model, and predict a node classification task.
6. A device for graph representation learning based on consistency and diversity collaboration, characterized in that, The computer program can be executed by the processor to implement the graph representation learning method based on consistency and diversity collaboration according to any one of claims 1-4.
Citation Information
Patent Citations
Graph network model node classification method and device, equipment and storage medium
CN114611609A
Semi-supervised graph neural network method for unmarked sample enhancement
CN116108917A