A heterogeneous collaborative subgraph matching method for dynamic graphs

Through the coordinated processing between CPU and GPU, the CPU handles batch updates of dynamic graphs, and the GPU handles sub-graph matching of static graphs, solving the problem of low sub-graph matching efficiency caused by batch updates, and achieving more efficient dynamic graph sub-graph matching.

CN120067713BActive Publication Date: 2025-08-26NORTHEASTERN UNIV CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510535174.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-26
Estimated Expiration
2045-04-27

AI Technical Summary

Technical Problem

The prior art has low sub-graph matching efficiency when processing batch-updated dynamic graphs, because batch update operations occupy a large amount of GPU computing resources and do not fully utilize the parallel computing power of the GPU.

Method used

Using a heterogeneous framework where CPU and GPU work together, the CPU processes batch update operations, mines dynamic data subgraph areas affected by updates, and GPU processes subgraph matching of the original data map, and merges the results of the two to improve efficiency.

Benefits of technology

Through CPU/GPU heterogeneous collaboration, the impact of batch updates on sub-graph matching is reduced, and the processing efficiency of dynamic graph sub-graph matching is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067713B_ABST
    Figure CN120067713B_ABST
Patent Text Reader

Abstract

This application proposes a heterogeneous collaborative subgraph matching method for dynamic graphs, in the field of subgraph matching technology. The method includes: obtaining a data graph, a query graph set, and a dynamic update sequence; saving the data graph to a GPU; saving the data graph and the dynamic update sequence to a CPU, and updating the data graph using the dynamic update sequence; performing parallel subgraph matching using the data graph in the GPU based on the query graph set to obtain a first subgraph matching result; performing subgraph matching using the data graph in the CPU based on the query graph set and the dynamic update sequence to obtain a second subgraph matching result; merging the first subgraph matching result with the second subgraph matching result to obtain a final subgraph matching result, and updating the data graph in the GPU based on the dynamic update sequence. The method of this application significantly reduces the time required for sub-hypergraph matching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of subgraph matching, and in particular relates to a heterogeneous collaborative subgraph matching method for dynamic graphs. Background Art

[0002] Graph structures, consisting of vertex and edge information, are widely used to represent complex relationships between various objects. In most real-world applications, graph information structures evolve over time as vertices and edges are added or removed, creating dynamic graphs. For example, social networks are a typical dynamic graph. New user registration and account cancellation can be considered as vertex additions and deletions, respectively, while following and unfollowing can be considered as edge additions and deletions, respectively. Effectively managing and querying dynamic graphs is gaining increasing attention.

[0003] Subgraph matching is one of the most fundamental problems in graph analysis, with widespread applications in protein interaction network analysis, social network analysis, and compound search. Given a query graph and a data graph, subgraph matching aims to find all subgraphs in the data graph that are isomorphic to the query graph. Although many solutions have been proposed, subgraph matching remains an NP-hard problem due to the high cost of enumerating matching processes. NP-hard problems are those that cannot be solved exactly in polynomial time.

[0004] Currently, the primary focus for dynamic graphs is solving the continuous subgraph matching problem. Continuous subgraph matching involves performing incremental matching on each individual update. However, in today's data processing environment, data volumes are enormous and dynamic updates are typically applied in batches. Retrieving patterns in batch-updated dynamic graphs is crucial. For example, in social networks, where social networks are constantly changing, retrieving the social matches of a particular individual is crucial for social analysis.

[0005] Currently, all subgraph matching algorithms based on CPUs (Central Processing Units) employ a filtering and enumeration framework. First, filtering rules are designed based on the query graph structure to filter out candidate nodes in the data graph that cannot provide a final solution. Then, a data structure is designed to store the remaining candidate matching nodes. During the enumeration phase, a matching order is determined based on the graph structure and candidate statistics. The algorithm then uses a depth-first traversal to find matching results by expanding nodes along the matching order. A GPU (Graphics Processing Unit) is a parallel processor with thousands of cores and high-bandwidth memory. Currently, many basic graph operations on large graphs are accelerated by the massively parallel computing power of GPUs, such as breadth-first traversal, shortest path, and minimum spanning tree generation. To accelerate subgraph matching, numerous GPU-based subgraph matching algorithms have been proposed. Existing methods fully utilize the parallel computing power of GPUs, significantly improving subgraph matching efficiency.

[0006] When using GPU subgraph matching to handle subgraph matching for batch updates of dynamic graphs, the graph update must be performed first, followed by the subgraph matching method. Because batch updates take a long time to process, GPU computing resources are not fully utilized during the update phase, resulting in low subgraph matching efficiency. The data graph update operation accounts for a disproportionate portion of the total matching time. Summary of the Invention

