A partition-based compound structure graph similarity query method

By using partitioning and incremental verification methods, the problem of high computational cost in compound graph similarity queries is solved, improving query efficiency and verification speed, and enhancing filtering effect.

CN116525025BActive Publication Date: 2026-03-27DALIAN MARITIME UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing compound graph similarity query algorithms are computationally expensive and inefficient when calculating graph edit distance, and fail to fully utilize the feature and structural information of the graph, resulting in low query efficiency.

Method used

A partition-based compound structure graph similarity query method is adopted. Through label filtering, partition filtering and incremental verification stages, the lower bound of the filtering is improved by using bridge mapping edit distance to enhance the filtering effect. In the verification stage, the mapping results of the filtering stage are used to construct a state space tree to determine the order of vertices and matching vertices.

Benefits of technology

It improves the efficiency of compound graph similarity queries, reduces computational costs, shortens verification time, and increases the speed of judging dissimilar data graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116525025B_ABST
    Figure CN116525025B_ABST
Patent Text Reader

Abstract

The application discloses a kind of compound structure graph similarity query method based on partition, including obtaining the compound structure graph to be queried, compound structure graph database G, when G is empty, then output similarity result set, when G is not empty, then successively take out compound structure graph g in G, calculate the first edit distance lower bound of g and q and judge whether threshold value is satisfied, if yes, then judge whether G is empty, if no, then set partition end condition, respectively to q and g are partitioned, calculate the second edit distance lower bound of g after partition and q and judge whether threshold value is satisfied, if yes, then judge whether G is empty, if no, then obtain mapping list generated in partition process, according to mapping list, construct state space tree, according to state space tree, calculate the third edit distance lower bound of g and q and judge whether threshold value is satisfied, if yes, then judge whether G is empty, if no, then g is added in similarity result set. Improve the speed and detection precision of similar compound structure graph.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of similar compound query, in particular to a compound structure graph similarity query method based on partition. BACKGROUND

[0002] In the process of new drug research and development, there is often a problem that it is expensive to obtain a certain target compound, which requires high time and money, or the processing process of obtaining the target compound is very complex, which consumes a lot of manpower and material resources. Therefore, pharmacists hope to use another compound with similar function to replace the target compound. When the structure information and characteristic information of the compound are more similar, the corresponding function is also more similar, so the similar function compound query can be converted into a graph query with similar structure and characteristics, that is, a graph similarity query. Help pharmacists to screen compounds and save costs.

[0003] Because the calculation of graph edit distance is an NP-Hard problem, the calculation cost is very large, and the existing research mostly uses the filtering-verification method query. In the filtering stage, the lower bound of the graph edit distance is calculated, and part of the data graph that is definitely not similar is filtered out. For the data graph that cannot be filtered out in the filtering stage, in the verification stage, the edit distance between the query graph and the data graph is calculated to determine whether it is similar. However, the existing algorithm does not fully consider the feature information and structure information of the graph, resulting in low query efficiency. And, the results generated in the filtering stage are not fully utilized, resulting in the separation of the verification stage and the filtering stage, and still requiring a large amount of time for verification. SUMMARY

[0004] The present application provides a compound structure graph similarity query method based on partition to overcome the above technical problems.

[0005] A compound structure graph similarity query method based on partition, comprising,

[0006] Step one, obtaining a query compound structure graph q, a compound structure graph database G, and a threshold, initializing a similar result set to be empty,

[0007] Step two, judging whether G is empty, if empty, output the similar result set, if not empty, take out the compound structure graph g in G in turn, calculate the first edit distance lower bound of g and q according to the label set difference between g and q, judge whether the first edit distance lower bound meets the threshold, if it meets the threshold, re-judge whether G is empty, if it does not meet the threshold, execute step three,

[0008] Step three, setting a partition end condition, partitioning q and g respectively, calculating the second edit distance lower bound of the partitioned g and q, judging whether the second edit distance lower bound meets the threshold value, if it meets, returning to step two to rejudge whether G is empty, if it does not meet the threshold value, executing step four,

[0009] Step four, obtaining the mapping list generated in the partition process, constructing a state space tree according to the mapping list, calculating the third edit distance lower bound of g and q according to the state space tree, judging whether the third edit distance lower bound meets the threshold value, if it meets the threshold value, returning to step two to rejudge whether G is empty, if it does not meet the threshold value, indicating that g and q are similar, adding g to the similar result set, and returning to step two to rejudge whether G is empty.

