Graph similarity search method based on sub-graph matching

By using neural subgraph matching method and index mapping strategy in the graph database, the problem of similarity search in the graph database cannot be fully covered and slow in the current technology is solved, and a high accuracy and high efficiency similarity search is achieved.

CN119415744AActive Publication Date: 2025-02-11NANJING UNIV OF POSTS & TELECOMM

Patent Information

Application Number
CN202411558282.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-11
Estimated Expiration
2044-11-04

AI Technical Summary

Technical Problem

When the prior art performs similarity search in the graph database, it is impossible to guarantee that all results will be found, and the search speed is slow, which cannot meet the flexible and efficient needs of large-scale graph databases.

Method used

A graph similarity search method based on neural subgraph matching is designed. The query graph and partition generation order are embedded in high-dimensional space to determine whether the subgraph isomorphic between the query graph and partition, and the inverted index and coordinate index are used. Achieve fast filtering and accurate calculations.

Benefits of technology

This method does not lose any real results on all datasets, and has greatly improved accuracy compared to other learning-based methods, and significantly accelerates the efficiency of similar graph search through index mapping strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415744A_ABST
    Figure CN119415744A_ABST
Patent Text Reader

Abstract

The invention discloses a graph similarity search method based on sub-graph matching, which comprises the following steps of: dividing a data graph into a plurality of mutually exclusive half-edge graphs, constructing a reverse index by taking sub-graph embedding as a key and a data graph set containing the sub-graph as a value, constructing a coordinate index based on size information of the data graph, and realizing hierarchical filtering by utilizing a mapping relationship between two layers of indexes. A self-loop or loop-free strategy is adopted to process half sides, a sequential embedding model is designed, so that embedding of two graphs with a sub-graph isomorphic relation in a high-dimensional space has the same partial sequence position, a query graph is input, a preliminary candidate set is screened out through coordinate indexes, then the candidate set is further screened out through inverted indexes, and a final candidate set is obtained; the graph editing distance between the query graph and the candidate graph is accurately calculated, a final result set is obtained, traditional sub-graph isomorphism testing is avoided, sub-graph embedding can be generated in the off-line stage, and the deduction time of the model is greatly shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of graph data application, and specifically relates to a graph similarity search method based on neural subgraph matching. Background Art

[0002] As a powerful data model, graphs can not only describe the properties of target objects, but also describe the structural relationships between various components. They have been successfully applied to many fields. With the increasing application of graph data and the increasing size of databases, more and more studies are trying to solve the similarity search problem in graph databases. Users just want to obtain some graph data with similar structures to the given query graph, and there can be some relatively small deviations. This search that allows differences between the query graph and the given graph is called similarity search. The graph similarity search problem can be defined as: given a graph database G = {g1, g2, ..., gn} and a query graph Q and a similarity threshold, find all graphs in the graph dataset whose similarity to the query graph Q is within the threshold. This approximate search mechanism greatly reduces the difficulty of searching for users with little or no prior knowledge. Therefore, when conducting exploratory research in large-scale graph databases, flexible and efficient graph similarity search methods are particularly important. In recent years, researchers have proposed a large number of graph similarity search algorithms, among which the similarity search method using graph edit distance as a metric has received widespread attention due to its good fault tolerance and versatility.

[0003] CN202410923861.0 calculates the structural similarity features of graph pairs based on the diffusion model and attention mechanism, and performs comparative learning through a multi-layer matching network to obtain the matching vectors of hyperedge-hyperedge and hyperedge-hypergraph, and generates semantic similarity features based on the matching vectors of hyperedge-hyperedge and hyperedge-hypergraph; splices the structural similarity features and the semantic similarity features to obtain the global comparative feature vector of the graph pair, and inputs the global comparative feature vector into a fully connected neural network to obtain a similarity score for reflecting the similarity of the graph pair. The inventive method combines semantic and structural features, integrates the similarity features of the graph structure itself, and learns semantic information with the features of nodes and subordinate communities. The heterogeneous graph similarity learning method proposed in the invention is more comprehensive and can effectively and accurately obtain the similarity score of the graph pair.