[0007] In response to the shortcomings of the existing technology, this application proposes a heterogeneous collaborative subgraph matching method for dynamic graphs. The CPU and GPU execute tasks simultaneously. The CPU mines the dynamic data subgraph area affected by the update for batch update operations, and finds the dynamic data subgraph matching results of the query graph for the dynamic data subgraph, that is, finds the incremental subgraph matching. At the same time, the GPU is used to perform subgraph matching processing on the original data graph, and the matching results are filtered to obtain the matching results of the static data subgraph that are not affected by the update. The two results are merged to obtain the subgraph matching for the dynamic graph. In the offline stage, dynamic update processing is performed on the GPU dynamic graph storage structure. The CPU / GPU heterogeneous framework avoids the impact of batch dynamic updates on subgraph matching, thereby improving the processing efficiency of dynamic graph subgraph matching. This method has strong research and application value.

[0008] In a first aspect, the present application proposes a heterogeneous collaborative subgraph matching method for dynamic graphs, comprising:

[0009] Get data graphs, query graph collections, and dynamically update sequences;

[0010] Save the data graph to the GPU;

[0011] The data graph and the dynamic update sequence are saved in the CPU, and the data graph is updated using the dynamic update sequence;

[0012] According to the query graph set, parallel subgraph matching is performed using the data graph in the GPU to obtain the first subgraph matching result;

[0013] According to the query graph set and the dynamic update sequence, subgraph matching is performed using the data graph in the CPU to obtain the second subgraph matching result;

[0014] The first subgraph matching result and the second subgraph matching result are merged to obtain a final subgraph matching result, and the data graph in the GPU is updated according to the dynamic update sequence.

[0015] Saving the data graph to the GPU includes:

[0016] In the GPU, the data graph is saved as a static data graph with a four-layer array structure, and the static data graph includes: the first layer array is a label array, which is used to store the label information of the nodes in the data graph; the second layer array is a neighbor physical address array, which is used to record the physical address information of the neighbor array of each node in the data graph; the third layer array is a node array, which is used to record each node in the data graph, and the node array includes two elements, namely the number of neighbor nodes and the size of the neighbor array; the fourth layer array is a neighbor array, and a neighbor array is independently allocated for each node in the data graph.

[0017] The method of performing parallel subgraph matching using the data graph in the GPU according to the query graph set to obtain a first subgraph matching result includes:

[0018] Find the candidate set for each node in each element of the query graph set in the static data graph;

[0019] Generate a candidate set for each edge based on the candidate set of each node;

[0020] According to the candidate set of each node and the candidate set of each edge, each element in the query graph set is converted into an edge spanning tree;

[0021] Split an edge spanning tree into multiple independent query edges;

[0022] Use GPU to process multiple independent query edges in parallel and find branch candidate results in each independent query edge;

[0023] According to the branch intersection of each independent query edge, each branch candidate result is spliced ​​to obtain the first subgraph matching result.

[0024] The step of finding a candidate set of each node in each element of the query graph set in the static data graph includes:

[0025] Determining a query order in the static data graph according to the function values ​​of the first calculation function in ascending order;

[0026] According to the query order, based on the first filtering rule and the second filtering rule, a candidate set of each node in each element of the query graph set is found in the static data graph.

[0027] The first calculation function is calculated as follows: ;

[0028] Among them, f(u) is the first calculation function, is the number of nodes in the static data graph that have the same label as a query node u in the query graph set, and d(u) is the degree of a query node u in the query graph set.

[0029] The first filtering rule is a label filtering rule, which generates a candidate node for a query node u in the static data graph according to the label information of a query node u in the query graph set.

[0030] The second filtering rule is a degree filtering rule, which generates candidate nodes for the query node u in the static data graph according to the degree information of a query node u in the query graph set.

[0031] Generating a candidate set for each edge based on the candidate set for each node includes:

[0032] For query edge , starting from the starting query node u, get the candidate node array Cand_array of the query node u, get a candidate node v in the candidate node array, and the neighbor node of the candidate node v Find the number of candidate nodes that can be used as u', form an array Cand_count with the number of candidate nodes of u', perform exclusive prefix processing on the array Cand_count, and get the neighbor nodes The storage index subscript array of the candidate node v' of u'; use the candidate node array Cand_array and the index subscript array to store each query edge and obtain the candidate set of each edge.

[0033] The step of converting each element in the query graph set into an edge spanning tree based on the candidate set of each node and the candidate set of each edge includes:

[0034] Starting from the query point with the largest degree in each query graph in the query graph set, according to the depth-first traversal strategy, the query edges visited in the traversal are used as the paths in the spanning tree until all the query edges in the candidate set of each edge are visited. The traversal process ends and an edge spanning tree is obtained.

[0035] The query graph set and the dynamic update sequence are used to perform subgraph matching using the data graph in the CPU to obtain a second subgraph matching result, including:

[0036] Finding an area affected by the dynamic update sequence by querying the maximum hop count of vertices in the query graph in the query graph set, and using the area as a dynamic data subgraph;

[0037] Determine whether each updated node in the data graph is a candidate node for a node in the query graph before and after the update. If so, perform a depth-first traversal of the maximum number of hops corresponding to the vertices in the query graph starting from the modified node, and use the subgraph formed by the depth-first traversal of all updated nodes as the incremental data subgraph; if not, skip this updated node and do nothing;

[0038] Finding a candidate set for each node in the query graph in the query graph set in the incremental data subgraph according to the third filtering rule, the fourth filtering rule, and the fifth filtering rule;

[0039] Determine the query order of incremental data subgraph matching according to the function values ​​of the second calculation function in ascending order;

[0040] Establishing an auxiliary storage structure for each candidate set of nodes, wherein the auxiliary storage structure is a set of data vertices that have a matching relationship in the data graph for each query vertex after filtering, and records whether there are edges between the data vertices;

[0041] According to the auxiliary storage structure and the backtracking algorithm, all subgraphs in the dynamic data subgraph that are isomorphic to the query graph are found, and the second subgraph matching result is obtained.

[0042] The third filtering rule is a label filtering rule, which generates candidate nodes for the query nodes in the incremental data subgraph according to the label information of the query nodes in the query graph;

[0043] The fourth filtering rule is a degree filtering rule, which generates candidate nodes for the query node in the incremental data subgraph based on the degree information of the query node in the query graph;

[0044] The fifth filtering rule is the neighbor label frequency filtering rule, which uses the neighbor nodes of the query node in the query graph Filter by: Given a node If there is a tag , then there exists ;