[0010] Preferably, the first edit distance lower bound of g and q is calculated according to the label set difference between g and q, including calculating the first edit distance lb1(q, g) of g and q according to formula (1),

[0011]

[0012] Wherein, L V (q) represents the label set of the vertex in q, L V (g) represents the label set of the vertex in g, L E (q) represents the label set of the edge in q, L E (g) represents the label set of the edge in g, The difference between the label set S1 and the label set S2 is represented by |S1|, which represents the size of the set, According to formula (2),

[0013]

[0014] Wherein, S1 represents L V (q), L E (q), S2 represents L V (g), L E (g).

[0015] Preferably, the step three includes,

[0016] Step 1.1: initialize the second edit distance lower bound lb2(q, g) of g and q = 0, set variable MapVerOrder2 to empty, MapVerOrder2 is used to store the vertex set contained in the next partition, add the vertex with the largest degree in q and its neighbor nodes to variable MapVerOrder2,

[0017] Step 1.2: Determine whether MapVerOrder2 is empty. If MapVerOrder2 is not empty, continue to step 1.3; otherwise, execute step 1.8;

[0018] Step 1.3: Initialize variable MapVerOrder1 to empty, which is used to store the vertex set contained in the current partition. Add the first vertex in MapVerOrder2 and its neighbor nodes to MapVerOrder1,

[0019] Step 1.4: Initialize the small root heap to empty, and the small root heap is used to store vertex mappings. Respectively obtain vertex mappings f from the vertex mapping set, and obtain the partition part formed by q and the subgraph g formed by g f according to the vertex mapping f. Calculate the partition mapping edit distance ped f (part, g f ) between the partition part and the subgraph g f , and sort according to the size of ped f (part, g f ). Execute step 1.5;

[0020] Step 1.5: Determine whether the small root heap meets the partition end condition. If the partition end condition is met, execute step 1.6; otherwise, execute step 1.7,

[0021] Step 1.6: Select the to-be-mapped vertex u and the vertex mapping f from MapVerOrder1. Make mapping matching pairs between the to-be-mapped vertex u and all vertices v in the matching vertex group N f (u), to obtain a new vertex mapping f = f ∪ u→v. Calculate the partition mapping edit distance ped f (part, g f ), and put it into the small root heap The to-be-mapped vertex u and the non-mapping vertex group form a matching pair as a whole to obtain a new vertex mapping The partition mapping edit distance increases by 1, and is put into the small root heap Update MapVerOrder1, and return to step 1.5;

[0022] Step 1.7: Add the vertex mapping in the small root heap to the mapping list fList, update variable MapVerOrder2, and return the top of the small root heap The ped f (part, g f ) in the top is added to lb2(q, g).

[0023] Step 1.8: judging whether lb2(q, g) satisfies a threshold value; if yes, returning to Step 2 to rejudge whether G is empty; if not, executing Step 4.

[0024] Preferably, the calculating the partition mapping edit distance ped f (part, g f ) comprises calculating the partition mapping edit distance ped f (part, g f ) according to formula (3)

[0025] ped f (part, g f ) = med f (part, g f ) + bed f (part, g f ) (3)

[0026]

[0027]