[0004] CN202411237914.X discloses a similar network subgraph search method and device based on semantic distance, a storage medium and a terminal, wherein the method includes obtaining a reference network subgraph, obtaining set connection edges between all text units in the reference network subgraph based on preset screening conditions, and connecting all text units in the reference network subgraph into a search subgraph based on all set connection edges; obtaining a search text unit set of the target text unit in the search subgraph in the inference database, obtaining a search text unit set of all text units in the search subgraph in the inference database along a preset search order through a preset search set acquisition method; based on the search text unit set of all text units in the reference network subgraph, obtaining all similar network subgraphs of the reference network subgraph. However, the above-mentioned graph similarity calculation method that simply relies on the neural network model cannot guarantee that all results will be found when used for graph search, and the graph search speed is slower than the traditional indexing method. Summary of the invention

[0005] Purpose of the invention: In view of the defects of the above-mentioned prior art, the present invention provides a graph similarity search method based on neural subgraph matching, and designs a graph node sequential embedding model. The relative positions of the query graph and the sequential embeddings generated by the partitions in the high-dimensional space are used to judge whether the subgraphs of the query graph and the partitions are isomorphic. This not only avoids the traditional subgraph isomorphism test, but also can generate partition embeddings in the offline stage. When querying, it is only necessary to compare the relative positions of the query graph and each partition embedding in the high-dimensional space to achieve rapid judgment of isomorphism, thereby greatly shortening the inference time of the model.

[0006] Technical solution: The graph similarity search method based on neural subgraph matching of the present invention comprises the following specific steps:

[0007] S1: Divide the data graph into several mutually exclusive half-edge graphs, build an inverted index with subgraph embedding as the key and the data graph set containing the subgraph as the value, build a coordinate index based on the size information of the data graph, and use the mapping relationship between the two layers of indexes to implement hierarchical filtering.

[0008] S2: Use self-loop or acyclic strategies to process half edges and design a sequential embedding model so that the embeddings of two graphs with subgraph isomorphism have the same partial order position in the high-dimensional space.

[0009] S3: Input the query graph, filter out the preliminary candidate set through the coordinate index, further filter the candidate set through the inverted index, accurately calculate the graph edit distance between the query graph and the candidate graph, and obtain the final result set.

[0010] The specific steps of S1 include:

[0011] S11: For any data graph g, transform it into a graph with coordinates (|V g |,|E g|), that is, based on the vertex-edge method, it is mapped into a two-dimensional coordinate system, where the x-coordinate and y-coordinate represent the number of vertices and edges of the graph g, respectively.

[0012] S12: For the graph database G, we can obtain the point set (|V g |,|E g |): g∈G, and these points can form a rectangular area A=[x min , x max ]×[y min ,y max ], where x min / x max and min / y max are the minimum and maximum number of nodes and edges, respectively. Given a query graph q and a threshold T, the query rectangle Aq is defined as the set of points (x, y): |x-|V q ||+|y-|E q ||≤τ composed of a rectangle;

[0013] S13: Given a graph g, the graph is divided into (τ+k) half-edge graphs, the set of half-edge graphs is P(g), where τ is a threshold and k (k ≥ 1) is an integer parameter. For a given query graph q, if GED(g, q) ≤ τ, then there are at least k half-edge graphs in the half-edge graph set P(g): p i1 , p i2 , ..., p ik ∈P(g), satisfying For any data graph g∈G, its subgraph set is P(g)={p 1 , p 2 , ..., p τ+k}.if Then p i is a matching subgraph, otherwise it is called an unmatched subgraph. If the number of matching subgraphs in the subgraph set P is less than k, then the graph edit distance GED(g, q) must be greater than τ.

[0014] S14: Partition all data graphs and construct an inverted index I(p) with the partitioned subgraph as the key and the data graph set containing the subgraph as the value. For a given query graph q, if All data graphs containing partition p can be quickly found in the graph database G.

[0015] The specific steps of S2 include:

[0016] S21: The distal and proximal nodes of all half-edges in the half-edge graph are connected, and the half-edges are transformed into self-loops. In the process of message transmission, the nodes connected to the self-loops transformed from the half-edges are not transmitted, and only the degree information of the half-edges is included in the embedding.