[0045] in , If a tag does not exist , then the node v is filtered out, where u is a query node in the query graph, N(u) is u's neighbor node, v is a node in the data graph, C(u) is u's matching candidate set, L(N(u)) is the label of u's neighbor node, |N(v,l)| is the number of nodes with label l in v's neighbor nodes, |N(u,l)| is the number of nodes with label l in u's neighbor nodes, u' is another query node in the query graph, and L(N(u')) is the label of u''s neighbor node.

[0046] The second calculation function is calculated as follows: f'(u)=|C'(u) / d(u)|;

[0047] Among them, f'(u) is the second calculation function, C'(u) is the candidate set of each node in the filtered query graph, and d(u) is the degree of a query node u in the query graph set.

[0048] Beneficial effects:

[0049] This application proposes a heterogeneous collaborative subgraph matching method for dynamic graphs. The CPU and GPU perform tasks simultaneously. The CPU mines the dynamic data subgraph area affected by the update for batch update operations, and finds the dynamic data subgraph matching results of the query graph for the dynamic data subgraph, that is, finds the incremental subgraph matching. At the same time, the GPU is used to perform subgraph matching processing on the original data graph, and the matching results are filtered to obtain the matching results of the static data subgraph that are not affected by the update. The two results are combined to obtain the subgraph matching for the dynamic graph. The CPU / GPU heterogeneous framework avoids the impact of batch dynamic updates on subgraph matching, and improves the processing efficiency of dynamic graph subgraph matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A flow chart of a heterogeneous collaborative subgraph matching method for dynamic graphs according to an embodiment of the present invention;

[0051] Figure 2 An example graph query graph Q1 of a batch dynamic graph subgraph matching example according to an embodiment of the present invention;

[0052] Figure 3 Query graph Q2 of a batch dynamic graph subgraph matching instance according to an embodiment of the present invention;

[0053] Figure 4 A data graph of a batch dynamic graph subgraph matching instance according to an embodiment of the present invention;

[0054] Figure 5 A dynamic graph of a batch dynamic graph subgraph matching instance according to an embodiment of the present invention;

[0055] Figure 6Schematic diagram of the CPU / GPU heterogeneous collaborative subgraph matching process according to an embodiment of the present invention;

[0056] Figure 7 A schematic diagram of a data graph storage structure in a GPU according to an embodiment of the present invention;

[0057] Figure 8 Schematic diagram of updating the v2 neighbor array according to an embodiment of the present invention;

[0058] Figure 9 A schematic diagram of a structure of storing an updated data graph in a GPU according to an embodiment of the present invention;

[0059] Figure 10 A schematic diagram of a candidate set of nodes according to an embodiment of the present invention;

[0060] Figure 11 The edge spanning tree of the embodiment of the present invention and the edge spanning tree of the splitting process;

[0061] Figure 12 Edge spanning tree branch splitting graph according to an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The specific implementation methods of the present application are further described in detail below in conjunction with the accompanying drawings and examples. The present application proposes a heterogeneous collaborative subgraph matching method for dynamic graphs, and for the first time proposes a subgraph matching method for batch updating of dynamic graphs. In the face of batch updates of data graphs, a subgraph matching processing task is performed on a certain query graph. This method addresses the problem of subgraph matching of dynamic graphs and proposes parallel subgraph matching with the collaboration of CPU and GPU. The GPU is used to match the unchanged parts of the data graph in parallel, and the CPU is used to match the changing parts of the data graph. The two matching results are then merged, and finally the data graph in the GPU is updated. The method of the present application greatly reduces the time required for sub-hypergraph matching.

[0063] Example:

[0064] This application proposes a heterogeneous collaborative subgraph matching method for dynamic graphs, such as Figure 1 As shown, including:

[0065] Step S1: Obtain data graph, query graph set and dynamic update sequence;

[0066] In this embodiment, given a query graph set , Q1, Q2, …, Q M To query the elements in the graph set, given a data graph G and a data graph dynamic update flow sequence ,in It is the operation of adding or deleting edges in batch data graph, where For the addition or deletion of edges. Subgraph matching for dynamic graphs is based on the data graph G according to Updated data graph Find the query graph in the query graph collection The subgraph matching results of .

[0067] like Figure 2 As shown, the initial data graph is Figure 4 As shown, the query graph collection ,like Figure 2 、 Figure 3 As shown, for the query graph , find the subgraph matching result is a subgraph consisting of deepened nodes and thickened edges, recorded as = , Dynamic update sequence , representing adding and Delete the edges between and The edges between them (as shown by the dotted lines) are updated to obtain the dynamic graph like Figure 5 As shown. ,exist The subgraph matching result is found in , such as deepening the subgraph composed of nodes, v4 and v7 are vertices in the data graph, and no subgraph matching results will be generated.

[0068] Step S2: Save the data graph to the GPU;

[0069] In this embodiment, the data graph in the GPU is the data graph before batch updating.

[0070] Saving the data graph to the GPU includes:

[0071] In the GPU, the data graph is saved as a static data graph with a four-layer array structure, and the static data graph includes: the first layer array is a label array, which is used to store the label information of the nodes in the data graph; the second layer array is a neighbor physical address array, which is used to record the physical address information of the neighbor array of each node in the data graph; the third layer array is a node array, which is used to record each node in the data graph, and the node array includes two elements, namely the number of neighbor nodes and the size of the neighbor array; the fourth layer array is a neighbor array, and a neighbor array is independently allocated to each node in the data graph.

[0072] Step S3: Save the data graph and dynamic update sequence to the CPU, and use the dynamic update sequence to update the data graph

[0073] In this embodiment, the flowchart diagram of this embodiment is as follows Figure 6This embodiment fully utilizes the advantages of the CPU and GPU, using the GPU to perform subgraph matching on static data graphs in parallel, then using the CPU to perform subgraph matching on dynamically changing areas in the data graph, and finally merging the subgraph matching results to generate the final match.

[0074] First, a static data graph needs to be constructed in the GPU. Since the previous GPU parallel subgraph matching algorithms are all for static data graphs, it is difficult to update when applied to dynamic graphs that are updated in batches. Therefore, this embodiment first proposes a storage structure for dynamic graphs, such as Figure 7 The figure shows a four-layer array storage structure. The first layer is the label array, which stores node label information. The second layer is the neighbor physical address array, which records the physical address information of each node's neighbor array. By accessing the neighbor physical address array, the node's neighbor array is found and information about all neighbor nodes of the node is obtained. The third layer is the node array. Each node contains two elements in the node array: the number of neighbor nodes and the size of the neighbor array. The number of neighbor nodes and the size of the neighbor array are used to determine the usage of the neighbor array. The fourth layer is the neighbor array. A separate neighbor array is allocated for each node, ensuring continuous storage of neighbor information. When performing dynamic graph updates, if the neighbor array is full, space in the neighbor array is dynamically allocated for adding a neighbor node. The existing neighbor nodes are copied to the new neighbor array and the addition operation is performed. To delete a neighbor node, a free list is used to dynamically mark the index position of the node to be deleted in the neighbor array, implementing logical deletion.

[0075] For example Figure 5 As shown, the data graph G is dynamically updated to obtain , the dynamic update sequence is For data node v1, add neighbor node v2, delete neighbor node v3, add neighbor node v1, and delete neighbor node v2 for v3. For node v1, since the neighbor node array size is 1, to add v2, it is necessary to dynamically allocate new neighbor node array space, copy v0 to the new space, and then add neighbor node v2.

[0076] For the v2 node, use the free list to dynamically record and delete the index position 1 of v3 in the neighbor array. When v1 is added, search for the free position in the free list and replace v3 with v1. The specific process is as follows Figure 7 If the number of newly added neighbors does not exceed the number of free lists, the overhead of allocating space can be avoided.

[0077] The processing method for v3 is similar to that for v2. The index position of the neighbor node v2 is stored in the free list to complete the logical deletion. The GPU storage structure after dynamic update is as follows: Figure 8As shown here. This indicates that the index position of v2 is stored in the free list of v3, achieving the effect of logical deletion. The storage structure of the updated data graph is as follows Figure 9 shown.

[0078] Step S4: Based on the query graph set, use the data graph in the GPU to perform parallel subgraph matching to obtain a first subgraph matching result, including:

[0079] Step S4.1: Find the candidate set for each node in each element of the query graph set in the static data graph, including:

[0080] Step S4.1.1: Determine the query order in the static data graph based on the function values ​​of the first calculation function in ascending order;

[0081] In this embodiment, in order to initialize the candidate node set for all query graph nodes, this embodiment uses a heuristic rule to generate a traversal order for the query graph. By observing the subgraph matching, we can know that if the candidate is initialized from the query node with the least candidates, the intermediate result will be the smallest. Since the number of candidates for each node is unknown before matching, this paper proposes a calculation function to determine the query order according to the calculation function value from small to large. According to the query order, according to the following two filtering rules, the candidate set of each node in the data graph is found as follows: Figure 10 shown.

[0082] The first calculation function is calculated as follows: ;

[0083] Among them, f(u) is the first calculation function, is the number of nodes in the static data graph that have the same label as a query node u in the query graph set, and d(u) is the degree of a query node u in the query graph set.

[0084] Step S4.1.2: According to the query order, based on the first filtering rule and the second filtering rule, find a candidate set of each node in each element of the query graph set in the static data graph.

[0085] The first filtering rule is a label filtering rule, which generates a candidate node for a query node u in the static data graph according to the label information of a query node u in the query graph set.

[0086] The second filtering rule is a degree filtering rule, which generates candidate nodes for the query node u in the static data graph according to the degree information of a query node u in the query graph set.

[0087] After the first and second filtering rules, the candidate set of each node is obtained, and the calculation formula is as follows:

[0088] ;

[0089] Among them, C(u) is the candidate set of node u, L(v) is the label of node v, L(u) is the label of query node u, V(G) is the static data graph, d(v) is the degree of node v, d(u) is the degree of a query node u in the query graph set, and V(G) is the static data graph.

[0090] Step S4.2: Generate a candidate set for each edge based on the candidate set for each node, including:

[0091] For query edge , starting from the starting query node u, get the candidate node array Cand_array of the query node u, get a candidate node v in the candidate node array, and the neighbor node of the candidate node v Find the number of candidate nodes that can be used as u', form an array Cand_count with the number of candidate nodes of u', perform exclusive prefix processing on the array Cand_count, and get the neighbor nodes The storage index subscript array of the candidate node v' of u'; use the candidate node array Cand_array and the index subscript array to store each query edge and obtain the candidate set of each edge.

[0092] Step S4.3: Based on the candidate set of each node and the candidate set of each edge, convert each element in the query graph set into an edge spanning tree, including:

[0093] Starting from the query point with the largest degree in each query graph in the query graph set, according to the depth-first traversal strategy, the query edges visited in the traversal are used as the paths in the spanning tree until all the query edges in the candidate set of each edge are visited. The traversal process ends and an edge spanning tree is obtained.

[0094] Step S4.4: Split an edge spanning tree into multiple independent query edges;

[0095] Step S4.5: Use the GPU to process multiple independent query edges in parallel and find branch candidate results in each independent query edge;

[0096] Step S4.6: Based on the branch intersection of each independent query edge, each branch candidate result is spliced ​​to obtain the first subgraph matching result.

[0097] In this embodiment, the query graph is converted into an edge spanning tree, and then each candidate edge is spliced ​​in parallel to generate a subgraph matching result on the static graph. Starting from the point with the largest degree in the query graph, according to the depth-first traversal strategy, the query edges visited during the traversal are used as paths in the spanning tree until all query edges are visited, and the traversal process ends. The resulting spanning tree is called the edge spanning tree and is denoted as . Figure 2 Chinese Query Map The spanning tree of Figure 11 shown.

[0098] Using the edge spanning tree of the query graph and the candidate set of query edges, the edges of the spanning tree branches are split into independent query edges, and the query edge candidates are connected to obtain the candidate set of each branch. For each branch candidate, GPU parallel processing can be used. The candidate nodes of the branch intersection are connected to form the matching result set .

[0099] like Figure 11 Edge spanning tree As shown, it contains three branches, branch 1: , branch 2: And branch 3: , for branch 1 contains two query edges and Use GPU to process three branches in parallel to find the candidate branch results. For branch 1, we need to use and The candidate results of the three branches are connected to obtain the candidate of branch 1, and the other two branches only need to find the corresponding edge candidates. The matching nodes are branched and connected to obtain the matching results. The parallel branch splitting process is as follows Figure 12 shown.

[0100] For branch 1, get and The candidate matches are and ,according to The candidate nodes of branch 1 are connected to obtain the candidate nodes of branch 1. For branch 2, the candidate is , the candidates for branch 3 are and . Generate a tree root node based on the edge The candidate pairs are serially connected, and branch 1 and branch 2 are connected to obtain the matching result. ,according to The candidate is connected with branch 3 to obtain the final query graph The matching results in the query graph G are , .

[0101] Step S5: Based on the query graph set and the dynamic update sequence, subgraph matching is performed using the data graph in the CPU to obtain a second subgraph matching result, including:

[0102] Step S5.1: Find the area affected by the dynamic update sequence by querying the maximum hop count of vertices in the query graph in the query graph set, and use the area as the dynamic data subgraph;

[0103] Step S5.2: Determine whether each updated node in the data graph is a candidate node for a node in the query graph before and after the update. If so, perform a depth-first traversal of the maximum number of hops for the corresponding vertex in the query graph starting from the modified node, and use the subgraph formed by the depth-first traversal of all updated nodes as the incremental data subgraph. If not, skip the updated node and do nothing.

[0104] In this embodiment, the area of ​​the query graph affected by the batch update is identified by the maximum number of hops from the vertices in the query graph. This is called a dynamic data subgraph. The maximum number of hops refers to the maximum number of traversal levels required to traverse the entire query graph by performing a depth-first traversal starting from a vertex in the query graph. When faced with a batch update, we first determine whether each updated node is a candidate node for a node in the query graph before and after the update. If so, we perform a depth-first traversal of the maximum number of vertices in its corresponding query graph starting from this node. The subgraph formed by the depth-first traversal of all updated nodes is called the incremental data subgraph. If not, the updated node is skipped and no operation is performed.

[0105] Step S5.3: Find a candidate set for each node in the query graph in the query graph set in the incremental data subgraph according to the third filtering rule, the fourth filtering rule, and the fifth filtering rule;

[0106] In this embodiment, the candidate set of each node in the query graph is found in the incremental data subgraph. The present invention finds the candidate set of each node in the query graph in the data graph based on the following three filtering rules on the incremental data.

[0107] The third filtering rule is a label filtering rule, which generates candidate nodes for the query nodes in the incremental data subgraph based on the label information of the query nodes in the query graph; the calculation formula corresponding to the third filtering rule is the same as that of the first filtering rule.

[0108] The fourth filtering rule is a degree filtering rule, which generates candidate nodes for the query nodes in the incremental data subgraph based on the degree information of the query nodes in the query graph; the calculation formula corresponding to the fourth filtering rule is the same as that of the second filtering rule.

[0109] The fifth filtering rule is the neighbor label frequency filtering rule, which uses the neighbor nodes of the query node in the query graph Filter by: Given a node If there is a tag , then there exists ;

[0110] in , If a tag does not exist , then the node v is filtered out, where u is the query node in the query graph, N(u) is the neighbor node of u, v is the node in the data graph, C(u) is the matching candidate set of u, L(N(u)) is the label of the neighbor node, |N(v,l)| is the number of nodes with label l in the neighbor nodes of v, |N(u,l)| is the number of nodes with label l in the neighbor nodes of u, u' is another query node in the query graph, and L(N(u')) is the label of the neighbor node of u'.