[0028] wherein med f (part, g f ) is an intra-partition mapping edit distance, bed f (part, g f ) is a bridge mapping edit distance, med f (part, g) = 0 when , the subgraph corresponding to the vertices and edges of q under mapping f' is part', and the subgraph corresponding to the vertices and edges of q under mapping f is part, u'→v' is a vertex pair belonging to f', and l q (u) represents the label of vertex u, l g (v) represents the label of edge v, l q (u, u') represents the label of edge (u, u'), represents whether the labels of the newly added vertex pair u→v are the same, represents whether the labels of the newly added vertex pair u→v and the labels of the edges connected to the vertices in the original mapping f' are the same, and L Bri (u) represents the label set of the edges connected to vertex u and not connected to part.

[0029] Preferably, the partition end condition comprises a first partition end condition and a second partition end condition, the first partition end condition is that the partition mapping edit distance of the top of the heap is not 0, and the length of the mapping at the top of the heap is not shorter than the lengths of the mappings in the heap; and the second partition end condition is that the minimum heap The vertex set contained in the stack top mapping of the stack top mapping is the same as the vertex contained in the MapVerOrder1.

[0030] The application provides a partition-based compound structure graph similarity query method, which comprises the following steps: firstly, in the label filtering stage, a method with small calculation cost is used to filter target compounds; secondly, for the target compounds that cannot be filtered out in the label filtering stage, in the partition filtering stage, the query graph is divided into multiple non-overlapping partitions based on the partition idea, and the filtering lower bound is calculated gradually; meanwhile, the filtering lower bound is improved according to the bridge mapping edit distance, and the filtering effect of the previous filtering method is enhanced; for the data graph that cannot be filtered out in the partition filtering stage, in the incremental verification stage, the mapping vertex order and the matching vertex order in the verification stage are determined by using part of the mapping results reserved in the filtering stage, and the state space tree of the query graph and the data graph is incrementally constructed, so that the judgment speed of the dissimilar data graph is improved. BRIEF DESCRIPTION OF DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative labor.

[0032] Figure 1 is a method flowchart of the present application;

[0033] Figure 2 is an example of the target compound and the drug database graph set of the present application;

[0034] Figure 3 is a process schematic diagram of obtaining the first partition part1 of the present application;

[0035] Figure 4 is a process schematic diagram of obtaining the second partition part2 of the present application;

[0036] Figure 5 is a process schematic diagram of incrementally establishing the state space tree of the present application. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative labor are within the protection scope of the present application.

[0038] In the pharmaceutical industry, there is often a drug q that shows good activity, but it takes a lot of time to obtain the drug q. Therefore, it is desired to find a drug with similar activity to drug q, but manual checking is not realistic. Considering that drugs with similar structures have similar activities, a drug compound is represented as a graph structure, where a vertex represents an atom and an edge represents a chemical bond. By calculating the graph edit distance between q and each drug in the graph set, it is determined whether they are similar and have similar activities.

[0039] Figure 1 For the method flowchart of the present application, as shown in Figure 1 The method of the embodiment can include:

[0040] Step one, obtaining a query compound structure graph q, a compound structure graph database G, and a threshold value, initializing the similar result set to be empty,

[0041] Step two, determining whether G is empty, if it is empty, output the similar result set, if it is not empty, take out the compound structure graph g in G in turn, which means obtaining g from G and deleting g from G, calculate the first edit distance lower bound between g and q according to the label set difference between g and q, determine whether the first edit distance lower bound meets the threshold value, if it meets the threshold value, re-determine whether G is empty, if it does not meet the threshold value, execute step three,

[0042] Step three, setting a partition end condition, partitioning q and g respectively, calculating the second edit distance lower bound of the partitioned g and q, determining whether the second edit distance lower bound meets the threshold value, if it meets, returning to step two to re-determine whether G is empty, if it does not meet the threshold value, executing step four,

[0043] Step four, obtaining the mapping list generated in the partitioning process, constructing a state space tree according to the mapping list, calculating the third edit distance lower bound of g and q according to the state space tree, determining whether the third edit distance lower bound meets the threshold value, if it meets the threshold value, returning to step two to re-determine whether G is empty, if it does not meet the threshold value, it means that g and q are similar, g is added to the similar result set, and step two is returned to re-determine whether G is empty.

[0044] Based on the above scheme, firstly, in the label filtering stage, a method with lower computational cost is used to filter target compounds. Secondly, for target compounds that were not filtered out in the label filtering stage, in the partition filtering stage, based on the idea of ​​partitioning, the query graph is divided into multiple non-overlapping partitions, and the filtering lower bound is calculated step by step. At the same time, the filtering lower bound is improved by the bridge mapping edit distance, enhancing the filtering effect of previous filtering methods. For data graphs that were not filtered out in the partition filtering stage, in the incremental verification stage, the partial mapping results retained in the filtering stage are used to determine the mapping vertex order and matching vertex order in the verification stage, incrementally constructing the state space tree of the query graph and the data graph, improving the speed of judging dissimilar data graphs.

[0045] Step 1: Obtain the structure diagram q of the compound to be queried, the compound structure diagram database G, and the threshold τ. Initialize the similarity result set Sim(q, G, τ) to be empty.

[0046] The graph obtained from the compound conversion is represented by a triplet: q = (V q E q , l q ), where V q Let q represent the set of vertices. Let l represent the set of edges of graph q. q Label functions for vertices and edges, l q (u) represents the label of vertex u, l q (u, v) represents the label of edge (u, v).

[0047] Step 2: Determine if G is empty. If it is empty, output the similar result set. If it is not empty, extract the compound structure diagram g from G in sequence. Calculate the lower bound of the first edit distance between g and q based on the tag set difference between g and q. The calculation of the lower bound of the first edit distance between g and q based on the tag set difference between g and q includes calculating the first edit distance lb1(q, g) between g and q according to formula (1).

[0048]

[0049] Among them, L V (q) represents the label set of vertices in q, L V (g) represents the set of labels for the vertices in g, L E (q) represents the label set of the edges in q, L E (g) represents the set of labels for the edges in g. This represents the difference between label set S1 and label set S2, where |S1| represents the size of the set. Calculated according to formula (2),

[0050]

[0051] Where S1 represents L V (q), L E (q), S2 respectively represent L V (g), L E (g)

[0052] Determine if the lower bound of the first edit distance meets the threshold. If it does, re-determine if G is empty. If it does not meet the threshold, proceed to step three.

[0053] Step 3: Set the partition termination conditions, which include a first partition termination condition and a second partition termination condition. The first partition termination condition is a heap termination condition. The edit distance of the partition mapping at the top of the heap is not 0, and the length of the mapping at the top of the heap is not shorter than the length of other mappings in the heap. The second partitioning ends when all vertices in the variable MapVerOrder1 have been partitioned. Partition q and g respectively, calculate the lower bound of the second edit distance between g and q after partitioning, and determine whether the lower bound of the second edit distance meets the threshold. If it does, return to step two to re-determine whether G is empty. If it does not meet the threshold, proceed to step four.

[0054] Step three specifically includes,

[0055] Step 1.1: Initialize the second edit distance lower bound lb2(q, g) between g and q to 0. Set the variable MapVerOrder2 to empty. MapVerOrder2 is used to store the set of vertices contained in the next partition. Add the vertex with the largest degree in q and its neighbor nodes to the variable MapVerOrder2. Specifically, obtain the vertex with the largest degree in q based on the vertex access order strategy and add it to the variable MapVerOrder2.

[0056] The vertex access order strategy specifically includes setting two variables, which store partial vertices of the target compound q, and the specific storage rules are as follows. The variable MapVerOrder1 is the order of the vertices to be mapped in the current partition, and stores the neighbor vertices of the vertices that have been mapped in the current partition. The variable MapVerOrder2 is the order of the vertices to be preferentially mapped in the next partition, and stores the neighbor vertices of the vertices that have been partitioned and have not been partitioned. For each newly established partition, first, the vertex u with the maximum degree in the variable MapVerOrder2 is accessed, the vertex u is added to the variable MapVerOrder1, and the neighbor vertices of the vertex u are added to the variable MapVerOrder1. Then, the vertices u are selected from the variable MapVerOrder1 in turn for access, and the neighbor vertices of the vertex u that have not been partitioned are added to the variable MapVerOrder1. Finally, when the accessed vertices can form a partition, the un-mapped vertices in the variable MapVerOrder1 are added to the variable MapVerOrder2.

[0057] Step 1.2: Determine whether MapVerOrder2 is empty. If MapVerOrder2 is not empty, continue to step 1.3; otherwise, execute step 1.8.

[0058] Step 1.3: Initialize the variable MapVerOrder1 to be empty, and MapVerOrder1 is used to store the vertex set contained in the current partition. The first vertex in MapVerOrder2 and its neighbor nodes are added to MapVerOrder1,

[0059] Step 1.4: Select a vertex to be mapped from MapVerOrder1, and according to the vertex to be mapped and all vertices in the vertex set V g of g, a vertex mapping set is established, and a small root heap is initialized to be empty. The small root heap is used to store the vertex mapping set, and the vertex mapping f is obtained from the vertex mapping set, respectively. The partition part formed by q and the subgraph g f formed by g are obtained according to the vertex mapping f, the partition mapping edit distance ped f (part, g f ) between the partition part and the subgraph g f is calculated, and the ped f (part, g f ) is sorted according to the size, and step 1.5 is executed.

[0060] The calculation of the partition mapping edit distance ped f (part, g f) includes calculating the partition mapping edit distance ped according to formula (3) f (part, g f ),

[0061] ped f (part, g f ) = med f (part, g f ) + bed f (part, g f ) (3)

[0062]

[0063]

[0064] wherein med f (part, g f ) is the intra-partition mapping edit distance, bed f (part, g f ) is the bridge mapping edit distance, med f (part, g) = 0 when , the subgraph of vertices and edges corresponding to q under mapping f' is called part', and the subgraph of vertices and edges corresponding to q under mapping f is called part, u'→v' is a vertex pair belonging to f', l q (u) denotes the label of vertex u, l g (v) denotes the label of edge v, l q (u, u') denotes the label of edge (u, u'), denotes whether the labels of the newly added vertex pair u→v are the same, denotes whether the labels of the newly added vertex pair u→v and the edges connected to the vertices in the original mapping f' are the same, L Bri (u) denotes the label set of the edges connected to vertex u that are not connected to part

[0065] Step 1.5: Determine whether the small root heap satisfies the partition end condition, if it satisfies the partition end condition, execute step 1.6, otherwise execute step 1.7, the partition end condition includes a first partition end condition and a second partition end condition, the first partition end condition is that the partition mapping edit distance of the top of the small root heap is not 0, and the length of the mapping at the top is not shorter than the lengths of the other mappings in the heap; the second partition end condition is that the vertex set contained in the mapping at the top of the variable small root heap is the same as the vertices contained in MapVerOrder1.

[0066] Step 1.6: Select the vertex to be mapped, u, and the vertex mapping, f, from MapVerOrder1. The vertex to be mapped, u, is matched with the vertex group N. f For all vertices v in (u), perform mapping matching to obtain a new vertex mapping f = f∪u→v, and calculate the partition mapping edit distance ped. f (part, g) f ), put into a min-heap Vertex u to be mapped and the group of unmapped vertices The whole system forms matching pairs, resulting in new vertex mappings. Increase the edit distance of the partition mapping by 1 and add it to the min-heap. Update MapVerOrder1 and return to step 1.5;