[0017] S22: The node features are processed by linear transformation to obtain the hidden layer representation. The model uses k graph convolutional layers to aggregate local neighborhood information and iteratively update the node representation.

[0018] S23: Learnable jump connections are added between different convolutional layers. These connections are represented by a parameter matrix S∈R L×L Represented by L, where L is the number of network layers. During training, this parameter matrix is ​​used to determine the optimal contribution of each layer output to the final node representation.

[0019] S24: After k layers of convolution, the node representations are aggregated through a global pooling operation to produce a fixed-size graph embedding.

[0020] S25: Given a target graph instance G T =(V T , E T ) and query graph instance G Q =(V Q , E Q ), where V T is the target graph node set, E T is the edge set of the target graph, V Q is the set of query graph nodes, E Q is the edge set of the query graph. Through the sequential embedding model, we can get G T The graph-level embedding Z T , G Q The graph-level embedding Z Q , and if G Q It's G T isomorphic subgraph, then according to the order embedding theory, Z Q The position in the embedding space should be at Z T 'lower left corner'.

[0021] S26: Use maximum margin loss to train a GNN model that generates embeddings.

[0022] The specific steps of S3 include:

[0023] S31: Given a query graph q and a query threshold τ, the query region is calculated, and through the mapping relationship between the partitioned subgraphs and the data graphs, the partitioned subgraphs corresponding to all graphs in the query region are used as the subgraphs to be queried in the inverted index.

[0024] S32: Before querying the inverted index, first create a score array S to record the number of matching partitions between the current query graph and each data graph. Input the query graph into the neural subgraph matching model to obtain the query graph embedding. For each partition to be queried, compare the positional relationship between the query graph embedding and the partition embedding in the embedding space in turn. If Z(p)≤Z(q), then p is an isomorphic subgraph of the query graph q, then the scores of all data graphs containing the partition are S[g]+1, until all the partitions to be queried are compared, then the scores in the score array S greater than or equal to k are candidate sets.

[0025] S33: Use the precise GED verification algorithm to verify the candidate set and obtain the final query result.

[0026] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: On all data sets, the method used for similarity search does not lose any real results, and the accuracy is greatly improved compared to other learning-based methods. Secondly, in order to improve the efficiency of similar graph search, we designed an index mapping strategy that uses the statistical information of the data graph to generate a fast index, and achieves hierarchical filtering of similar graphs by maintaining the mapping relationship between the fast index and the partition index. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0028] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0029] Example: Figure 1 As shown, S11: In real graph databases, there are often large differences in graph information and scale, while graph similarity query problems are aimed at graph pairs with small similarity differences. Therefore, there are a large number of easily distinguishable false positive samples in the database. Therefore, a label index based on graph statistical information is established, and hierarchical filtering is achieved by using the mapping relationship between the two layers of indexes. For any data graph g, it is mapped to a two-dimensional coordinate system with coordinates (|Vg|, |Eg|), that is, based on the vertex-edge method, where the x-coordinate and y-coordinate represent the number of vertices and edges of the graph g, respectively. Therefore, for the graph database G, the point set (|Vg|, |Eg|) can be obtained. g |,|E g |): g∈G, and these points can form a rectangular area A=[x min , x max ]×[y min ,y max ], where x min / x max and min / y max are the minimum and maximum number of nodes and edges, respectively. Given a query graph q and a threshold τ, the query rectangle A q is defined as the set of points (x, y): |x-|V q ||+|y-|E q ||≤τ.

[0030] S12: The focus of coordinate mapping is the size of the graph, and it takes into account a boundary situation, which helps to eliminate those graphs that do not meet the requirements in terms of graph size. It is a coarse-grained filtering method to reduce the time overhead of subsequent fine filtering. Therefore, after the coarse-grained filtering of this layer of coordinate mapping, the number of data graphs required for fine-grained filtering in subsequent multiple graph partitioning is significantly reduced, which can significantly speed up the index construction time of subsequent fine-grained filtering methods.