[0111] Step S5.4: Determine the query order for incremental data subgraph matching based on the function values ​​of the second calculation function from small to large;

[0112] In this embodiment, the query order of subgraph matching is determined. An efficient matching order can reduce redundant calculations and alleviate computing pressure. This embodiment designs a calculation function, namely the second calculation function, which is calculated as follows: f'(u)=|C'(u) / d(u)|;

[0113] Among them, f'(u) is the second calculation function, C'(u) is the candidate set of each node in the filtered query graph, and d(u) is the degree of a query node u in the query graph set.

[0114] Step S5.5: Establish an auxiliary storage structure for the candidate set of each node;

[0115] In this embodiment, an auxiliary storage structure is established for the candidate set of each node. The auxiliary structure is a set of data vertices that have a matching relationship in the data graph for each query vertex after filtering, and records whether there are edges between these data nodes. These data are obtained through filtering rules. In order to speed up the enumeration process, this embodiment establishes an auxiliary index structure. The auxiliary index structure is a tree structure, which is a commonly used structure in the field of CPU subgraph matching to accelerate the verification process. The nodes in the auxiliary index structure represent the matching candidate sets in the data graph corresponding to the nodes in the query graph, and the edges in the auxiliary index structure represent whether there are connected edges between the nodes in the candidate sets of different query vertices in the data graph.

