A high-efficiency and precise graph edit distance calculation method and device
By dividing the graph into matched, unmatched, and cross-edge parts, and combining neural networks and traditional algorithms, the problem of training set editing path dependency in existing methods is solved, and efficient and accurate graph editing distance calculation is achieved.
Patent Information
- Application Number
- CN202411617571.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2044-11-13
AI Technical Summary
Existing hybrid methods require pre-computation of the edit paths of the training set, which leads to a decrease in accuracy in large-scale graph computations, and traditional methods are computationally inefficient.
The graph is divided into matched graph, unmatched graph, and cross-edge part. The GED value of the unmatched graph is estimated using a neural network, and the GED value of the cross-edge part is calculated from multiple perspectives. The GED estimation is optimized by combining the A* algorithm.
With limited training data, the accuracy is improved by 3.5%-6.4%, achieving efficient and accurate GED value estimation.
Smart Images

Figure CN119785058B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the fields of bioinformatics, drug discovery, data mining, etc., in particular to a method and device for efficiently and accurately estimating graph edit distance and measuring similarity between two graphs. BACKGROUND
[0002] Graph Edit Distance (GED) is a measure method for measuring the similarity between two graphs. It measures the minimum number of editing operations required to convert one graph into another, including inserting, deleting and modifying nodes and inserting, deleting and modifying edges.
[0003] Currently, the calculation methods of graph edit distance can be roughly divided into three categories. One is the traditional graph algorithm. This method can accurately calculate GED, but it also faces the problem of time-consuming - it cannot calculate the GED of a graph with more than 16 nodes within a reasonable time. One is a pure machine learning algorithm, which has scalability and rapidity, but it can only output the GED value and cannot predict the graph editing path. The last method combines traditional graph algorithms and machine learning algorithms, which can predict the GED value of large-scale graphs and their editing paths. However, the last method mostly needs to calculate the editing path of the training set in advance, otherwise the prediction accuracy will be greatly reduced. SUMMARY
[0004] In order to overcome the problem of pre-calculating the editing path of the training set in the existing hybrid method, the present application provides an efficient and accurate graph edit distance calculation method and device that only needs GED value as training data.
[0005] The technical scheme adopted by the present application to solve its technical problems is:
[0006] An efficient and accurate graph edit distance calculation method, comprising the following steps:
[0007] Divide the graph into matched graphs, unmatched graphs and cross edges, wherein the matched graphs contain matched nodes, the unmatched graphs contain unmatched nodes, and the matched nodes and the unmatched nodes are connected by cross edges;
[0008] Calculate the GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge;
[0009] Add the GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge to obtain the final GED estimate.
[0010] Further, calculate the GED value of the matched graph according to the matched pair.
[0011] Further, the GED value of the unmatched graph is estimated by a neural network.
[0012] Further, the calculation process of the GED value of the unmatched graph comprises:
[0013] inputting the graph pair into a graph neural network;
[0014] calculating embedding information of the two graphs in the graph pair respectively using a graph convolution network (GCN) to obtain node embedding vectors;
[0015] aggregating the node embedding vectors in the graphs to generate embedding representations of the graphs;
[0016] interacting the embedding representations of the two graphs using a neural tensor network (NTN) and a multi-layer perceptron (MLP) to obtain the GED value of the unmatched graph.
[0017] Further, an interaction layer based on an attention mechanism is introduced when calculating the node embedding vectors.
[0018] Further, the calculation process of the GED value of the cross-edge comprises:
[0019] calculating the GED value of the cross-edge from the perspective of the matched nodes;
[0020] calculating the GED value of the cross-edge from the perspective of the unmatched nodes;
[0021] taking the maximum value of the GED values of the cross-edge from the two perspectives.
[0022] Further, the GED value of the cross-edge from the perspective of the matched nodes is estimated as the sum of the difference in the number of cross-edges connected to the matched node pairs.
[0023] An efficient and accurate graph edit distance calculation device comprises:
[0024] a graph partitioning module for partitioning a graph into a matched graph, an unmatched graph and a cross-edge, wherein the matched graph contains matched nodes, the unmatched graph contains unmatched nodes, and the matched nodes and the unmatched nodes are connected by the cross-edge;
[0025] a GED value calculation module for calculating the GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross-edge, and adding the GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross-edge to obtain a final GED estimate.
[0026] The present application has the following advantages:
[0027] The efficient and precise graph edit distance calculation method of the application optimizes the algorithm for estimating the GED value of a partial matching graph (only matching a part of the nodes) in the original A* algorithm (which can be used to estimate the GED value of two undirected graphs). BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 is the core idea of the method - a schematic diagram of dividing the graph into three parts, dividing the query graph into three parts, the matched graph, the unmatched graph, and the cross edge between the matched graph and the unmatched graph.
[0029] Figure 2 is a model diagram for predicting the GED value of the unmatched graph using a neural network.
[0030] Figure 3 is a schematic diagram for estimating the GED value of the unmatched graph and the cross edge between the matched graph and the unmatched graph using a traditional algorithm, respectively from the perspective of the matched node (left) and the unmatched node (right). DETAILED DESCRIPTION
[0031] In order to make the above-mentioned purposes, features and advantages of the application more obvious and easy to understand, the application will be further described in detail below through specific examples and drawings.
[0032] The existing graph edit distance calculation method based on A* algorithm only considers the matching part and the unmatched part of the graph pair, and fails to consider the edges connecting the matching part and the unmatched part, which leads to inaccurate GED estimation. As shown in Figure 1 The application divides the graph into three parts: the matched graph, the unmatched graph, and the cross edge (border edges). The matched graph contains matched nodes, and the unmatched graph contains unmatched nodes. The unmatched graph and the cross edge of the graph pair both contribute to the GED estimation. The former is estimated by a neural network, and the latter is estimated from multiple angles using a traditional algorithm.
[0033] When using the existing A* algorithm to calculate the graph edit distance (GED), first define the state as the partial matching between two graphs and the set of edit operations. Then, select a heuristic function to estimate the minimum cost from the current state to the completely matched state. Use a priority queue to store the states to be explored, where the priority of the state is determined by the sum of the actual cost of the matched and the heuristic estimated cost. Take out the state with the lowest cost from the priority queue, add a pair of matching nodes based on this, and put the new state into the priority queue. Repeat this process until the completely matched state is found, at which time the total cost is the GED value. The cost from the current state to the completely matched state is further divided into two parts by the present invention - the GED value caused by the unmatched graph and the GED value caused by the cross-edge between the matched and unmatched graphs.
[0034] Figure 2 is the framework diagram of the graph neural network, and its input is a pair of graphs (including node features and topological information), and the output is the normalized GED value of the two graphs, that is, the GED value of the unmatched graph. First, use the graph convolutional network (GCN) to calculate the embedding information of the two graphs respectively to obtain the node embedding vector. When calculating the node embedding vector, an interaction layer based on the attention mechanism is also introduced. Then the node embedding vectors in the graph are aggregated to generate the embedding representation of the graph. Finally, the embedding representations of the two graphs are interacted using the neural tensor network (NTN) and the multi-layer perceptron (MLP) to obtain the GED value of the unmatched part.
[0035] Among them, the interaction layer based on the attention mechanism is used to improve the accuracy of prediction.
[0036] Among them, the neural tensor network and the multi-layer perceptron are used for interaction, specifically referring to the interaction of the graph-level embeddings of the two graphs, and finally outputting a scalar representing the similarity.
[0037] Figure 3 Two methods are proposed to estimate the GED value caused by the cross-edge. The first method is to calculate from the perspective of the matched nodes, such as Figure 3The left side is shown. Its GED value is estimated as the sum of the differences in the number of cross-edges connecting matched node pairs (there may be more than one matched node pair; the difference in the number of cross-edges needs to be calculated for each pair, and then summed). For example, consider a pair of matched nodes u and v, where node u comes from graph G1 and node v comes from graph G2. Node u is connected to two unmatched nodes, and node v is connected to one unmatched node; therefore, this part contributes |2-1| = 1 to the GED value. Furthermore, if node u in G1 matches an empty node in G2, then the contribution to the GED is the number of unmatched nodes connected to node u.
[0038] However, relying solely on this perspective for estimation may lead to an underestimation of the GED value. For example, such as... Figure 3 As shown on the right, G1 has three matched nodes and one unmatched node, which is connected to all matched nodes; G2 has three matched nodes and three unmatched nodes, each unmatched node connected to a matched node. The GED estimate obtained according to the aforementioned rules is 0, while the actual value is undoubtedly greater than 0. Therefore, this invention proposes a second method to estimate from the perspective of unmatched nodes, to improve the accuracy of the estimation. It is assumed that unmatched nodes with more cross-edge connections will be matched together. Therefore, assuming that u1, u2, and u3 in G1 are paired with v1, v2, and v3 in G2 respectively, and the only remaining unmatched node in G1 is paired with any remaining unmatched node in G2, the estimated contribution of cross-edge connections to GED is calculated as |3-1|+|0-1|+|0-1|=4, which is closer to the true value. In summary, this invention takes the maximum value from the estimates obtained from these two perspectives to improve accuracy.
[0039] Based on the above description, the A* algorithm can be used to efficiently and accurately estimate the graph editing distance. The steps for calculating the heuristic function include:
[0040] 1) Divide the graph into three parts: the matched graph, the unmatched graph, and the cross-edge graph;
[0041] 2) Calculate the GED value of the matched graph, the GED value of the unmatched graph, and the GED value of the cross-edge;
[0042] 3) Add the GED values of the matched graph, the unmatched graph, and the cross-edge graph to obtain the final GED estimate.
[0043] Specific application scenarios of this invention:
[0044] The graph edit distance calculation method of the present invention can be used to measure the similarity between two graphs and can be applied to fields such as bioinformatics, drug discovery, and data mining.
[0045] For example, for the field of drug discovery, the method of the present application can be used to calculate the graph edit distance between the molecular structure of a known effective drug and a molecule to be screened, so as to obtain a similarity, and according to the similarity, a candidate molecule with potential therapeutic activity can be quickly identified. Specifically, a similarity threshold can be set, the calculated similarity is compared with the threshold, and if it is greater than the threshold, the molecule to be screened is determined as a candidate molecule with potential therapeutic activity.
[0046] For example, for the field of data mining, the method of the present application can be used to calculate the graph edit distance of the social network graphs of two users (or multiple users), so as to obtain a similarity, and according to the similarity, it can be judged whether the friend structures of the two users are similar, so as to analyze the potential friend circle and social group belonging of the user. Specifically, a similarity threshold can be set, the calculated similarity is compared with the threshold, and if it is greater than the threshold, it is determined that the friend structures of the two users are similar, that is, the two users belong to the same social group.
[0047] Another embodiment of the present application provides an efficient and accurate graph edit distance calculation device, which comprises:
[0048] A graph partitioning module is configured to partition the graph into a matched graph, an unmatched graph and a cross edge, wherein the matched graph contains matched nodes, the unmatched graph contains unmatched nodes, and the matched nodes and the unmatched nodes are connected by the cross edge.
[0049] A GED value calculation module is configured to calculate the GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge, and add the GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge to obtain the final GED estimate.
[0050] The division of the above modules is only illustrative, and in actual application, the above functions can be completed by different functional modules according to needs, so as to complete all or part of the functions described in the foregoing method. The specific working process of each module can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here.
[0051] Another embodiment of the present application provides a computer device (computer, server, smart phone, etc.), which comprises a memory and a processor, the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing each step of the method of the present application.
[0052] Another embodiment of the present application provides a computer readable storage medium (such as ROM / RAM, magnetic disk, optical disk), which stores a computer program, and when the computer program is executed by a computer, each step of the method of the present application is implemented.
[0053] While the foregoing detailed description has set forth various specific embodiments of the application, it is to be understood that the disclosure is not to be limited to the details of construction or the arrangement of parts as set forth in the foregoing description. The foregoing detailed description is to be considered in all respects only as illustrative and not as restrictive.
Claims
1. A drug discovery method based on efficient and accurate graph edit distance computation, characterized by, The method comprises the following steps: The molecular structure of the known effective drug and the graph edit distance of the to-be-screened molecule are calculated to obtain a similarity, and a candidate molecule with potential therapeutic activity is identified according to the similarity; The calculation of the graph edit distance of the known effective drug and the to-be-screened molecule comprises: The graph is divided into a matched graph, an unmatched graph and a cross edge, wherein the matched graph comprises matched nodes, the unmatched graph comprises unmatched nodes, and the matched nodes and the unmatched nodes are connected through the cross edge; The GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge are calculated; The GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge are added to obtain a final GED estimate value; The calculation process of the GED value of the cross edge comprises: calculating the GED value of the cross edge from the perspective of the matched nodes; calculating the GED value of the cross edge from the perspective of the unmatched nodes; and taking the maximum value of the GED values of the cross edge from the two perspectives; The GED value of the cross edge is calculated from the perspective of the matched nodes, and the GED value is estimated as the sum of the differences in the number of cross edges connecting matched node pairs; The GED value of the cross edge is calculated from the perspective of the unmatched nodes, and the remaining unmatched nodes in one graph are paired with any remaining unmatched nodes in another graph to obtain a contribution estimate value of the cross edge pair to the GED.
2. A social network data mining method based on efficient and accurate graph edit distance calculation, characterized in that, The method comprises the following steps: The graph edit distance of the social network graph of two users or multiple users is calculated to obtain a similarity, and whether the friend structure of the users is similar is determined according to the similarity, so as to analyze the potential friend circle and social group belonging of the users; The calculation of the graph edit distance of the social network graph of two users or multiple users comprises: The graph is divided into a matched graph, an unmatched graph and a cross edge, wherein the matched graph comprises matched nodes, the unmatched graph comprises unmatched nodes, and the matched nodes and the unmatched nodes are connected through the cross edge; The GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge are calculated; The GED value of the matched graph, the GED value of the unmatched graph and the GED value of the cross edge are added to obtain a final GED estimate value; The calculation process of the GED value of the cross edge comprises: calculating the GED value of the cross edge from the perspective of the matched nodes; calculating the GED value of the cross edge from the perspective of the unmatched nodes; and taking the maximum value of the GED values of the cross edge from the two perspectives; The GED value of the cross edge is calculated from the perspective of the matched nodes, and the GED value is estimated as the sum of the differences in the number of cross edges connecting matched node pairs; The GED value of the cross edge is calculated from the perspective of the unmatched nodes, and the remaining unmatched nodes in one graph are paired with any remaining unmatched nodes in another graph to obtain a contribution estimate value of the cross edge pair to the GED.
3. The method according to claim 1 or 2, characterized in that, The GED value of the matched graph is calculated according to the matched pairs.
4. The method according to claim 1 or 2, characterized in that, The GED value of the unmatched graph is estimated by a neural network.
5. The method of claim 4, wherein, The calculation process of the GED value of the unmatched graph comprises: The graph pair is input into a graph neural network; The graph convolution network GCN is used to calculate embedding information of the two graphs in the graph pair respectively to obtain node embedding vectors; The node embedding vectors in the graph are aggregated to generate an embedding representation of the graph; and The embedding representation of the graph is output. The embedding representations of the two graphs are interacted using a neural tensor network (NTN) and a multi-layer perceptron (MLP) to obtain a GED value of the unmatched graph.
6. The method of claim 5, wherein, An attention mechanism-based interaction layer is introduced when calculating the node embedding vectors.
7. A drug discovery apparatus based on efficient and accurate graph edit distance computation, characterized by, The method comprises the steps of: a graph edit distance calculation module configured to calculate a graph edit distance between a molecular structure of a known effective drug and a molecule to be screened; a similarity judgment module configured to obtain a similarity based on the graph edit distance between the molecular structure of the known effective drug and the molecule to be screened, and identify a candidate molecule with potential therapeutic activity based on the similarity; the graph edit distance calculation module comprises: a graph segmentation module configured to divide the graph into a matched graph, an unmatched graph, and a cross edge, wherein the matched graph contains matched nodes, the unmatched graph contains unmatched nodes, and the matched nodes and the unmatched nodes are connected by the cross edge; a GED value calculation module configured to calculate a GED value of the matched graph, a GED value of the unmatched graph, and a GED value of the cross edge, and add the GED value of the matched graph, the GED value of the unmatched graph, and the GED value of the cross edge to obtain a final GED estimate.
8. A social network data mining device based on efficient and accurate graph edit distance computation, characterized by, The method comprises the steps of: a graph edit distance calculation module configured to calculate a graph edit distance between two user or multiple user social network graphs; a similarity judgment module configured to obtain a similarity based on the graph edit distance between the two user or multiple user social network graphs, and determine whether the friend structures of the users are similar based on the similarity, so as to analyze the potential friend circle and social group belonging of the users; the graph edit distance calculation module comprises: a graph segmentation module configured to divide the graph into a matched graph, an unmatched graph, and a cross edge, wherein the matched graph contains matched nodes, the unmatched graph contains unmatched nodes, and the matched nodes and the unmatched nodes are connected by the cross edge; a GED value calculation module configured to calculate a GED value of the matched graph, a GED value of the unmatched graph, and a GED value of the cross edge, and add the GED value of the matched graph, the GED value of the unmatched graph, and the GED value of the cross edge to obtain a final GED estimate.
9. A computer device, comprising: The computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method of any one of claims 1-6.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a computer to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Estimation method of law field graph editing distance based on Sim-GNN
CN114492567A
Graph matching method, device and equipment
CN115221359A