[0031] S13: Theorem 1: Given a graph g, the graph is partitioned into (τ+k) half-edge graphs, the set of which is P(g), where T is a threshold and k (k ≥ 1) is an integer parameter. For a given query graph q, if GED(g, q) ≤ τ, then there are at least k half-edge graphs in the set of half-edge graphs P(g): p i1 , p i2 , ..., p ik ∈P(g), satisfying For any data graph g∈G, its partition set is P(g)={p 1 , p 2 , ..., p τ+k}.if Then p i It is called a matching partition, otherwise it is called an unmatched partition.

[0032] S14: According to Theorem 1, if the number of matching partitions in the partition set P is less than k, then the graph edit distance GED(g, q) must be greater than τ, so it can be judged that g is a false positive graph. This inference method greatly saves time cost. Construct an inverted index I(p) based on a partition p of the graph g. For a given query graph q, if All data graphs containing partition p can be quickly found in the graph database G. In this way, after completing the necessary half-edge subgraph isomorphism calculations of partition p, all data graphs containing partition p can be found through the inverted index, thereby reducing a large amount of calculations. A random partitioning strategy is adopted, that is, (τ+k) seed nodes are randomly selected in the graph g as the initial partition, and then the partition is expanded by region growth until all nodes in the graph g are included in the partition.

[0033] S21: The graph partitioning strategy divides each data graph into several mutually exclusive half-edge graphs. These half-edge graphs are different from ordinary graphs because the existence of half-edges cannot be directly encoded by GNN. For the processing of half-edge graphs, the traditional isomorphism test method usually adopts the method of adding virtual nodes, adding a virtual node to each half-edge graph, connecting the remote ends of all half-edges to the virtual node, and the virtual node can match any node. Then, when performing subgraph isomorphism testing, the half-edges can be effectively matched.

[0034] However, in GNN, if the strategy of adding virtual nodes is still adopted, it may cause distortion of the original graph data. This is because GNN cannot identify virtual nodes like traditional algorithms, and it cannot match virtual nodes with any nodes. It will only treat it as a normal node, which changes the structure and node information of the original half-edge graph, thereby learning biased or even wrong information.

[0035] A self-loop strategy is proposed to achieve lossless embedding of the half-edge graph. We connect the distal and proximal nodes of all half-edges in the half-edge graph. At this time, the half-edge becomes a self-loop, which does not require the introduction of virtual nodes and can indicate the existence of half-edges. However, in the message passing process of GNN, since the self-loop is equivalent to passing the message to itself, the role of the current node information in the current node embedding representation is strengthened, which will be inconsistent with the actual result. Therefore, in the message passing process, we do not pass messages to the nodes connected by the self-loop transformed from the half-edge, so that only the degree information of the half-edge is included in the embedding. In GNN, for nodes with self-loops, the message passing update formula is as follows:

[0036]

[0037] Among them, N(v) represents the set of neighbor nodes of node v, σ is the activation function, W is the weight matrix, and b is the bias.

[0038] A SkipConGNN model was trained to implement sequential embedding. The model integrates learnable skip connections, so that the convolution operation of each layer not only depends on the output of the previous layer, but also directly uses the output of all previous layers. This skip connection method allows a layer in the network to directly access the output features of the previous layers, allowing a more flexible and expressive feature propagation mechanism, thereby enriching the feature representation. This mechanism is very important in deep neural networks, helping to alleviate the gradient vanishing problem and improve the performance of the model.

[0039] Specifically, the SkipConGNN model introduces learnable skip connections to achieve a more flexible and expressive feature propagation mechanism that can integrate information across multiple network layers. The architecture of SkipLastGNN can be divided into the following key components:

[0040] S22: The input layer is responsible for processing the initial node features. Let the node feature matrix be X∈R N×F , where N represents the number of nodes and F represents the feature dimension. First, the node features are processed by linear transformation to obtain the hidden layer representation:

[0041] H (0) =XW 0

[0042] Among them, W 0 ∈R F×H is the weight matrix of the linear transformation, and H is the hidden layer dimension. If feature preprocessing is enabled, additional preprocessing steps are applied to enhance the original input features. The model uses k graph convolution layers to aggregate local neighborhood information and iteratively update node representations. This paper uses GraphSAGE convolution to achieve the aggregation of node neighborhood information, and its propagation rule can be expressed as:

[0043]

[0044] Among them, H (1) is the node representation of the lth layer, W l is the weight matrix of the lth layer, N(v) is the set of neighbor nodes of node v, and σ is the activation function.

