A method and system for coding and decoding graph embeddings based on RNNs without attribute graphs
By using an RNN-based encoding and decoding graph embedding method, and leveraging two-hop subgraphs in the topological structure and BFS reverse training samples, the feature extraction problem of graph data without node attributes is solved, achieving more accurate graph embedding and structural reconstruction, and is suitable for graph data without node attributes.
Patent Information
- Application Number
- CN202410518298.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2044-04-28
AI Technical Summary
Existing graph embedding methods based on graph structure rely on node attribute information, which is not suitable for graph data without node attributes and cannot effectively capture the overall structural features of the graph.
An RNN-based encoding and decoding graph embedding method is adopted. By constructing an encoder and decoder with a dual RNN structure, and using two-hop subgraphs in the topology and BFS reverse training samples, the structural features of nodes are extracted and reconstructed to achieve encoding and decoding of attribute-free graphs.
It effectively captures the hierarchical structure and neighborhood relationships of graphs, improves the expressive power of node structural features and the accuracy of graph embedding, and is suitable for graph data without node attributes.
Smart Images

Figure CN118427404B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph embedding methods in graph neural networks, and more particularly to an encoding and decoding graph embedding method for attributeless graphs based on RNNs. Background Technology
[0002] Graph structures are widely present in various real-world applications. For example, in social media, the relationships between users form a vast social graph network; in recommendation systems, user behaviors such as purchasing, browsing, and rating products can be abstracted as an interaction graph between users and products. In most practical applications, such as internet topology, transportation networks, and electronic communications, node attribute information may be missing due to privacy, incomplete data, or unavailability, making it unsuitable for direct application to graph analysis without node attributes. Therefore, it is necessary to rely on graph structures to analyze the connections and topological structure between nodes and extract neighborhood information. When analyzing graphs without node attributes, the prerequisite is to obtain node embeddings through the connections between nodes, generating a quantifiable code to identify the structural features of nodes in the graph, which can then be applied to various graph analysis and graph mining tasks such as node classification, link prediction, and graph classification.
[0003] Graph embedding, a technique that maps nodes in a graph to a low-dimensional vector space, can encode graphs without node attributes, quantify the connections and similarities between nodes, obtain the structural features of nodes, and capture the structural information in the graph.
[0004] Previous research has categorized graph embedding methods into two types: those based on node attributes and graph structure, and those based on graph structure. Node attribute and graph structure-based methods, represented by GCN and GraphSAGE, use node attribute features and graph structure as input, aggregating information from neighboring nodes to obtain node embedding vectors. However, these methods rely on node attribute information and are not suitable for graph data without node attributes. Graph structure-based methods, represented by DeepWalk and Node2Vector, use graph structure information as a foundation to construct a similarity loss function between node embeddings, achieving unsupervised learning (Encoder-loss). These methods primarily focus on local node similarity, failing to fully consider the overall graph structure. Furthermore, these methods typically depend on the settings of hyperparameters, such as the number of random walk steps and the number of samples; different parameter choices lead to different embedding results. Summary of the Invention
[0005] This invention addresses the problem that existing graph embedding methods based on graph structures rely on node attribute information and are not suitable for graph data without node attributes. It proposes a graph embedding method for encoding and decoding attributeless graphs based on RNNs, the method comprising:
[0006] S1: Take the two-hop subgraph centered on node v in the topology as the neighborhood subgraph v-graph of node v, and take the BFS reverse order corresponding to the neighborhood subgraph as the training sample.
[0007] S2: Construct an encoder with a dual RNN structure, encode the neighborhood subgraph v-graph of node v according to the encoder based on the time-series model RNN, and obtain the structural features v-emb of node v;
[0008] S3: Construct a decoder with a dual RNN structure, and reconstruct the structural features v-emb of node v according to the decoder with the dual RNN structure to obtain the reconstructed back-neighbor subgraph.
[0009] Furthermore, a preferred embodiment is proposed, wherein the encoder with a dual RNN structure in step S2 is composed of a Node RNN and an Edge RNN.
[0010] Furthermore, a preferred embodiment is proposed, wherein step S2 includes:
[0011] The node sequence is input into the Node RNN, and the Node RNN is used as the basic architecture of the encoder.
[0012] The reverse result of BFS node sorting of the neighborhood subgraph v-graph is used as the input of the encoder.
[0013] The neighborhood features of each node are used as the input features h of that node, and the neighborhood features of the current node are extracted through Edge RNN.
[0014] The adjacency vector of node v and the reverse result of BFS node sorting is used as the input time sequence, and the structural features of node v are obtained using Edge RNN.
[0015] Furthermore, a preferred approach is proposed, in which the neighborhood characteristics of a node are determined by the connection status of the node with other nodes and the ranking of the node's neighboring nodes; the higher the ranking, the greater the impact on the neighborhood characteristics of the node.
[0016] Furthermore, a preferred method is proposed, wherein the adjacency vector of node v and the reverse result of BFS node sorting is used as the input time sequence, and the structural features of node v are obtained using Edge RNN as follows:
[0017]
[0018] Among them, v i For nodes, emb represents structural features. Represents a node The neighborhood characteristics.
[0019] Furthermore, a preferred method is proposed, wherein the node The neighborhood features are determined by the nodes The adjacent vector sequence is input into the Edge RNN to obtain the following:
[0020]
[0021] in, It is the kth node in the node sorting. and The sequence of adjacency vectors that are either 0 or 1, where:
[0022]
[0023] Furthermore, a preferred embodiment is proposed, wherein the decoder with a dual RNN structure in step S3 is composed of a Node RNN structure and an Edge RNN structure, and v i -emb is used as input to the Node RNN to generate new nodes. and characteristics The specific calculation formula is as follows:
[0024]
[0025] Features of newly generated nodes The start symbol SOS is used as input to the Edge RNN for newly generated nodes. With existing nodes Perform connection generation and discrimination to obtain The specific calculation formula is as follows:
[0026]
[0027] Based on the same inventive concept, this invention also proposes an attribute-free graph encoding and decoding embedding system based on RNN, the system comprising:
[0028] The neighborhood subgraph construction unit is used to take the two-hop subgraph centered on node v in the topology as the neighborhood subgraph v-graph of node v, and use the BFS reverse order corresponding to the neighborhood subgraph as training samples.
[0029] The encoding unit is used to construct an encoder with a dual RNN structure, which encodes the neighborhood subgraph v-graph of node v according to the encoder based on the time-series model RNN, and obtains the structural features v-emb of node v.
[0030] The reconstruction unit is used to construct a decoder with a dual RNN structure. Based on the decoder with the dual RNN structure, the structural features v-emb of node v are reconstructed to obtain the reconstructed back-neighbor subgraph.
[0031] Based on the same inventive concept, the present invention also proposes a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes an RNN-based encoding and decoding graph embedding method as described in any of the preceding claims.
[0032] Based on the same inventive concept, the present invention also proposes a computer-readable storage medium for storing a computer program that executes the above-described method for encoding and decoding graphs of attributeless graphs based on RNN.
[0033] The advantages of this invention are:
[0034] This invention solves the problem that existing graph embedding methods based on graph structures rely on node attribute information and are not suitable for graph data without node attributes.
[0035] (1) The present invention proposes an RNN-based encoding and decoding graph embedding method for attributeless graphs. The Encoder-Decoder architecture is used as the encoding scheme for graphs without node attributes, so that the node structure features after model training can fully reflect the neighborhood relationship and context of the nodes, and enhance the expressive power of the node structure features. It is suitable for graph data without node attributes.
[0036] (2) The present invention proposes an encoding and decoding graph embedding method for attributeless graphs based on RNN. The encoder uses the temporal model RNN to encode the hierarchical structure of the graph. By utilizing the short-term memory characteristics of RNN, the influence of the node hierarchy on the node structure features in the node context environment is fully simulated, so that the encoded node structure features are more consistent with the hierarchical structure of the graph.
[0037] (3) The present invention proposes an encoding and decoding graph embedding method for attributeless graphs based on RNN. The Decoder uses the time-series model RNN to reconstruct the graph. By utilizing the recurrent mechanism and short-term memory characteristics of RNN, the weight of nodes and the correlation between nodes in the neighborhood relationship are fully simulated, so that the reconstructed graph structure is more consistent with the neighborhood distribution of the original graph.
[0038] This invention is applied to the field of Internet topology. Attached Figure Description
[0039] Figure 1 This is a diagram of the overall framework of G-ESD as described in Implementation Method 1;
[0040] Figure 2 This is a schematic diagram of the neighborhood subgraph constructed as described in Implementation Method 1;
[0041] Figure 3 The diagram shows the Encoder framework as described in Implementation Method 3, where BFS reverse order represents the reverse order of the breadth-first traversal results.
[0042] Figure 4 This is a diagram of the Decoder framework described in Implementation Method Seven. Detailed Implementation
[0043] 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 some embodiments of the present invention, and not all embodiments.
[0044] Implementation Method 1, see Figure 1 and Figure 2 This embodiment describes an encoding / decoding graph embedding method for attribute-free graphs based on RNNs. The method includes:
[0045] S1: Take the two-hop subgraph centered on node v in the topology as the neighborhood subgraph v-graph of node v, and take the BFS reverse order corresponding to the neighborhood subgraph as the training sample.
[0046] S2: Construct an encoder with a dual RNN structure, encode the neighborhood subgraph v-graph of node v according to the encoder based on the time-series model RNN, and obtain the structural features v-emb of node v;
[0047] S3: Construct a decoder with a dual RNN structure, and reconstruct the structural features v-emb of node v according to the decoder with the dual RNN structure to obtain the reconstructed back-neighbor subgraph.
[0048] In graph data, node features include node attribute features and node structural features. Node attribute features are features extracted based on the inherent attributes of the node (e.g., in a social network, a user's name, hobbies, etc.), and are a quantitative expression of the inherent attributes of the node. Node structural features are features extracted based on the context of the node. These features do not consider the attribute information of the node and are a quantitative expression of the topological structure of the node's neighborhood.
[0049] By fusing node attribute characteristics and node structural characteristics, the features of nodes can be fully expressed from both node attributes and topological structure perspectives, thereby improving the effectiveness of graph data analysis. To this end, this implementation method is designed as follows: Figure 1 The overall algorithm architecture shown (G-ESD) is divided into two branches: branch a uses a graph neural network (GCN) to extract node attribute features from the graph; however, branch b does not consider node attribute features and only extracts structural features of nodes based on the graph's topology, including:
[0050] Step 1: Construct the neighborhood subgraph. A two-hop subgraph centered on node v is used as the neighborhood subgraph (v-graph) of node v. The BFS inversion corresponding to the neighborhood subgraph is used as training samples to reflect the hierarchical relationships and weights between node neighborhoods, thus obtaining a node neighborhood subgraph that reflects the context of a node. In the v-graph, nodes farther away from node v (higher level) have a smaller influence on node v.
[0051] Step 2, Encoder: The goal of the encoder is to encode the neighborhood subgraph (v-graph) of node v. When extracting structural features from node v, the hierarchical weights and node ranking in the v-graph need to be considered. Therefore, an encoder with a dual RNN structure is used for this purpose.
[0052] Step 3: Decoder: The goal of the decoder is to reconstruct the structural features (v-emb) of node v back into a neighborhood subgraph (v-graph) in the graph generation process. The graph generation process needs to address the issues of node number generation and connection generation between nodes. Due to the uncertainty of the number of nodes, models with fixed-dimensional output (such as MLP, GCN, etc.) cannot be used for node generation. Therefore, this implementation uses Node RNN-Decoder as the basic framework for node generation, utilizing the recurrent generation mechanism of RNN to achieve dynamic node generation, thus solving the uncertainty problem of node number generation. Using Edge RNN-Decoder as the basic framework, newly generated nodes are distinguished from existing nodes, and connection generation is performed on newly generated nodes according to the rank sequence.
[0053] This embodiment proposes an RNN-based encoding and decoding graph embedding method for attributeless graphs. It uses an Encoder-Decoder architecture as the encoding scheme for graphs without node attributes, so that the node structure features after model training can fully reflect the neighborhood relationships and context of the nodes, thereby enhancing the expressive power of node structure features and making it suitable for graph data without node attributes.
[0054] This embodiment proposes an RNN-based encoding and decoding graph embedding method for attribute-free graphs. The encoder uses a temporal RNN model to encode the hierarchical structure of the graph. By utilizing the short-term memory characteristics of RNN, it fully simulates the influence of node hierarchy on node structural features in the node context, making the encoded node structural features more consistent with the hierarchical structure of the graph.
[0055] This embodiment proposes an RNN-based encoding and decoding graph embedding method for attribute-free graphs. The decoder uses a temporal RNN model to reconstruct the graph. By utilizing the recurrent mechanism and short-term memory characteristics of RNN, it fully simulates the weights of nodes and the correlation between nodes in the neighborhood relationship, making the reconstructed graph structure more consistent with the neighborhood distribution of the original graph.
[0056] This implementation proposes an RNN-based encoding and decoding graph embedding method for attribute-free graphs. Centered on node v, it extracts its two-hop neighborhood subgraphs as v-graphs and uses the BFS inversions corresponding to these neighborhood subgraphs as training samples. This step enables the model to capture structural information surrounding nodes without relying on node attributes. A dual-RNN encoder encodes the neighborhood subgraphs of node v. This encoder effectively captures the structural features of the subgraphs surrounding the node, unaffected by node attributes. Through the encoder, the structural feature v-emb of node v can be obtained, which contains important information about the neighborhood subgraphs surrounding node v. A dual-RNN decoder reconstructs the structural feature v-emb of node v, thereby obtaining the reconstructed back-neighborhood subgraphs. This decoder can reconstruct the neighborhood subgraphs of node v based on the node structural features generated by the encoder, thus achieving decoding and reconstruction of the graph structure. Significant advancements of this method include:
[0057] Unlike existing methods that rely on node attribute information, this implementation proposes an RNN-based encoding and decoding graph embedding method for attribute-free graphs, which is entirely based on the graph's topological structure information, making it suitable for graph data without node attributes. This characteristic makes the method more general and applicable to a wider range of scenarios. By using node-centric two-hop neighborhood subgraphs and combining them with BFS reverse training samples, this method can effectively capture the global structural information of the graph. This helps to preserve more graph topological features, thereby improving the quality and expressive power of the embedding. The encoder and decoder, employing a dual RNN structure, can better handle serialized data and better capture long-term dependencies in the sequence. This structure can better preserve the correlation between node neighborhoods, thereby improving the accuracy and stability of graph embedding.
[0058] Implementation Method 2: This implementation method further defines the RNN-based encoding and decoding graph embedding method for attribute-free graphs described in Implementation Method 1. In step S2, the encoder with a dual RNN structure consists of a Node RNN and an Edge RNN.
[0059] The dual-RNN encoder consists of two parts: a Node RNN and an Edge RNN, which separately process node sequences and node neighborhood information. The Node RNN handles the node sequences, while the Edge RNN specifically processes the information of the node neighborhood. This separation helps the model better understand the relationships and topological structure between nodes, thereby improving the quality and expressive power of the embedding. Since the Edge RNN is specifically responsible for extracting features from the node neighborhood, it can capture the relationships between nodes and their neighbors more precisely. By considering the connection states of nodes and the ordering information of neighboring nodes, the Edge RNN can more accurately describe the neighborhood structure of nodes, thus providing richer information for graph embedding. Combining the Node RNN and Edge RNN to form a dual-RNN encoder gives the model higher expressive and modeling capabilities. The Node RNN is responsible for capturing the features of the node sequences, while the Edge RNN is responsible for capturing the structural features of the node neighborhoods. The combination of the two can comprehensively understand the structural information of the graph, thereby better completing the task of encoding graph embedding.
[0060] Implementation Method 3, see below Figure 3 This embodiment describes a further limitation of the RNN-based encoding / decoding graph embedding method for attribute-free graphs described in Embodiment 2. Step S2 includes:
[0061] The node sequence is input into the Node RNN, and the Node RNN is used as the basic architecture of the encoder.
[0062] The reverse result of BFS node sorting of the neighborhood subgraph v-graph is used as the input of the encoder.
[0063] The neighborhood features of each node are used as the input features h of that node, and the neighborhood features of the current node are extracted through Edge RNN.
[0064] The adjacency vector of node v and the reverse result of BFS node sorting is used as the input time sequence, and the structural features of node v are obtained using Edge RNN.
[0065] Specifically, this implementation method adopts the following... Figure 3 The encoder is designed using a dual RNN structure (outer Node RNN, inner Edge RNN). A Node RNN with a node sequence as input is used as the basic architecture of the encoder. Leveraging the short-term memory characteristic of RNNs, the influence of node hierarchy and order on node structural features is emphasized. Since RNNs are short-term memory recurrent networks, the closer to the end of the node sequence during the RNN's recurrence, the greater the influence on the encoding of node v. Regarding node ordering, BFS is a level-first node ordering algorithm, and its ordering results reflect a hierarchical structure. In the BFS sequence of the v-graph, node v is the first element, and nodes with higher levels are ordered further down the sequence. Therefore, this implementation uses the reverse result of the BFS node ordering of the v-graph as the input of the encoder.
[0066] Since RNNs take the previous output and the current input features as input, this implementation uses a Node RNN to iteratively compute the output features h' of the previous node and the input features h of the current node to obtain v-emb. This implementation also uses the neighborhood features of each node as the input features h of that node, and uses an Edge RNN to extract the neighborhood features of the current node. Since the node ranks are already sorted by BFS, the adjacency vectors of node v and the reverse BFS sequence can be used as the input time sequence, and the Edge RNN model is used to obtain the input features of node v.
[0067] Implementation Method 4: This implementation method further defines the RNN-based encoding and decoding graph embedding method for attributeless graphs described in Implementation Method 3. The neighborhood features of a node are determined by the connection state between the node and other nodes and the rank of the node's neighboring nodes. The higher the rank, the greater the impact on the neighborhood features of the node.
[0068] Implementation Method 5: This implementation method further defines the RNN-based encoding / decoding graph embedding method for attribute-free graphs described in Implementation Method 3. Specifically, the adjacency vector of node v with the inverse result of BFS node sorting is used as the input time sequence, and the structural features of node v are obtained using Edge RNN as follows:
[0069]
[0070] Among them, v i For nodes, emb represents structural features. Represents a node The neighborhood characteristics.
[0071] Specifically, for node v i v is centered and has N nodes. i -graph, It is v i -graph is the reverse result of BFS node sorting, where It is node v i The k-th node in reverse order of the central BFS node. yes The corresponding node neighborhood features, with The sequence of inputs into a Node RNN can yield node v i Structural features v i The specific calculation formula for -emb is as follows:
[0072]
[0073] Implementation Method Six: This implementation method further defines the attribute-free graph encoding / decoding embedding method based on RNN described in Implementation Method Five, wherein the node... The neighborhood features are determined by the nodes The adjacent vector sequence is input into EdgeRNN to obtain the following:
[0074]
[0075] in, It is the kth node in the node sorting. and The sequence of adjacency vectors that are either 0 or 1, where:
[0076]
[0077] This implementation method will be described in conjunction with Implementation Method Five. For example... Figure 1 The v4-graph shown has a node sorting result obtained by BFS as [v 4, v 7, v8, v 3, v 5, v 6, v2], and its corresponding reverse sorting result [v 2, v 6, v 5, v 3, v 8, v 7, The v4 graph is input into the Encoder to obtain the v4-graph encoding. The encoding process is as follows: Figure 3 As shown. The BFS inversion result of v4-graph is... Node Reverse of BFS adjacency vector Temporal input loop extraction for Edge RNN neighborhood features Then The SOS (start symbol) is used as input to the Node RNN to obtain the next node. Input features; for the next node v6, reverse BFS. adjacency vector Temporal input loop extraction for Edge RNN neighborhood features This process is repeated, using the node neighborhood features output by the Edge RNN. As input to the Node RNN, the structural features (v4-emb) of node v4 are obtained.
[0078] Implementation Method Seven, see below Figure 4 This embodiment further defines the RNN-based encoding / decoding graph embedding method for attribute-free graphs described in Embodiment 5. In step S3, the decoder, composed of a dual RNN structure, consists of a Node RNN structure and an Edge RNN structure. i -emb is used as input to the Node RNN to generate new nodes. and characteristics The specific calculation formula is as follows:
[0079]
[0080] Features of newly generated nodes The start symbol SOS is used as input to the Edge RNN for newly generated nodes. With existing nodes Perform connection generation and discrimination to obtain The specific calculation formula is as follows:
[0081]
[0082] In this embodiment, the goal of the decoder is to reconstruct the structural features (v-emb) of node v back into a neighborhood subgraph (v-graph). The graph generation process needs to address the issues of node number generation and connection generation between nodes. Since the number of nodes is uncertain, models with fixed-dimensional output (such as MLP, GCN, etc.) cannot be used for node generation. Therefore, this embodiment uses a Node RNN-Decoder as the basic framework for node generation, utilizing the recurrent generation mechanism of RNNs to achieve dynamic node generation, thus resolving the uncertainty in the number of nodes.
[0083] Regarding the connection generation problem between nodes, since RNNs are networks with short-term memory, when using v-emb as the initial input of the Node RNN-Decoder to generate nodes cyclically, the later the node is generated, the smaller its influence on v-emb. Therefore, the node generation sequence obtained using the Node RNN-Decoder is a descending rank sequence. The connection state between newly generated nodes and existing nodes is determined by the rank of the existing nodes; the higher the rank of the existing node, the greater its influence on the newly generated node. Therefore, this implementation uses the Edge RNN-Decoder as the basic framework to distinguish between newly generated nodes and existing nodes, and performs connection generation discrimination for newly generated nodes according to the rank sequence. This implementation design includes... Figure 4 The decoder shown is a dual RNN (NodeRNN-Decoder outside, Edge RNN-Decoder inside) structure. This model uses v i -emb is used as input to the NodeRNN-Decoder to generate new nodes. and characteristics The specific calculation formula is as follows:
[0084]
[0085] Features of newly generated nodes Using SOS (start symbol) as input to the Edge RNN-Decoder, the newly generated nodes... With existing nodes Perform connection generation and discrimination to obtain The specific calculation formula is as follows:
[0086]
[0087] Specifically, for example Figure 4The v4-emb shown is first used as input to the Node RNN-Decoder to generate new nodes. and characteristics Then, the features of the newly generated nodes are... SOS is used as input to the Edge RNN-Decoder for newly generated nodes. Connect to existing node v4 to generate a discrimination, and obtain [s] 7,4 Next, Connection relationship with v4 [s 7,4 ] and nodes The output of the Node RNN is used as the input to the Node RNN-Decoder to generate new nodes. and characteristics Then generate new node features SOS is used as input to the Edge RNN-Decoder for newly generated nodes. With existing nodes Perform connection generation and discrimination to obtain This process is repeated, using the [s] obtained from the Edge RNN-Decoder. 7,4 ]、
[0088] As a result of the reconstruction of v4-graph.
[0089] Implementation Method Eight: An RNN-based encoding / decoding graph embedding system for attributeless graphs, the system comprising:
[0090] The neighborhood subgraph construction unit is used to take the two-hop subgraph centered on node v in the topology as the neighborhood subgraph v-graph of node v, and use the BFS reverse order corresponding to the neighborhood subgraph as training samples.
[0091] The encoding unit is used to construct an encoder with a dual RNN structure, which encodes the neighborhood subgraph v-graph of node v according to the encoder based on the time-series model RNN, and obtains the structural features v-emb of node v.
[0092] The reconstruction unit is used to construct a decoder with a dual RNN structure. Based on the decoder with the dual RNN structure, the structural features v-emb of node v are reconstructed to obtain the reconstructed back-neighbor subgraph.
[0093] Implementation Method Nine: A computer device according to this implementation method includes a memory and a processor. The memory stores a computer program. When the processor runs the computer program stored in the memory, the processor executes an RNN-based encoding and decoding graph embedding method for attributeless graphs as described in any one of Implementation Methods One to Seven.
[0094] Implementation Method 10: A computer-readable storage medium according to this implementation method, the computer-readable storage medium being used to store a computer program, the computer program executing a graph embedding method for encoding and decoding an attributeless graph based on RNN as described in any one of Implementation Methods 1 to 7.
[0095] Implementation Method Eleven: This implementation method provides a specific embodiment of the RNN-based encoding / decoding graph embedding method for attribute-free graphs described in Implementation Method One, and also serves to explain Implementation Methods Two through Seven. Specifically:
[0096] In this implementation, a neighborhood subgraph is first constructed for each node in the graph structure. Then, using the node's neighborhood subgraph (v-graph) as input, the G-ESD model is used to obtain the trained node structural features (v-emb). The node structural features (v-emb) are then concatenated with the node's attribute features X to obtain the node features. Next, using the node features and the graph structure as input, models such as GCN and GAT are used to obtain trained node features, which are then used for downstream tasks such as node classification.
[0097] When considering the structural features of training nodes, this implementation approach focuses on both the encoder and decoder. Regarding the encoder, this implementation first utilizes a triplet loss L... s This involves constructing positive and negative sample pairs for a neighborhood subgraph (v-graph) and training the structural features of nodes to ensure that the trained node structural features possess uniqueness and local similarity. Positive samples consist of isomorphic structures from the v-graph, while negative samples are formed by randomly masking the adjacency matrix of the v-graph. The specific calculation formula is as follows:
[0098] L s (A,P,N)=max[d(A,P)-d(A,N)+m,0]
[0099] Where A is the original neighborhood subgraph, P is the positive sample of A, N is the negative sample of A, d is the distance function, and m is a user-defined constant. Regarding the decoder, this implementation uses the reconstruction loss L of constructing the original neighborhood subgraph (v-graph) and reconstructing the neighborhood subgraph. rThe structural features of the trained nodes are used to reflect their context and global structure. The specific calculation formula is as follows:
[0100]
[0101] Where A is the original neighborhood subgraph, and A' is the reconstructed neighborhood subgraph. Through L s and L r These two constraints ensure that the trained node structure features can fully represent the node's neighborhood subgraph and node context. The specific calculation formula is as follows:
[0102] L=αL s +(1-α)L r
[0103] For step one, Figure 2 The neighborhood subgraph v4-graph, consisting of v4, v7, v8, v3, v5, v6, and v2, is centered around v4. The v4-graph has a hierarchical structure, where the 1-level consists of v4's one-hop neighbors {v7, v8, v3}, and the 2-level consists of v4's two-hop neighbors {v5, v6, v2}.
[0104] For step two, the encoder uses a time-series model (RNN) to encode the graph structure corresponding to the neighborhood subgraph of a node. During encoding, the results are input into a shared RNN model in reverse BFS order to obtain the node neighborhood features at each time step. The output of the last time step is used as the node's structural features. This invention designs three node structural feature dimensions: 6, 16, and 32. The model performs best when the node structural feature dimension is 16. Furthermore, the number of RNN layers is also a key factor affecting model performance. This invention designs three RNN layer numbers: 1, 2, and 4. The model performs best when the number of RNN layers is 1. Since RNNs are short-term memory networks, the smaller the number of RNN layers, the greater the influence of the node sequence on the results. Therefore, the G-ESD model performs better.
[0105] For step three, the decoder uses a temporal learning network (RNN) to reconstruct the node structural features back into the node's neighborhood subgraph. This process can be viewed as a graph generation process. The graph generation process needs to consider the unknown number of nodes and node connections. Using the descending rank of nodes as input, the RNN generates connections between new nodes and existing nodes for discrimination. Similar to the encoder, this invention designs three RNN layer numbers: 1, 2, and 4. Furthermore, it can be seen that the G-ESD model performs best when the RNN layer number is 1.
[0106] Finally, as shown in Table 1, compared with some existing graph embedding methods, the method of this invention shows better performance on the Cora, Citeseer and PubMed datasets in the node classification task, and improves the node classification effect to a certain extent.
[0107] Regarding the link density of the graph, the link density of the Citeseer dataset is lower than that of the Cora dataset, and also lower than that of the PubMed dataset.
[0108] Table 1 Comparison of node classification accuracy between our method and existing methods
[0109]
[0110] Table 1 shows that on the Cora and PubMed datasets, the G-ESD model significantly outperforms the baseline model in node classification; on the Citeseer dataset, the G-ESD model also achieves good performance in node classification. Therefore, it can be concluded that G-ESD is more suitable for graph datasets with high link density.
[0111] Although preferred embodiments of this disclosure have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this disclosure.
[0112] Obviously, those skilled in the art can make various modifications and variations to this disclosure without departing from its spirit and scope. Therefore, if such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, this disclosure is also intended to include such modifications and variations.
[0113] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure and not to limit its protection scope. Although this disclosure has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading this disclosure, they can still make various changes, modifications or equivalent substitutions to the specific implementation of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the published pending claims.
Claims
1. A method for encoding and decoding attributeless graphs based on RNNs, applied in the field of social networks, characterized in that, The method includes: S1: The topology is composed of nodes... v i The two-hop subgraph centered on the node v i neighborhood subgraph v i - graph The BFS reverse order corresponding to the neighborhood subgraph is used as the training sample; the nodes include the user's name and hobbies. S2: Construct an encoder with a dual RNN structure, and process the nodes according to the encoder based on the time-series RNN model. v i neighborhood subgraph v i - graph Encode and obtain nodes. v i Structural features v i -emb ; S3: Construct a decoder with a dual RNN structure, and process the nodes according to the decoder with the dual RNN structure. v i Structural features v i -emb Perform reconstruction and obtain the reconstructed back-neighbor subgraph; The encoder with a dual RNN structure in step S2 consists of a Node RNN and an Edge RNN. Step S2 includes: The node sequence is input into the Node RNN, and the Node RNN is used as the basic architecture of the encoder. Neighborhood subgraph v i - graph The reverse result of the BFS node sorting is used as the input to the encoder. The neighborhood features of each node are used as the input features of that node. h And extract the neighborhood features of the current node through Edge RNN; Node v i The adjacency vector of the inverse result of BFS node sorting is used as the input time sequence, and the nodes are obtained using Edge RNN. v i Structural features; In step S3, the decoder with a dual RNN structure consists of a Node RNN structure and an Edge RNN structure, which incorporates node structural features. v i -emb As input to a Node RNN, it generates nodes. v i The kth node in reverse order of the central BFS node and neighborhood features The specific calculation formula is as follows: Will and start symbol SOS As input to the Edge RNN, for With existing nodes Perform connection generation and discrimination to obtain The specific calculation formula is as follows: ; When training the structural features of nodes, we approach the problem from two aspects: the encoder and the decoder. For the encoder, we first use triplet loss. That is, constructing a neighborhood subgraph v i -graph The method of training node structural features using positive and negative sample pairs ensures that the trained node structural features possess uniqueness and local similarity. The positive samples are generated by... v i - graph Composed of isomorphic structures, negative samples are composed of v i -graph The adjacency matrix is formed by random masking, and its specific calculation formula is as follows: in A For the original neighborhood subgraph, P for A Positive samples, N for A negative samples, d Here, m is the distance function, and m is a user-defined constant. On the decoder side, this is achieved by constructing a subgraph of the original neighborhood. v i -graph Reconstruction loss of the reconstructed neighborhood subgraph The structural features of the trained nodes are used to reflect their context and global structure. The specific calculation formula is as follows: in A For the original neighborhood subgraph, A’ The reconstructed neighborhood subgraph; through and These two constraints ensure that the trained node structure features can fully represent the node's neighborhood subgraph and node context. The specific calculation formula is as follows: 。 2. The method for encoding and decoding attributeless graphs based on RNN according to claim 1, characterized in that, The neighborhood characteristics of a node are determined by the node's connection status with other nodes and the sorting of its neighboring nodes. rank Decide, rank The larger the value, the greater its impact on the neighborhood characteristics of that node.
3. The method for encoding and decoding attributeless graphs based on RNN according to claim 1, characterized in that, The node v i The adjacency vector of the inverse result of BFS node sorting is used as the input time sequence, and the nodes are obtained using Edge RNN. v i The specific structural features are as follows: in, For node structure features, express The neighborhood characteristics.
4. The method for encoding and decoding attributeless graphs based on RNN according to claim 3, characterized in that, The The neighborhood features are formed by The adjacent vector sequence is input into the Edge RNN to obtain the following: in, It is sorted by node v i The kth node in reverse order of the central BFS node and The sequence of adjacency vectors that are either 0 or 1, where: 。 5. A graph embedding system for encoding and decoding attributeless graphs based on RNN, applied in the field of social networks, characterized in that, The system is implemented based on the embedding method of claim 1, and the system includes: Neighborhood subgraph building unit, used to construct subgraphs from nodes in the topology. v i The two-hop subgraph centered on the node v i neighborhood subgraph v i - graph The BFS reverse order corresponding to the neighborhood subgraph is used as the training sample; the nodes include the user's name and hobbies. The encoding unit is used to construct an encoder with a dual RNN structure, and to process nodes according to the encoder based on the time-series RNN model. v i neighborhood subgraph v i - graph Encode and obtain nodes. v i Structural features v i -emb ; The reconstruction unit is used to construct a decoder with a dual RNN structure, and to refactor the nodes according to the decoder with the dual RNN structure. v i Structural features v i -emb Perform reconstruction and obtain the reconstructed back-neighbor subgraph.
6. A computer device, characterized in that, The system includes a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes a method for encoding and decoding an attributeless graph based on an RNN as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that executes the RNN-based encoding and decoding graph embedding method for attributeless graphs as described in any one of claims 1-4.
Citation Information
Patent Citations
Graph-to-graph prediction method and system based on recurrent neural network
CN115795106A
Node classification method based on graph structure feature time sequence coding
CN115859183A