[0067] The vertex grouping strategy specifically includes, given a target compound q, a data compound g, a mapping f, and a vertex u to be mapped, obtaining the vertex v' of g corresponding to the neighboring vertex u′ of vertex u under mapping f. The set N(v′) of the neighboring vertices of v′ is called the matching vertex group corresponding to vertex u under f, denoted as: and Vertex set V g The set of the remaining vertices is called the non-matching vertex set. u and non-mapped vertex group The partition part corresponding to the new mapping f = f′∪u→v formed by any vertex v is the edit distance ped. f (part, g) f )≥ped f′ (part′,g f′ )+1.

[0068] Execute step 1.7: Convert the min-heap Add the vertex mappings to the mapping list fList, update the variable MapVerOrder2, and return the min-heap. ped at the top of the heap f (part, g) f ), add to lb2(q, g);

[0069] Step 1.8: Determine if lb2(q, g) meets the threshold. If yes, return to step two to re-determine if G is empty; otherwise, proceed to step four.

[0070] Step four, obtaining the mapping list generated by the partition process, constructing a state space tree according to the mapping list, calculating a third edit distance lower bound of g and q according to the state space tree, judging whether the third edit distance lower bound meets a threshold value, if the threshold value is met, returning to step two to rejudge whether G is empty, if the threshold value is not met, indicating that g and q are similar, adding g to the similar result set, and returning to step two to rejudge whether G is empty.