[0116] Step S5.6: Based on the auxiliary storage structure and the backtracking algorithm, find all subgraphs in the dynamic data subgraph that are isomorphic to the query graph and obtain the second subgraph matching result.

[0117] In this embodiment, the backtracking algorithm starts from a node of the target subgraph, attempts to map it to a node of the main graph, and recursively searches for suitable mappings for other nodes of the target subgraph, while checking whether the mapping of the edges meets the structural requirements. If the mapping is found to be illegal at a certain step, the algorithm will backtrack to the previous step and try other possible mappings until a valid mapping is found or all possible mappings are traversed. After the auxiliary storage structure is constructed, the backtracking algorithm can quickly find the matching candidate set corresponding to the next vertex to be recursed through the auxiliary structure. Enumerate and verify to find the subgraphs in the dynamic data subgraph that are isomorphic to the query graph. According to the auxiliary structure and the backtracking algorithm, find all subgraphs in the dynamic data subgraph that are isomorphic to the query graph.

[0118] Step S6: Merge the first subgraph matching result and the second subgraph matching result to obtain a final subgraph matching result, and update the data graph in the GPU according to the dynamic update sequence.

[0119] The updating of the data graph in the GPU according to the changed portion of the data graph includes: adding neighbor nodes in the storage structure of the static data graph or deleting nodes in the storage structure of the static data graph;