[0045] S23: Learnable skip connections are added between different convolutional layers of SkipConGNN. These connections are represented by a parameter matrix S∈R L×L Represented by L, where L is the number of network layers. During training, this parameter matrix is ​​used to determine the optimal contribution of each layer output to the final node representation.

[0046] Assume H (0) , H (1) , ..., H (l) is the node representation of the first l layers, and the output of the skip connection is represented as:

[0047]

[0048] Among them, S l,iis the learnable jump connection weight. The introduction of jump connection effectively alleviates the gradient vanishing problem and enables the model to capture information from different network depths. σ is the activation function used to scale the jump connection weight so that it is limited to the range of (0, 1). In this way, the jump connection weight will control the influence of each input feature in the current layer.

[0049] S24: After k layers of convolution, the node representations are aggregated through a global pooling operation to produce a fixed-size graph embedding.

[0050] Z=Pool(H (L) )

[0051] Among them, H( L ) is the node representation of the final layer L, Z is the global representation of the graph, Pool is the global pooling function, and different pooling methods can be selected according to specific needs.

[0052] S25: Given a target graph instance G T =(V T , E T ) and query graph instance G Q =(V Q , E Q ), where V T is the target graph node set, E T is the edge set of the target graph, V Q is the set of query graph nodes, E Q is the edge set of the query graph. Through the sequential embedding model, we can get G T The graph-level embedding Z T , G Q The graph-level embedding Z Q , and if G Q It's G T isomorphic subgraph, then according to the order embedding theory, Z Q The position in the embedding space should be at Z T The "lower left corner" is:

[0053]

[0054] where D is the embedding dimension. We can use E(ZQ, Z T ) to measure ZQ and Z T The degree to which the order embedding theory is satisfied,

[0055]

[0056] S26: Therefore, the GNN that generates the embedding is trained using the maximum margin loss:

[0057]

[0058] Where P is the positive sample set, N is the negative sample set, and α is a hyperparameter. When in any dimension i, Z Q [i]>Z T [i], the subgraph constraint is violated. E(Z Q , Z T ) represents its magnitude. For a positive example P, when all elements in the query node embedding ZQ are smaller than the target node embedding Z T When the corresponding element in E(Z Q , Z T ) is minimized. For the negative pair (Z Q , Z T ), the amount of violation E(Z Q , Z T ) should be at least α to obtain zero loss.

[0059] S3: After all the preparations for index building, sequential embedding, and index mapping are completed, similar graph search can be performed. First, a coordinate index is built based on the size information of the data graph; second, the data graph is divided, and the partitions are input into the neural subgraph embedding model to obtain the partition embedding representation; finally, an inverted index is built with the partition embedding representation as the key and the ids of all data graphs containing the partition as the value, while maintaining the mapping relationship between the data graph and the partitions of the graph. When querying, the query area is first calculated through the query graph q and the query threshold τ. Through the mapping relationship between the partition and the data graph, the partitions corresponding to all graphs in the query area are used as the partitions to be queried in the inverted index. Secondly, before querying the inverted index, a score array S is first created to record the number of matching partitions between the current query graph and each data graph. The query graph is input into the neural subgraph matching model to obtain the query graph embedding. For each partition to be queried, the positional relationship between the query graph embedding and the partition embedding in the embedding space is compared in turn. If Z(p)≤Z(q), then p is an isomorphic subgraph of the query graph q, then the scores of all data graphs containing the partition are S[g]+1, until all the partitions to be queried are compared. According to Theorem 1, the scores in the score array S greater than or equal to k are the candidate sets. Finally, the candidate sets are verified using the precise GED verification algorithm to obtain the final query results.

[0060] It should be noted that the above content only illustrates the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.

Claims

1. A graph similarity search method based on subgraph matching, characterized in that: The method comprises the following steps, S1, divide the data graph into several mutually exclusive half-edge graphs, build an inverted index with subgraph embedding as the key and the data graph set containing the subgraph as the value, build a coordinate index based on the size information of the data graph, and use the mapping relationship between the two layers of indexes to achieve hierarchical filtering; S2, adopt self-loop or acyclic strategy to process half edges, and design a sequential embedding model so that the embeddings of two graphs with subgraph isomorphism relationship also have the same partial order position in the high-dimensional space; S3, input the query graph, filter out the preliminary candidate set through the coordinate index, and then further filter the candidate set through the inverted index, accurately calculate the graph edit distance between the query graph and the candidate graph, and obtain the final result set.