[0071] The step four specifically comprises, in the incremental verification stage, using the result fList filtered by the partition, using depth traversal to establish a state space tree, judging whether it is similar, and initializing the mapping f to be empty. According to the incremental strategy, a variable MapVerOrder is determined, and step 6.1 is executed.

[0072] Incremental strategy: according to the mapping list fList obtained in the partition filtering stage, the mapping order of the vertex in the verification is the same as that in fList, which is represented by a variable MapVerOrder. The matching vertex order of each mapping vertex u in the variable MapVerOrder is also the same as that of vertex u in fList, which is represented by a variable MatVerOrder(u).

[0073] Step 6.1: judging whether f is a complete mapping from q to g. If yes, ged(q, g)≤τ, returning true, adding q to Sim(q, G, τ), and executing step two. If not, step 6.2 is executed.

[0074] Step 6.2: obtaining a mapping vertex u from MapVerOrder, and determining a variable MatVerOrder(u) according to the incremental strategy. Step 6.3 is executed.

[0075] Step 6.3: taking out vertex v in the variable MatVerOrder(u) in turn, expanding the original mapping f to obtain a new mapping f′=f∪u→v, and calculating the state edit distance sed f′ (q, g) corresponding to the mapping f′. f′ Judging whether the state edit distance sed f′ (q, g) is less than or equal to the threshold value τ. If yes, step 6.1 is executed to continue expanding the mapping f′. If not, step 6.2 is continuously executed until the vertex is traversed and MatVerOrder(u) is empty, returning false, indicating that f does not meet the threshold requirement.