[0120] The process of adding neighbor nodes to the storage structure of the static data graph is as follows:

[0121] If the neighbor array is full, it is necessary to dynamically allocate space in the neighbor array, copy the original neighbor nodes to the neighbor array with the newly added space, and perform the operation of adding neighbor nodes.

[0122] The process of deleting a node in the storage structure of the static data graph is as follows:

[0123] When deleting a node in the storage structure of a static data graph, a free list is used to dynamically mark the node to be deleted in the corresponding position in the neighbor array.

[0124] The merging of the first subgraph matching result and the second subgraph matching result includes:

[0125] Step S6.1: Filtering GPU subgraph matching results. Since some of the matching results found by the GPU have changed due to batch updates, all subgraph matching results containing nodes involved in the batch updates are removed from the GPU subgraph matching results.

[0126] Step S6.2: Merge the subgraph matching results of the CPU and the filtered subgraph matching results of the GPU.

[0127] Step S6.3: Update the data graph storage in the GPU. After completing the subgraph matching, the CPU generates a batch updated data graph storage structure and transmits it to the GPU.

[0128] In this embodiment, after the subgraph matching result of the CPU and the filtered subgraph matching result of the GPU are merged, the storage of the data graph in the GPU is updated.

[0129] The various embodiments in this application are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

[0130] The scope of protection of this application is not limited to the above-described embodiments. Obviously, those skilled in the art may make various modifications and variations to this disclosure without departing from the scope and spirit of this disclosure. If such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, the disclosure is intended to include such modifications and variations.

Claims