2. The graph similarity search method based on subgraph matching according to claim 1 is characterized in that The step 1 comprises the following steps: S11, for any data graph g, it is represented by coordinates (|V g |,|E g |), that is, based on the vertex-edge method, it is mapped into a two-dimensional coordinate system, where the x-coordinate and y-coordinate represent the number of vertices and edges of the graph g, respectively; S12, for the graph database G, we can obtain the point set (|V g |,|E g |):g∈G, and these points can form a rectangular area A=[x min ,x max ]×[y min ,y max ], where x min / x max and min / y max are the minimum and maximum number of nodes and edges, respectively. Given a query graph q and a threshold τ, the query rectangle Aq is defined as the set of points (x, y): |x-|V q ||+|y-|E q ||≤τ composed of a rectangle; S13, given a graph g, the graph is divided into (τ+k) half-edge graphs, the set of half-edge graphs is P(g), where τ is a threshold and k (k ≥ 1) is an integer parameter. For a given query graph q, if GED(g,q) ≤ τ, then there are at least k half-edge graphs in the half-edge graph set P(g): p i1 ,p i2 ,...,p ik ∈P(g), satisfying For any data graph g∈G, its subgraph set is P(g)={p1,p2,...,pτ+k} if Then pi is called a matching subgraph, otherwise it is called an unmatched subgraph. If the number of matching subgraphs in the subgraph set P is less than k, then the graph edit distance GED(g,q) must be greater than τ; S14, partition all data graphs and construct an inverted index I(p) with the partitioned subgraph as the key and the data graph set containing the subgraph as the value. For a given query graph q, if All data graphs containing partition p can be quickly found in the graph database G.

3. The graph similarity search method based on subgraph matching according to claim 1, characterized in that: The step 2 comprises the following steps: S21, the distal and proximal nodes of all half-edges in the half-edge graph are connected, and the half-edges are transformed into self-loops. In the process of message transmission, the nodes connected to the self-loops transformed from the half-edges are not messaged, and only the degree information of the half-edges is included in the embedding; S22, the node features are processed by linear transformation to obtain the hidden layer representation. The model uses k graph convolution layers to aggregate local neighborhood information and iteratively update the node representation; S23, learnable jump connections are added between different convolutional layers. These connections are represented by a parameter matrix S∈R L×L Represents, where L is the number of network layers. During the training process, this parameter matrix is ​​used to determine the optimal contribution of each layer output to the final node representation; S24, after k layers of convolution, the node representations are aggregated through a global pooling operation to generate a fixed-size graph embedding; S25, given a target graph instance G T =(V T ,E T ) and query graph instance G Q =(V Q ,E Q ), where V T is the target graph node set, E T is the edge set of the target graph, V Q is the set of query graph nodes, E Q is the edge set of the query graph, and G can be obtained through the sequential embedding model T The graph-level embedding Z T , G Q The graph-level embedding Z Q , and if G Q It's G T isomorphic subgraph, then according to the order embedding theory, Z Q The position in the embedding space should be at Z T "lower left corner"; S26, use the maximum margin loss to train the GNN model that generates embeddings.

4. The graph similarity search method based on neural subgraph matching according to claim 1, characterized in that: The step 3 comprises the following steps: S31, given a query graph q and a query threshold τ, the query region is calculated, and through the mapping relationship between the partitioned subgraphs and the data graphs, the partitioned subgraphs corresponding to all graphs in the query region are used as the subgraphs to be queried in the inverted index; S32, before querying the inverted index, first create a score array S to record the number of matching partitions between the current query graph and each data graph, input the query graph into the subgraph matching model to obtain the query graph embedding, and for each partition to be queried, compare the positional relationship between the query graph embedding and the partition embedding in the embedding space in turn. If Z(p)≤Z(q), then p is an isomorphic subgraph of the query graph q, then the scores of all data graphs containing the partition are S[g]+1, until all the partitions to be queried are compared, then the ones with scores greater than or equal to k in the score array S are candidate sets; S33, use the precise GED verification algorithm to verify the candidate set and obtain the final query result.