[0076] The calculation formula of the state edit distance sed f (q, g) corresponding to the new mapping f′=f∪u→v is:

[0077]

[0078] Where, fed f(q f g f ) is a subgraph q f subgraph g f Map edit distance. When At that time, fed f (q f g f ) = 0. When f is a complete mapping, sed f (q, g) = ged(q, g). In the second part... This represents a subgraph of the query graph q that is not under mapping f. This represents a subgraph of the data graph g that is not under mapping f. Subgraph and The difference in tag sets. Part Three It is the difference between the corresponding bridge label set under mapping f.

[0079] Step 6.4: After the depth-first traversal in steps 6.1-6.3 is completed, if no f that meets the threshold requirement is found, then return false.

[0080] This embodiment conducts experiments on the target compound and database atlas, specifically including... Figure 2 The target compound is transformed into q, and the drug set is transformed into a database atlas G = {g1, g2}. Using the label filtering method with a calculated lower bound designed in this invention, L in the target compound q is obtained. V (q)={A, A, A, B, B, B, C, C}, L E (q) = {a, a, a, a, a, b, b, b}. Data on compound g2, L V (g2)={A,A,B,B,B,B,B,C},L E (g2) = {a, a, a, a, b, b, b}. Therefore, we obtain... lb1(q, g2) = 3. This indicates that q and g2 are mapped... Considering only the differences in vertex and edge labels, at least three editing steps are needed to convert the target compound q into compound g2. Similarly, lb1(q, g1) = 0. When a similarity threshold τ = 2 is given, since lb1(q, g2) = 3 > τ, it can be directly determined that q and g2 are not similar. However, since lb1(q, g1) = 0, further partitioning and filtering are needed to determine whether q and g1 are similar.

[0081] against Figure 2 The target compound q and the data compound g = g1 are compared using the partitioned filtering method designed in this invention to determine whether the target compound q and the data compound g = g1 are dissimilar. Figure 3To obtain a schematic diagram of the process of the first partition part1, the initial heap... If empty, the variable MapVerOrder1 = [u2]. Select the vertex u2 to be mapped from the variable MapVerOrder1, and match it with the vertex set V. g Mapping all vertices in the partition results in 8 mappings, as shown in the third column. The corresponding edit distances of these mappings are shown in the fourth column. We then check if the partitioning termination condition is met. If condition ① is met, the partitioning ends, resulting in partition part1 containing vertex u2. Under the mapping f = [u2→v2], we obtain the edit distance ped. f (part1, g) f Since lb2(q, g) = 1 / 2, after the first partitioning is completed, lb2(q, g) = 1 / 2. When the similarity threshold τ = 5 is given, since lb2(q, g) < τ, further partitioning is required. Figure 4 To obtain a schematic diagram of the process of the second partition part2, the first vertex u3 of variable MapVerOrder2 is retrieved to initialize variable MapVerOrder1 = [u3], and the heap is initialized. Empty. If conditions ① and ② are not met, retrieve the first vertex u3 to be mapped from MapVerOrder1. Then, combine vertex u3 with all vertices V in the vertex set of the data compound g. g Mapping {v1, v2, v3, v4, v5, v6, v7, v8} yields 8 mappings. The partition mapping edit distance for each mapping is calculated and then processed in the heap. Sort the partitions by edit distance from smallest to largest. As shown in Part 1, the top of the heap now corresponds to the mapping [u3→v3]. Check both partition termination conditions ① and ②; neither meets the conditions, so the top of the heap needs further expansion. Next, retrieve the top of the heap's mapping [u3→v3] to obtain the vertex u4 to be mapped. The vertex u4 is then matched with the matching vertex group. Map each vertex in the map and calculate the partition map edit distance for each mapping. The vertex to be mapped, u4, is compared with the non-matching vertex group. Global mapping, with a partition mapping edit distance of 1. Heap The partitions are sorted in ascending order of edit distance, as shown in Part 2, resulting in the heap top mapping [u3→v7]. Partition termination conditions ① and ② are checked; if neither is met, the heap top mapping needs to be expanded. This process is repeated, resulting in the mapping shown in Part 3. If partition termination condition ① is met, partitioning stops, and the vertex set of partition part2 is obtained. Pick The partition mapping editing distance corresponding to the heap top mapping is lb2(q, g) = 3 / 2. When the similarity threshold τ = 1 is given, because lb2(q, g) > τ, it can be directly judged that q and the data compound g = g1 are not similar. When the similarity threshold τ = 5 is given, because lb2(q, g) < τ, it is necessary to continue the partition judgment. The variable MapVerOrder2 is updated using the variable MapVerOrder1, the vertices in MapVerOrder1 that have not formed a partition are added to MapVerOrder2, and MapVerOrder2 = [u7, u8, u1, u5] is obtained. The partition filtering judgment method designed by the application is repeatedly executed in turn, and when the partition of q ends, lb2(q, g) = 5 / 2 is obtained. When the similarity threshold τ = 2 is given, because lb2(q, g) > τ, it can be directly judged that q and the data compound g = g1 are not similar. When the similarity threshold τ = 5 is given, because lb2(q, g) < τ, it is necessary to continue the verification judgment.