1. A heterogeneous collaborative subgraph matching method for dynamic graphs, characterized by: include: Get data graphs, query graph collections, and dynamically update sequences; Save the data graph to the GPU; The data graph and the dynamic update sequence are saved in the CPU, and the data graph is updated using the dynamic update sequence; According to the query graph set, parallel subgraph matching is performed using the data graph in the GPU to obtain the first subgraph matching result; According to the query graph set and the dynamic update sequence, subgraph matching is performed using the data graph in the CPU to obtain the second subgraph matching result; Merging the first subgraph matching result with the second subgraph matching result to obtain a final subgraph matching result, and updating the data graph in the GPU according to the dynamic update sequence; The method of performing parallel subgraph matching using the data graph in the GPU according to the query graph set to obtain a first subgraph matching result includes: Find the candidate set for each node in each element of the query graph set in the static data graph; Generate a candidate set for each edge based on the candidate set of each node; According to the candidate set of each node and the candidate set of each edge, each element in the query graph set is converted into an edge spanning tree; Split an edge spanning tree into multiple independent query edges; Use GPU to process multiple independent query edges in parallel and find branch candidate results in each independent query edge; According to the branch intersection of each independent query edge, each branch candidate result is spliced ​​to obtain the first subgraph matching result; The method of performing subgraph matching using the data graph in the CPU according to the query graph set and the dynamic update sequence to obtain a second subgraph matching result includes: Finding an area affected by the dynamic update sequence by querying the maximum hop count of vertices in the query graph in the query graph set, and using the area as a dynamic data subgraph; Determine whether each updated node in the data graph is a candidate node for a node in the query graph before and after the update. If so, perform a depth-first traversal of the maximum number of hops corresponding to the vertices in the query graph starting from the modified node, and use the subgraph formed by the depth-first traversal of all updated nodes as the incremental data subgraph; if not, skip this updated node and do nothing; Finding a candidate set for each node in the query graph in the query graph set in the incremental data subgraph according to the third filtering rule, the fourth filtering rule, and the fifth filtering rule; Determine the query order of incremental data subgraph matching according to the function values ​​of the second calculation function in ascending order; Establishing an auxiliary storage structure for each candidate set of nodes, wherein the auxiliary storage structure is a set of data vertices that have a matching relationship in the data graph for each query vertex after filtering, and records whether there are edges between the data vertices; According to the auxiliary storage structure and backtracking algorithm, all subgraphs in the dynamic data subgraph that are isomorphic to the query graph are found, and the second subgraph matching result is obtained; The third filtering rule is a label filtering rule, which generates candidate nodes for the query nodes in the incremental data subgraph according to the label information of the query nodes in the query graph; The fourth filtering rule is a degree filtering rule, which generates candidate nodes for the query node in the incremental data subgraph based on the degree information of the query node in the query graph; The fifth filtering rule is a neighbor label frequency filtering rule, which uses the neighbor nodes N(u) of the query node in the query graph to filter in the following manner: given a node v∈C(u), if there exists a label l∈L(N(u)), then there exists |N(v,l)|>|N(u,l)|, where L(N(u))={L(u′)|u′∈N(u)}, N(u,I)={u′∈N(u)|L(u′)=l}, if there does not exist a label l∈L(N(u)) , then filter out node v, where u is a query node in the query graph, N(u) is u's neighbor node, v is a node in the data graph, C(u) is u's matching candidate set, L(N(u)) is the label of u's neighbor node, |N(v, l)| is the number of nodes with label l among v's neighbor nodes, |N(u, l)| is the number of nodes with label l among u's neighbor nodes, u' is another query node in the query graph, and L(N(u')) is the label of u''s neighbor node; The second calculation function is calculated as follows: f'(u)=|C'(u) / d(u)|; Among them, f'(u) is the second calculation function, C'(u) is the candidate set of each node in the filtered query graph, and d(u) is the degree of a query node u in the query graph set.

2. A dynamic graph-oriented heterogeneous collaborative subgraph matching method according to claim 1, characterized in that: Saving the data graph to the GPU includes: In the GPU, the data graph is saved as a static data graph with a four-layer array structure, and the static data graph includes: the first layer array is a label array, which is used to store the label information of the nodes in the data graph; the second layer array is a neighbor physical address array, which is used to record the physical address information of the neighbor array of each node in the data graph; the third layer array is a node array, which is used to record each node in the data graph, and the node array includes two elements, namely the number of neighbor nodes and the size of the neighbor array; the fourth layer array is a neighbor array, and a neighbor array is independently allocated to each node in the data graph.

3. The method for heterogeneous collaborative subgraph matching for dynamic graphs according to claim 1, characterized in that: The step of finding a candidate set of each node in each element of the query graph set in the static data graph includes: Determining a query order in the static data graph according to the function values ​​of the first calculation function in ascending order; According to the query order, based on the first filtering rule and the second filtering rule, a candidate set of each node in each element of the query graph set is found in the static data graph; The first calculation function is calculated as follows: f(u) = freq(L(u)) / d(u); Where f(u) is the first calculation function, freq(L(u)) is the number of nodes in the static data graph that have the same label as a query node u in the query graph set, and d(u) is the degree of a query node u in the query graph set; The first filtering rule is a label filtering rule, which generates a candidate node for a query node u in the static data graph according to the label information of a query node u in the query graph set; The second filtering rule is a degree filtering rule, which generates candidate nodes for the query node u in the static data graph according to the degree information of a query node u in the query graph set.

4. The method for heterogeneous collaborative subgraph matching for dynamic graphs according to claim 1, characterized in that: Generating a candidate set for each edge based on the candidate set for each node includes: For the query edge e(u, u′), starting from the starting query node u, obtain the candidate node array Cand_array of the query node u, obtain a candidate node v in the candidate node array, find the number of nodes that can be candidates for u' in the neighboring nodes N(v) of the candidate node v, form the number of candidate nodes for u' into an array Cand_count, perform exclusive prefix processing on the array Cand_count, and obtain the storage index subscript array of the candidate node v' of u' in the neighboring node N(v); use the candidate node array Cand_array and the index subscript array to store each query edge to obtain the candidate set of each edge.

5. The method for heterogeneous collaborative subgraph matching for dynamic graphs according to claim 1, characterized in that: The step of converting each element in the query graph set into an edge spanning tree based on the candidate set of each node and the candidate set of each edge includes: Starting from the query point with the largest degree in each query graph in the query graph set, according to the depth-first traversal strategy, the query edges visited in the traversal are used as the paths in the spanning tree until all the query edges in the candidate set of each edge are visited. The traversal process ends and an edge spanning tree is obtained.

Citation Information

Patent Citations

  • GPU axis subgraph matching method based on coding tree

    CN113204552A

  • Dynamic graph increment matching method and device for decomposition sorting on large-scale query graph

    CN115757846A