5. The graph similarity search method based on neural subgraph matching according to claim 3 is characterized in that: In step S21, for a node with a self-loop, the message passing update formula is as follows: Among them, N(v) represents the set of neighbor nodes of node v, σ is the activation function, W is the weight matrix, and b is the bias.

6. The graph similarity search method based on neural subgraph matching according to claim 3 is characterized in that: The architecture of the GNN model consists of the following components, The input layer is responsible for processing the initial node features. Let the node feature matrix be X∈R N×F , where N represents the number of nodes and F represents the feature dimension. First, the node features are processed by linear transformation to obtain the hidden layer representation: H (0) =XW0 Among them, W0∈R F×H is the weight matrix of the linear transformation, H is the hidden layer dimension, and if feature preprocessing is enabled, additional preprocessing steps are applied to enhance the original input features. The model uses k graph convolution layers to aggregate local neighborhood information and iteratively update node representations. GraphSAGE convolution is used to achieve the aggregation of node neighborhood information, and its propagation rule can be expressed as: Among them, H (l) is the node representation of the lth layer, W l is the weight matrix of the lth layer, N(v) is the set of neighbor nodes of node v, and σ is the activation function.

7. The graph similarity search method based on neural subgraph matching according to claim 3 is characterized in that: In step S23, learnable skip connections are added between different convolutional layers of SkipConGNN. These connections are represented by a parameter matrix S∈R L×L Indicates that L is the number of network layers. During the training process, this parameter matrix is ​​used to determine the optimal contribution of each layer output to the final node representation. Assume H (0) ,H (1) ,…,H (l) is the node representation of the first l layers, and the output of the skip connection is represented as: Among them, S l,i is the learnable jump connection weight. The introduction of jump connection effectively alleviates the gradient vanishing problem and enables the model to capture information from different network depths. σ is the activation function used to scale the jump connection weight so that it is limited to the range of (0,1). In this way, the jump connection weight will control the influence of each input feature in the current layer.

8. The graph similarity search method based on neural subgraph matching according to claim 3 is characterized in that: In step S24, after k layers of convolution, the node representations are aggregated through a global pooling operation to generate a fixed-size graph embedding. Z=Pool(H (L) ) Among them, H (L) It is the node representation of the final layer L, Z is the global representation of the graph, Pool is the global pooling function, and different pooling methods can be selected according to specific needs.

9. The graph similarity search method based on neural subgraph matching according to claim 3, characterized in that: In step S25, according to the sequential embedding theory, Z Q The position in the embedding space should be at Z T The "lower left corner" is: Where D is the embedding dimension, which can be expressed as E(Z Q ,Z T ) to measure Z Q and Z T The degree to which the order embedding theory is satisfied, 10. The graph similarity search method based on neural subgraph matching according to claim 3, characterized in that: In step S26, the GNN that generates the embedding is trained using the maximum margin loss: Among them, P is the positive sample set, N is the negative sample set, α is a hyperparameter, when in any dimension i, Z Q [i]>Z T [i], the subgraph constraint is violated, E(Z Q ,Z T ) represents its magnitude. For a positive example P, when the query node is embedded in Z Q All elements in are smaller than the target node embedding Z T When the corresponding element in E(Z Q ,Z T ) is minimized, for the negative pair (Z Q ,Z T ), the amount of violation E(Z Q ,Z T ) should be at least α to obtain zero loss.

Citation Information

Patent Citations

  • A graph matching method, device and medium for heterogeneous graphs

    CN118467793B

  • Similar network subgraph search method and device based on semantic distance, storage medium and terminal

    CN118760780B

  • Vehicle-mounted laser point cloud and sequence panoramic image registration method

    CN112465732A

  • Ontology label knowledge graph-oriented sample query method

    CN113569057A

  • Sub-graph matching method for improving traditional processing mode

    CN113947695A

Cited By

  • Three-dimensional part retrieval method and system based on graph similarity search

    CN121542482A