[0082] Figure 5 When the similarity threshold τ = 5 is given, the partition filtering method cannot be directly used to judge whether it is similar or not, and the mapping result obtained in the partition filtering stage is used to design a state space tree, wherein v represents a matching vertex.

[0083] According to the incremental strategy, the variable MapVerOrder = [u2, u3, u4, u7, u8, u1, u5, u6] is obtained. Given the threshold τ = 5, the mapping is expanded The process of incrementally establishing the state space tree is as shown in Figure 5 Since f1 is not a full mapping, the vertex u2 to be mapped is obtained from MapVerOrder, and MatVerOrder(u2) = [v2, v1, v3, v4, v5, v6, v7, v8] is obtained from the mapping list fList. u2 is sequentially mapped with the vertices to be matched in MatVerOrder(u2), and the mapping f2 = [u2→v2] is first obtained, and the corresponding state editing distance Since The mapping f2 is continuously expanded. The mapping f 15 = [u2→v2, u3→v3, u4→v4, u7→v7, u8→v8, u1→v1, u5→v5, u6→v6] is a full mapping, and true is returned, indicating that the target compound q and the data compound g are similar at the threshold τ = 5. The data compound g = g1 is added to the similar result set Sim(q, G, τ) = {g1}, and finally the similar result set Sim(q, G, τ) = {g1} is returned.

[0084] The overall beneficial effects are:

[0085] The application provides a partition-based compound structure graph similarity query method, which comprises the following steps: firstly, in the label filtering stage, a method with small calculation cost is used to filter target compounds; secondly, for the target compounds that cannot be filtered out in the label filtering stage, in the partition filtering stage, the query graph is divided into multiple non-overlapping partitions based on the partition idea, and the filtering lower bound is calculated gradually; meanwhile, the filtering lower bound is improved according to the bridge mapping edit distance, and the filtering effect of the previous filtering method is enhanced; for the data graph that cannot be filtered out in the partition filtering stage, in the incremental verification stage, the mapping vertex order and the matching vertex order in the verification stage are determined by using the partial mapping results reserved in the filtering stage, the state space tree of the query graph and the data graph is incrementally constructed, and the judgment speed of the dissimilar data graph is improved.

[0086] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for subgraph-based similarity query of compound structures, characterized in that, include, Step one, obtaining the structure diagram of the compound to be queried , the compound structure diagram database G, and the threshold, initialize the similar result set to be empty, Step two, judge whether G is empty, if empty, output similar result set, if not empty, take out compound structure graph in G in turn , according to and The label set difference between the calculation and The first edit distance lower bound, judge whether the first edit distance lower bound meets the threshold value, if it meets the threshold value, rejudge whether G is empty, if it does not meet the threshold value, execute step three, according to and q between the label set difference calculation And the first edit distance lower bound of q includes calculating The first edit distance between q and q according to formula (1) , (1) wherein denotes the set of labels of the vertex in the middle, denotes the set of labels of the vertex in g, denotes the set of labels of the edge in q, denotes the set of labels of the edge in g, denotes the set of labels and the set of labels the difference between the sets of labels denotes the size of a set, is calculated according to formula (2), (2) in, They represent , , They represent , ; Step 3: Set the partition end conditions, respectively for... and Perform partitioning and calculate the partitioned result. and The second lower bound of the edit distance is determined. It is then checked whether the second lower bound of the edit distance meets the threshold. If it does, the process returns to step two to re-determine whether G is empty. If it does not meet the threshold, step four is executed. Step three includes... Step 1.1: Initialize the lower bound of the second edit distance for g and q Set variables Empty Used to store the set of vertices contained in the next partition, Add the vertex with the highest moderate degree and its neighboring nodes to the variables. , Step 1.2: Determine Is it empty? If not empty, continue with step 1.3; otherwise, proceed to step 1.

8. Step 1.3: Initialize variables Empty Used to store the set of vertices contained in the current partition. The first vertex and its neighboring nodes are added to the list. , Step 1.4: Initialize the min heap is empty, the min heap is used to store the vertex mapping set. Obtain vertex mappings from the vertex mapping set respectively , and according to the vertex mapping obtain the formed partition and the formed subgraph , calculate the partition mapping edit distance between the partition and the subgraph , and sort according to the size, and execute Step 1.5; Step 1.5: Determine the min-heap Check if the partition termination condition is met. If it is, proceed to step 1.6; otherwise, proceed to step 1.

7. Step 1.6: From Select the vertex to be mapped and vertex mapping Vertices to be mapped Matching Vertex Groups All vertices in Perform mapping matching to obtain new vertex mappings. Calculate the partition mapping edit distance Add to a small heap Vertices to be mapped Non-mapped vertex group The whole system forms matching pairs, resulting in a new vertex mapping. Increase the partition mapping edit distance by 1 and add it to a min-heap. ,renew Return to step 1.5; Step 1.7: Convert the min-heap Add the vertex mapping to the mapping list Update variables Return to min-heap At the top of the heap Join superior; Step 1.8: Determine Does the threshold need to be met? If yes, return to step two to re-evaluate whether G is empty; otherwise, proceed to step four. Step 4: Obtain the mapping list generated during the partitioning process, construct a state space tree based on the mapping list, and calculate based on the state space tree. and The third lower bound of the edit distance is used to determine whether it meets the threshold. If it does, the process returns to step two to re-evaluate whether G is empty. If it does not meet the threshold, then... and Similar, will Add it to the similar result set and return to step two to re-determine whether G is empty.

2. The method for finding similar compound structure diagrams based on partitioning according to claim 1, characterized in that, The calculation Corresponding partition mapping edit distance This includes calculating the partition mapping edit distance according to formula (3). , (3) (4) (5) in, For the intra-partition mapping edit distance, Edit the distance for the bridge mapping, when hour, , mapping correspond The subgraph formed by the vertices and edges of a graph is called a subgraph. , mapping correspond The subgraph formed by the vertices and edges of a graph is called a subgraph. , It belongs to Vertex pairs, Represents vertices The tag, Representing an edge The tag, Representing an edge The tag, Indicates the newly added vertex pair Are the labels the same? Indicates the newly added vertex pair With the original mapping Are the edge labels connected to all internal vertices the same? Represents vertices and non The set of labels for the connected edges.

3. The method for finding similar compound structure diagrams based on partitioning according to claim 2, characterized in that, The partitioning termination conditions include a first partitioning termination condition and a second partitioning termination condition. The first partitioning termination condition is a min-heap. The edit distance of the partition mapping at the top of the heap is not 0, and the length of the mapping at the top of the heap is not shorter than the length of other mappings in the heap; the second partition ends when the heap is min-heap. The set of vertices contained in the heap top mapping and They contain the same vertices.

Citation Information

Patent Citations

  • Privacy-protected graph similarity retrieval method and system

    CN115905633A

  • Graph querying, graph motif mining and the discovery of clusters

    US20070239694A1