A multi-subgraph matching method, device and equipment
By performing parallel matching and load balancing on multiple query graphs, the problem of low efficiency in multi-subgraph queries is solved, and efficient and accurate multi-subgraph matching is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-05-27
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies are inefficient when performing queries on multiple subgraphs, and cannot effectively improve the speed of multi-subgraph matching.
By grouping multiple query graphs and using hash values for parallel matching, combined with load balancing and data graph partitioning, a parallel processing approach is adopted to improve matching efficiency.
It achieves high efficiency and accuracy in multi-subgraph matching, reduces invalid matching operations, and improves the overall matching speed and success rate.
Smart Images

Figure CN115470236B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graph computing technology, and in particular to a method, apparatus and device for matching multiple subgraphs. Background Technology
[0002] Graph data can be used to represent relationships between things in the real world, such as social networks, transportation networks, and biological networks. Graph data enables in-depth research into these relationships. For example, in social networks, graph data can be used to find other potential suspects whose social network graphs overlap with those of a known criminal; in biology, graph data can be used to find relationships between predators and prey.
[0003] Subgraph query refers to finding a subgraph in the data graph that matches (i.e., is identical to) the query graph. Currently, the method for single subgraph queries is relatively mature. After receiving a single query graph, the nodes in the query graph are first searched in the data graph, filtering out irrelevant nodes. Then, a breadth-first search (BFS) strategy is used to select a vertex as the root node in the query graph, and then the remaining nodes in the query graph are traversed level by level to determine the node matching order. Finally, the data graph, after filtering out irrelevant nodes, is matched according to the node matching order to determine the subgraph that matches the query graph.
[0004] In practical applications, when performing subgraph queries, it is often necessary to receive multiple query graphs. If a single subgraph query is performed for each query graph in the manner described above, the subgraph query speed will be slowed down and the efficiency will be low. Summary of the Invention
[0005] This application provides a multi-subgraph matching method, apparatus, and device to improve the efficiency of subgraph matching for multiple query graphs.
[0006] Firstly, embodiments of this application provide a multi-subgraph matching method. This method can be executed by a multi-subgraph matching device or by devices in a multi-subgraph matching system working together. Here, we will illustrate this method using a multi-subgraph matching device as an example. Executing this method by devices in a multi-subgraph matching system is similar to executing the method by a multi-subgraph matching device, except that when devices in a multi-subgraph matching system work together, one device performs a portion of the method, and data interaction can exist between the devices. In this embodiment, multi-subgraph matching refers to subgraph matching for multiple query graphs.
[0007] In this method, the multi-subgraph matching device first receives multiple query graphs, each representing multiple nodes and the connections between them. After receiving the multiple query graphs, the device can group them. For example, it can group the multiple query graphs based on their hash values, generating multiple sets of query graphs where multiple query graphs with hash values within the same range belong to the same group. Then, the device can perform parallel matching of the multiple sets of query graphs with the data graph to obtain matching results. These matching results represent the matching of multiple query graphs with the data graph.
[0008] By grouping the multiple query graphs into multiple sets of query graphs using the above method, and then performing subgraph matching between these multiple sets of query graphs and the data graph in parallel, the efficiency of subgraph matching can be effectively improved. Furthermore, grouping the multiple query graphs using hash values accelerates the grouping process, ensuring overall high efficiency in subgraph matching.
[0009] In one possible implementation, when the multi-subgraph matching device groups the multiple query graphs, it can also consider the load balancing of the query graphs so that the query cost of each group of query graphs in the multiple groups of query graphs is within the same range, wherein the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same group.
[0010] Using the above method, the query cost of each query graph in the multiple query graphs is within the same range, so that when the multiple query graphs and data graphs are matched in parallel, the amount of work consumed in matching each query graph and data graph is roughly the same or similar, and the matching results of each query graph and query graph can be obtained as simultaneously or within the same time range as possible, so as to achieve the effect of load balancing.
[0011] In one possible implementation, when the multi-subgraph matching device performs parallel matching of multiple sets of query graphs and data graphs to obtain matching results, it can also divide the data graph and generate multiple data subgraphs; then, multiple matching tasks are executed in parallel, each matching task being used to match one data subgraph among the multiple data subgraphs with one set of query graphs among the multiple sets of query graphs.
[0012] By using the above method, the division of data subgraphs can further reduce the invalid matching operations that may occur during the matching of a set of queries and data graphs, so as to ensure the efficiency of multi-subgraph matching.
[0013] In one possible implementation, for a data subgraph involved in a matching task, the data subgraph includes nodes of all query graphs in a set of query graphs involved in the matching task. That is, multiple matching tasks include a first matching task, which is used to match a first data subgraph with a first set of query graphs in multiple sets of query graphs, wherein the first data subgraph includes nodes of all query graphs in the first set of query graphs.
[0014] Using the above method, the data subgraph in a matching task includes nodes of all query graphs in a set of query graphs involved in the matching task, which can improve the success rate of matching the data subgraph with the set of query graphs, thereby increasing the possibility of obtaining a subgraph that matches the query graph in the set of query graphs from the data subgraph and ensuring the accuracy of multi-subgraph matching.
[0015] In one possible implementation, taking the execution of a first matching task as an example, the method of executing the matching task is described. When executing the first matching task, the task subgraph of each query graph in the first group of query graphs can be determined from the first data subgraph. The task subgraph of the query graph includes all nodes of the query graph. In this embodiment, multiple query graphs can correspond to one task subgraph, in which case the task subgraph includes all nodes of the corresponding multiple query graphs. A query graph can also correspond to only one task subgraph, in which case the task subgraph includes all results of the corresponding query graph. After determining the task subgraphs of each query graph, the multi-subgraph matching device can match the task subgraph of each query graph with a common subgraph. The common subgraph is the common part included by each query graph in the first group of query graphs. For any query graph, if the task subgraph of the query graph matches successfully with the common subgraph, the multi-subgraph matching device can match the task subgraph of the query graph with the part of the query graph excluding the common subgraph to obtain the matching result of the task subgraph of the query graph and the query graph.
[0016] The above method first matches the task subgraph of the query graph with the common subgraph of the group of query graphs. Only after a successful match is the remaining part of the query graph matched. In other words, if the task subgraph of the query graph fails to match with the common subgraph of the group of query graphs, no further actions are needed, improving efficiency. Furthermore, when multiple query graphs correspond to the same task subgraph, that task subgraph only needs to be matched with the common subgraph of the group of query graphs once. It is not necessary to perform a matching operation with the common subgraph of the group of query graphs for each of the multiple query graphs, reducing redundant matching operations and improving matching efficiency.
[0017] In one possible implementation, when the task subgraph of the query graph fails to match the common subgraph, the multi-subgraph matching device can directly determine that the matching result is a failure. That is, there is no subgraph in the first data subgraph that matches the query graph, and further, there is no subgraph in the data graph that matches the query graph.
[0018] Using the above method, when the task subgraph and the common subgraph of the query graph fail to match, the matching result can be obtained directly, which is highly efficient.
[0019] In one possible implementation, the hash value of each query graph is obtained based on the LSH.
[0020] Using the above method, the LSH function is fast and has low complexity. When using the LSH function to group the query graph, it can speed up the grouping process and further improve the subgraph matching efficiency.
[0021] Secondly, embodiments of this application also provide a multi-subgraph matching device. This multi-subgraph matching device has the function of implementing the behavior in the method example of the first aspect described above. The beneficial effects can be found in the description of the first aspect and will not be repeated here. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. In one possible design, the device structure includes a receiving module, a grouping module, and a matching module. These modules can perform the corresponding functions in the method example of the first aspect described above, as detailed in the method example, and will not be repeated here.
[0022] Thirdly, embodiments of this application also provide a multi-subgraph matching system, which includes a control device and multiple matching devices. The control device and the multiple matching devices can cooperate to implement the method executed by the multi-subgraph matching device in the method example of the first aspect. The beneficial effects can be found in the description of the first aspect and will not be repeated here.
[0023] A control device is used to receive multiple query graphs, each of which represents multiple nodes and the connection relationships between the nodes; the multiple query graphs are grouped according to the hash value of each query graph to generate multiple groups of query graphs, wherein multiple query graphs with hash values in the same range belong to the same group;
[0024] Multiple matching devices are used to match multiple sets of query graphs and data graphs in parallel to obtain matching results. Among them, one matching device is used to match one set of query graphs and data graphs in parallel to obtain matching results.
[0025] In one possible implementation, the query costs of each set of query graphs in the multiple query graphs are within the same range, wherein the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same set.
[0026] In one possible implementation, the control device can further divide the data graph and generate multiple data subgraphs; each matching device can acquire one data subgraph. Multiple matching devices can execute multiple matching tasks in parallel, with one matching device executing one matching task. Each matching task is used to match one data subgraph among multiple data subgraphs with one set of query graphs among multiple sets of query graphs; one matching device is used to execute one matching task.
[0027] In one possible implementation, the multiple matching tasks include a first matching task, which is used to match a first data subgraph with a first set of query graphs in the multiple sets of query graphs, wherein the first data subgraph includes nodes of all query graphs in the first set of query graphs.
[0028] In one possible implementation, when the matching device performs the first matching task, it can determine the task subgraph of each query graph of the first set of query graphs from the first data subgraph, wherein the task subgraph of the query graph includes all nodes of the query graph.
[0029] For each query graph, the task subgraph is matched with the common subgraph, which is the common part included in each query graph of the first group of query graphs.
[0030] If any task subgraph of the query graph successfully matches the common subgraph, the task subgraph of the query graph is matched with the parts of the query graph excluding the common subgraph to obtain the matching result between the task subgraph of the query graph and the query graph.
[0031] In one possible implementation, the matching device may also determine that there is no subgraph matching the query graph in the first data subgraph if the task subgraph of the query graph fails to match the public subgraph, that is, obtain the matching result between the task subgraph of the query graph and the query graph.
[0032] In one possible implementation, the hash value of each query graph is obtained based on the LSH.
[0033] Fourthly, this application also provides a computing device, which includes a processor and a memory, and may further include a communication interface. The processor executes program instructions stored in the memory to perform the method provided in the first aspect or any possible implementation thereof. The memory is coupled to the processor and stores program instructions and data necessary for the multi-subgraph matching process. The communication interface is used to communicate with other devices, such as acquiring multiple query graphs and sending matching results.
[0034] Fifthly, this application provides a computing device system comprising at least one computing device. Each computing device includes a memory and a processor. The processor of at least one computing device is configured to access code in the memory to execute the methods provided in the first aspect or any possible implementation thereof.
[0035] Sixthly, this application provides a non-transient readable storage medium, which, when executed by a computing device, performs the method provided in the first aspect or any possible implementation thereof. The storage medium stores a program. The storage medium includes, but is not limited to, volatile memory, such as random access memory, and non-volatile memory, such as flash memory, hard disk drive (HDD), and solid-state drive (SSD).
[0036] In a seventh aspect, this application provides a computing device program product, which includes computer instructions that, when executed by a computing device, enable the computing device to perform the methods provided in the first aspect or any possible implementation thereof. The computer program product may be a software installation package, which can be downloaded and executed on a computing device when the methods provided in the first aspect or any possible implementation thereof are required. Attached Figure Description
[0037] Figure 1 A schematic diagram of the system architecture provided in this application;
[0038] Figure 2 A flowchart illustrating the cooperation between a control device and a matching device in performing multi-subgraph matching, as provided in this application;
[0039] Figure 3 This application provides a schematic diagram of a method for multi-subgraph matching.
[0040] Figure 4 A schematic diagram of data graph partitioning provided in this application;
[0041] Figure 5 This application provides a schematic diagram of multi-query graph grouping;
[0042] Figure 6 A schematic diagram of a query graph matching plan provided in this application;
[0043] Figure 7 A schematic diagram illustrating the determination of a public candidate node provided in this application;
[0044] Figure 8 A schematic diagram of the annotation in a task sub-graph provided in this application;
[0045] Figure 9 This application provides a schematic diagram of the structure of a multi-subgraph matching device;
[0046] Figure 10 A schematic diagram of the structure of a control device provided in this application;
[0047] Figure 11 A schematic diagram of the structure of a matching device provided in this application;
[0048] Figures 12-13 A schematic diagram of the structure of a computing device provided in this application. Detailed Implementation
[0049] Before describing the multi-subgraph matching method provided in the embodiments of this application, the relevant concepts involved in the embodiments of this application will be explained first:
[0050] (1) Graph, Nodes
[0051] A graph is a data structure composed of nodes and edges. Graphs can be used to represent objects in different domains and the relationships between them. Taking a social network as an example, the nodes in the graph can represent people in the social network, and the edges in the graph can represent the relationships between people in the social network.
[0052] To distinguish nodes in a graph, an identifier can be configured for each node, uniquely representing it. Furthermore, labels can be configured for nodes based on the attributes of the object they represent. Using a graph representing a social network as an example, the labels for nodes could include information such as the person's job title, workplace, or age. While node identifiers are unique, node labels can be repeated.
[0053] When an edge exists between two nodes in a graph, it indicates a connection between them; the two nodes are neighbors. The meaning of an edge varies across different domains. For example, in a graph representing a social network, an edge indicates a connection between the people represented by the two nodes. In a graph representing a transportation network, an edge indicates a road connecting the intersections represented by the two nodes.
[0054] (2) Query chart, data chart
[0055] Subgraph matching refers to finding subgraphs in graph B that are identical to graph A. To distinguish between graph A and graph B, graph A is called the query graph, and graph B is called the data graph.
[0056] (3) and / or
[0057] "And / or" includes three types of relationships. Taking A and / or B as an example, A and / or B includes A, B, and A and B.
[0058] like Figure 1 The diagram shown is a schematic of a system architecture provided in an embodiment of this application. The system includes a matching system 100 and a client 200.
[0059] The client 200 is deployed on the user side. The user can transmit multiple query graphs to the client 200 and trigger the client 200 to initiate a subgraph matching request to the matching system 100, which is used to request the matching device 100 to match the multiple query graphs.
[0060] The embodiments of this application do not limit the specific form of the client 200. The client 200 may be a computing device deployed on the user side or an application installed on the user's computing device.
[0061] The matching system 100 can receive subgraph matching requests from the client 200, execute the subgraph matching method provided in this application embodiment, and after obtaining the matching results of the multiple query graphs, the matching system 100 can also return the matching results of the multiple query graphs to the client 200.
[0062] Specifically, within the matching system 100, the matching system 100 includes a control device 110 and multiple matching devices 120. This application embodiment does not limit the deployment location of the control device 110 and the matching devices 120. For example, the control device 110 or the matching devices 120 can be deployed in an edge data center, a cloud data center, or a terminal computing device. When the control device 110 and any matching device 120 are deployed in different locations, the matching system 100 can be a distributed system. When the control device 110 and multiple matching devices 120 are deployed in the same location, the matching system 100 can be a centralized system.
[0063] like Figure 2 As shown in this embodiment, the control device 110 can divide multiple query graphs into multiple groups of query graphs, and send these multiple groups of query graphs to each matching device 120. The control device 110 can also acquire a data graph (e.g., data acquired from a file storage system), divide the data graph into multiple data subgraphs, and send these multiple data subgraphs in groups to the matching devices 120. Each matching device 120 can acquire some or all of the multiple data subgraphs. Each matching device 120 can perform a subgraph matching operation on a group of query graphs. That is, each matching device 120 can perform subgraph matching on the group of query graphs based on the acquired data subgraphs, obtain the matching result of the group of query graphs, and feed it back to the control device 110.
[0064] In this embodiment, the specific forms of the control device 110 and the matching device 120 are not limited. Taking the control device 110 as an example, the control device 110 can be a physical device, such as a computing device or a component of the computing device. The control device 110 can also be a software device, such as a virtual machine, container, or other application deployed on the computing device. The matching device 120 is similar.
[0065] It should be noted that, Figure 1 The system architecture applicable to the embodiments of this application is only illustrated by example. In some possible scenarios, the subgraph matching method provided in the embodiments of this application can also be executed by a computing device (such as a multi-subgraph matching device). The process of the computing device executing the subgraph matching method is similar to the process of the matching system 100 executing the subgraph matching method. The operations performed by the control device and the matching device can be executed by threads in the computing device. The computing device may include multiple threads. One thread can execute the operations or methods executed by the control device, and the remaining threads can execute the operations or methods executed by the multiple matching devices.
[0066] The following is an example Figure 1 Taking the architecture shown as an example, the subgraph matching method provided in this application embodiment will be described. See [link to relevant documentation]. Figure 3 The method includes:
[0067] Step 301: The control device 110 acquires the data graph and divides the data graph into multiple data sub-graphs.
[0068] This application embodiment does not limit the method by which the control device 110 acquires the data graph. For example, the data graph may be sent by the user to the control device 110 through the client 200, and the control device 110 may receive the data graph from the client 200. After receiving the data graph, the control device 110 may directly execute step 301, or it may execute step 301 when multiple query graphs are subsequently received.
[0069] For example, the data graph may be pre-configured in the control device 110. When the control device 110 determines that data graph partitioning or subgraph matching is required (e.g., the control device 110 receives an instruction triggered by the user through the client, such as an instruction to partition the data subgraph or an instruction to perform subgraph matching on multiple query graphs), the control device 110 executes step 301.
[0070] For example, the data graph can be stored in a file storage system. When the control device 110 determines that subgraph matching or data graph partitioning is required, it can retrieve the data graph from the file storage system and then partition the data graph.
[0071] The control device 110 can divide the data graph in many ways. For example, the control device 110 can divide the data graph into multiple data subgraphs of the same size. Or, the control device 110 can group together parts with a high degree of structural similarity (e.g., above a threshold) according to the nodes in the data graph and the connections between the nodes, forming a single data subgraph. In this way, multiple data subgraphs can be formed, with each data subgraph having similar nodes and connections between them.
[0072] For example, control device 110 can also use a hash algorithm to partition the data graph. Control device 110 can traverse the nodes of the data graph. For each node traversed (e.g., obtaining the node's identifier and label), the node is input into the hash algorithm (e.g., inputting the node's identifier or label into the hash algorithm). The output value of the hash algorithm is used to identify the partition of the node. Nodes belonging to the same partition constitute a data subgraph. When there are multiple partitions, the data graph will form multiple data subgraphs.
[0073] like Figure 4 The image shown illustrates a data graph partitioning method provided in an embodiment of this application. Figure 4 The example illustrates seven nodes in a data graph: v1, v2, v3, v4, v5, v6, and v7. Control device 110 uses a hash algorithm to partition v1, v2, v3, and v4 into two partitions: v1 and v3 are in partition A, and v2 and v4 are in partition B. Control device 110 also uses a hash algorithm to partition v5, v6, and v7 into two partitions: v5 and v7 are in partition A, and v6 is in partition B. The nodes v1, v3, v5, and v7 belonging to partition A form a data subgraph. The nodes v2, v4, and v6 belonging to partition B form a data subgraph.
[0074] Step 302: The control device 110 sends multiple data sub-graphs to each matching device 120 respectively, and each matching device 120 obtains one data sub-graph.
[0075] After dividing the data map into multiple data sub-maps, the control device 110 can send one data sub-map to each matching device 120.
[0076] For example, the control device 110 can send the information of the data subgraph to the matching device 120. The information of the data subgraph may include the node's identifier, the node's label, and a set (the set of the node's neighbor nodes may record the identifiers and labels of the node's neighbor nodes).
[0077] For example, the control device 110 can send the storage address of the data subgraph (such as the storage address of the data subgraph in the control device 110 or the file storage system) to the matching device 120. After obtaining the storage address of the data subgraph, the matching device 120 can retrieve the data subgraph based on the storage address of the data subgraph.
[0078] It should be noted that in practical applications (such as when the data graph is small), the control device 110 may not execute steps 301 to 302. The control device 110 can directly send the data graph to each matching device 120 after acquiring it. Of course, in another possible scenario, the control device 110 may not acquire the data graph, and the matching device 120 may acquire it itself.
[0079] Step 303: The control device 110 acquires multiple query graphs, groups the multiple query graphs, and generates multiple sets of query graphs.
[0080] Users can send the multiple query graphs to control device 110 through client 200. For example, users can send a subgraph matching request to control device 110 through client 200. The subgraph matching request carries multiple query graphs and is used to request subgraph matching of the multiple query graphs.
[0081] After acquiring the multiple query graphs, the control device 110 can group them. The purpose of grouping the multiple query graphs in step 303 is to group query graphs with high structural similarity together. High structural similarity can also be understood as the query graphs having the same common subgraphs.
[0082] In order to speed up the grouping efficiency of query graphs, the control device 110 can use the locality-sensitive hashing (LSH) function to group the multiple query graphs.
[0083] Taking LSH as the Min-Hash function as an example, for any query graph among the multiple query graphs, the control device 110 can apply the Min-Hash function to the node set of the query graph (which records the labels and identifiers of each node), and the output value of the Min-Hash function is the group number to which the query graph belongs. By applying the Min-Hash function to the node set of each query graph, the control device 110 can determine the group number to which each query graph belongs.
[0084] Because the LSH function itself has the advantages of high speed and low complexity, when using the LSH function to group the query graph, it can greatly speed up the grouping process and further improve the subgraph matching efficiency.
[0085] like Figure 5 The diagram shown is a schematic diagram of a multi-query graph grouping provided in an embodiment of this application. Figure 5 Only three query graphs are shown as examples: query graph Q1, query graph Q2, and query graph Q3. Query graphs Q1 and Q2 are in group 1, and query graph Q3 is in group 4.
[0086] When grouping multiple query graphs using the LSH algorithm, the number of query graphs in each group may vary; that is, one group may have a larger number of query graphs than another. If the number of query graphs in a group is large, exceeding a set value, the control device 110 can further divide that group into multiple subgroups. The method of further dividing a group is not limited; it can be done by grouping multiple query graphs or by using other methods.
[0087] For example, the control device 110 can calculate the query cost of each query graph, which can characterize the workload consumed in performing subgraph matching on the query graph. This application embodiment does not limit the method of measuring this workload; for example, it can be measured by the number of edges or nodes in the query graph, or the time consumed in performing subgraph matching on the query.
[0088] When further dividing the query graph group, the control device 110 can refer to the query cost of each query graph in the group and divide the group into multiple groups based on a load balancing strategy. The sum of the query costs of the query graphs in each group after the group is divided is equal, or the sum of the query costs of the query graphs in any two groups differs little (e.g., less than a threshold), meaning the sum of the query costs of the query graphs in each group is within the same range. After further dividing one or more query groups, multiple sets of query graphs can be obtained (these multiple sets of query graphs include one or more sets of query graphs that have been further divided). The query costs of each query group in the final multiple sets of query graphs are within the same range. This ensures that the workload consumed by the subsequent matching device 120 when performing subgraph matching on any group of query graphs is approximately the same.
[0089] The embodiments of this application do not limit the calculation method of the query cost of the query graph, but one method of calculating the query cost of the query graph is listed here.
[0090] First, the control device 110 converts each edge in the data graph into a two-column table (a database table), where each edge corresponds to a row in the table, and each row includes two elements, representing the two nodes connected by the edge. The query graph is decomposed into multiple join operations of the database, and the query cost of the query graph can be approximated by the multiple join cost of the database.
[0091] Among them, the connection cost based on the database The calculation formula is as follows:
[0092]
[0093] Where T(R) is the number of tuples in relation R, and V(R,Y) is the number of distinct values of attribute Y in relation R.
[0094] After dividing the multiple query graphs, the control device 110 can execute step 304.
[0095] Step 304: The control device 110 sends the grouping result to each matching device 120, and each matching device 120 obtains the multiple sets of query graphs. The grouping result includes the multiple query graphs and the group to which each query graph belongs.
[0096] For any matching device 120, after receiving the multiple sets of query graphs, steps 305 to 307 can be executed. The multiple matching devices 120 can operate in parallel, meaning they can execute steps 305 to 307 simultaneously. This parallel operation of multiple matching devices 120 can further accelerate the subgraph matching process, ensuring that the subgraph matching results can be obtained relatively quickly. Here, we will use one of the matching devices 120 as an example to explain the execution of steps 305 to 307.
[0097] Step 305: After receiving the multiple sets of query charts, the matching device 120 selects one or more sets of the multiple sets of query charts.
[0098] After receiving the multiple sets of query graphs, the matching device 120 can select one or more sets of query graphs for subgraph matching. Since each matching device 120 has already acquired a data subgraph, when selecting one or more sets of query graphs, the matching device 120 can select one or more sets of query graphs based on the acquired data subgraphs.
[0099] For example, the nodes in the data subgraphs acquired by the matching device 120 include nodes from any of the selected set of query graphs. Specifically, the matching device 120 can determine the node set of each set of query graphs in the multiple sets of query graphs. The node set of each set of query graphs is the union of the node sets of each query graph in that set of query graphs (a node that is repeated in each query graph in that set of query graphs can appear only once in the set of query graphs in that set of query graphs). If the node set of the data graph is determined to contain the node set of the set of query graphs, then the set of query graphs is selected; otherwise, it is not selected. In this way, the set of query graphs selected by the matching device 120 has many identical nodes with the acquired data subgraphs, and the selected set of query graphs has a high degree of similarity with the acquired data subgraphs, which can further ensure the success rate of subsequent subgraph matching.
[0100] After selecting one or more sets of query graphs, the matching device 120 can execute step 306. Of course, in some scenarios (such as scenarios where each set of query graphs includes a large number of nodes), when the matching device 120 receives multiple sets of query graphs, the matching device 120 may not execute step 305, but instead match each set of query graphs with the acquired data subgraphs. The matching device 120 can internally create multiple threads, and each thread matches a set of query graphs with the acquired data subgraphs.
[0101] Step 306: The multiple matching devices 120 can execute multiple matching tasks in parallel. Each matching device 120 executes one matching task. The matching task executed by each matching device is to perform subgraph matching on one or more selected query graphs based on the acquired data subgraphs.
[0102] In step 306, each matching device 120 performs subgraph matching on any selected set of query graphs based on the acquired data subgraph in the same way. Here, we will take the example of a matching device 120 performing subgraph matching on a set of query graphs based on the acquired data subgraph for illustration.
[0103] Step 1: For any query graph in the set of query graphs, the matching device 120 can first configure the node matching plan for that query graph. The node matching plan indicates the matching order of nodes in the query graph. First, the matching device 120 selects a node with a low label frequency and a high degree (degree refers to the number of neighboring nodes of a node) as the root node from the query graph. Then, starting from the root node, a breadth-first search (BFS) traversal is performed on the query graph to obtain the level order of the query graph, where the level order of the query graph divides the nodes of the query graph into layers. Afterwards, the matching device 120 sorts the nodes in the query graph according to the level order of the query graph to generate the node matching plan for the query graph.
[0104] like Figure 6 As shown, two query graphs are displayed: query graph Q1 and query graph Q2. In query graph Q1, select u... 13 As the root node, select u in the query graph Q2. 23 As the root node.
[0105] After performing a BFS traversal on both query graphs Q1 and Q2, the level order of query graphs Q1 and Q2 can be obtained. The root node u of query graph Q1... 13 The root node u is located at level 1, and the rest are located at level 2. Query the root node u of graph Q2. 23 Located on the first layer, the remaining nodes are located on the second layer.
[0106] Matching device 120 sorts the nodes in query graph Q1 according to the hierarchical order of query graph Q1, and can obtain the node matching plan {u} of query graph Q1. 13 u 11 u 12 u 14 u 15 The matching device 120 sorts the nodes in the query graph Q2 according to the hierarchical order of the query graph Q2, and can obtain the node matching plan {u} of the query graph Q2. 23 u 21 u 22 u 24}
[0107] Step 2: After configuring the node matching plan for each query graph, the matching device 120 can obtain the task subgraph of each query graph from the data subgraph according to the node matching plan of each query graph.
[0108] For any query graph, the matching device 120 can first obtain a seed node from the data subgraph based on the root node of the query graph. Specifically, for any neighbor node of the root node, the seed node has at least one neighbor node with the same label as a neighbor node of the root node. That is, for a neighbor node of the root node with label P, the seed node has at least one neighbor node with label P as well. This seed node can be used as the first node in the task subgraph.
[0109] Subsequently, the matching device 120 can traverse the nodes in the query graph according to the node matching plan. For each node traversed in the query graph, it identifies nodes in the data graph that are identical to nodes in the query graph and adds them to the task subgraph of the query graph. Once all nodes in the query graph have been traversed, a complete task subgraph can be generated. Nodes in the data graph that are identical to nodes in the query graph satisfy some or all of the following conditions: the node in the data graph has the same label as the node in the query graph; the connection relationship between the node in the data graph and the node in the query graph is the same (e.g., the labels of the node's neighboring nodes are the same as the labels of the neighboring nodes of the corresponding node in the query graph).
[0110] For multiple query graphs in this set of query graphs (these multiple query graphs can be all or part of the query graphs in this set of query graphs), there may be cases where the seed nodes obtained from the data subgraphs are the same. In this case, a task subgraph can be generated for these multiple query graphs. The method for generating the task subgraph can be referred to the above description. The task subgraph can include the nodes in the multiple query graphs. The task subgraph is the task subgraph corresponding to the multiple query graphs.
[0111] It should be noted that for any given query graph, the matching device 120 may obtain multiple seed nodes from the data subgraph. For each seed node, the matching device 120 traverses the nodes in the query graph according to the node order in the node matching plan, determines the nodes in the data graph that are identical to the nodes in the query graph, and adds them to the task subgraph of that query graph. That is, one seed node can generate one task subgraph. In order to further reduce the number of task subgraphs and reduce the workload of subsequent subgraph matching, after obtaining multiple seed nodes from the data subgraph, the matching device 120 can further determine the set of neighboring nodes for each seed node. If there are seed nodes with overlapping neighbor node sets among the multiple seed nodes, the seed nodes with overlapping neighbor node sets can be considered together, such as adding seed nodes with overlapping neighbor node sets to the same task subgraph. Seed nodes with completely different neighbor node sets can be considered separately, such as adding seed nodes with different neighbor node sets to different task subgraphs.
[0112] Step 3: After the matching device 120 obtains the task subgraph for each query graph, for any query graph, the matching device 120 can first match the task subgraph of the query graph with the common subgraph of the group of query graphs. The common subgraph of the group of query graphs is the common part of all query graphs in the group of query graphs.
[0113] The matching device 120 matches the task subgraph of the query graph with the common subgraph of the group of query graphs in a similar way to the single subgraph query method. That is, it determines whether the task subgraph includes the nodes of the common subgraph and whether the connection relationship between the nodes in the task subgraph is the same as the connection relationship of the same nodes in the common subgraph.
[0114] If the task subgraph of the query graph fails to match the common subgraph of the group of query graphs, it means that the task subgraph cannot match the common subgraph. Furthermore, the task subgraph cannot match the query graph either, and the matching result of the query graph is unsuccessful. There is no subgraph in the data graph that matches the query graph. If the task subgraph of the query graph successfully matches the common subgraph of the group of query graphs, it means that the task subgraph may match the query graph, and the matching device 120 can continue to execute step 4.
[0115] Step 4: The matching device 120 matches the task subgraph of the query graph with the part of the query graph excluding the common subgraph.
[0116] When matching the task subgraph of the query graph with the part of the query graph excluding the common subgraph, the matching device 120 can use the single subgraph matching method.
[0117] If there are multiple query graphs in the group of query graphs that successfully match the task subgraph with the common subgraph, such as the task subgraph being the common task subgraph for all of these query graphs, the matching device 120 can comprehensively consider the multiple query graphs that successfully match the task subgraph with the common subgraph. The matching device 120 can also continue to preprocess the portion of these multiple query graphs excluding the common subgraph to find common candidate nodes. After determining the common candidate nodes, the matching device 120 can first match the common candidate nodes with the task subgraphs of the multiple query graphs. After a successful match, for any query graph excluding the common subgraph and the portion before the common candidate nodes, the matching device 120 can match the task subgraph of the query graph with the remaining portion of the query graph (the matching method can be a single subgraph matching method).
[0118] Specifically, the matching device 120 can determine common candidate nodes based on the node matching plans of the multiple query graphs. These common candidate nodes refer to the same nodes in the node matching plans of the multiple query graphs. If multiple common candidate nodes exist, these multiple common candidate nodes are nodes with the same order in the node matching plans of the multiple query graphs.
[0119] like Figure 7 The diagram shown illustrates the determination of common candidate nodes. Figure 7 The image shows two query graphs, query graph Q4 and query graph Q5. Figure 7The labels for each node in query graphs Q4 and Q5 are marked. For query graph Q4, the node matching plan is {A, B, C, D, E, F}, and for query graph Q5, the node matching plan is {A, B, C, D, E, G}. Both the node matching plans {A, B, C, D, E, F} and {A, B, C, D, E, G} share a common component: {A, B, C, D, E}. Nodes labeled A, B, C, D, and E are the common candidate nodes for both query graphs Q4 and Q5. These common candidate nodes are included in both query graphs Q4 and Q5, and their ordering is the same in both query graphs Q4 and Q5.
[0120] After identifying the common candidate nodes, the matching device 120 determines the nodes that can be matched in the task subgraphs of the multiple query graphs. A matchable node is one whose label is the same as the common candidate node's, and whose connectivity in the task subgraph (which can be understood as the node's neighboring nodes) is the same as the common candidate node's connectivity in the query graph. This means that the node has at least one neighboring node with the same label in the task subgraph as any of the common candidate node's neighboring nodes in the query graph.
[0121] Since the common candidate node is a node included in all the multiple query graphs, for any common candidate node, the matching device 120 may determine a matchable node in the task subgraphs of the multiple query graphs that matches the common candidate node in all query graphs, or it may only match the common candidate node in some of the query graphs. Therefore, the matching device 120 can label the matchable nodes determined in the task subgraphs of the multiple query graphs, labeling the query graphs they satisfy, or labeling them that satisfy the constraints of one or more query graphs.
[0122] by Figure 7 Taking query graphs Q4 and Q5 as examples, the nodes labeled A, B, C, D, and E are the common candidate nodes of query graphs Q4 and Q5. Nodes labeled A, B, and C are nodes in the common subgraph of query graphs Q4 and Q5, and points matching nodes labeled A, B, and C can be found in the task subgraphs of query graphs Q4 and Q5. Nodes labeled D and E are not nodes in the common subgraph of query graphs Q4 and Q5. It is necessary to further determine whether nodes labeled D and E satisfy the constraints of query graphs Q4 and / or Q5 in the task subgraphs of query graphs Q4 and Q5.
[0123] For a node labeled D, the matching device 120 can determine whether there is a matchable node in the task subgraph of query graph Q4, and whether there are nodes with the same label and the same connection relationship (i.e., whether there is a node labeled C among the neighboring nodes of the node labeled D in the task subgraph of query graph Q4). If so, the node is marked as satisfying the constraints of query graph Q4. Similarly, the matching device can also determine whether there is a matchable node in the task subgraph of query graph Q5, and if so, mark the node as satisfying the constraints of query graph Q5.
[0124] For a node labeled E, the matching device 120 can determine whether there is a matching node in the task subgraph of query graph Q4, and whether there are nodes with the same label and the same connection relationship (i.e., whether there is a node labeled C among the neighboring nodes of the node labeled D in the task subgraph of query graph Q4). If so, the node is marked as satisfying the constraints of query graph Q4. Similarly, the matching node can also determine whether there is a matching node in the task subgraph of query graph Q5, and if so, the node is marked as satisfying the constraints of query graph Q5.
[0125] After the matching device 120 determines the common candidate nodes that can be matched in the task subgraphs of the multiple query graphs, the matching device can perform backtracking search matching on the multiple query graphs.
[0126] Specifically, the matching device 120 can first add nodes in the common subgraph to the matching queue. Then, it traverses each common candidate node, finds a common candidate node that simultaneously satisfies the constraints of multiple query graphs, and adds the satisfying common candidate node to the matching queue. After traversing the common candidate nodes, it performs single subgraph matching on the remaining parts of each query graph excluding the matching queue.
[0127] like Figure 8Using query graphs Q4 and Q5 as the query graphs, the nodes that can be matched for each common candidate node are marked in the task subgraph G (which is the task subgraph that both query graphs Q4 and Q5 are related to). For example, in the task subgraph G, node v4 is marked as satisfying the constraints of both query graphs Q4 and Q5, node v6 is marked as satisfying the constraints of query graph Q4, and node v5 is marked as satisfying the constraints of both query graphs Q4 and Q5. When performing backtracking search matching on query graphs Q4 and Q5, firstly, the nodes {v1, v2, v3} that match in the common subgraph in the task subgraph G are placed into the matching queue. Then, node v4 in the task subgraph that satisfies both query graphs Q4 and Q5 is checked, and node v4 is matched with both query graphs Q4 and Q5 respectively. If both matches are successful, node v4 is added to the matching queue, and the matching queue becomes {v1, v2, v3, v4}. Similarly, continue checking v5. If all matches are successful, add node v5 to the matching queue, making the matching queue {v1, v2, v3, v...} 4, v5}. When there are no nodes that simultaneously satisfy the constraints of both graph Q4 and query graph Q5, the matching process for query graph Q4 degenerates into single-subgraph matching for the remaining part of query graph Q4 (excluding the matching queue). The matching device 120 checks node v7 in the task subgraph and matches it with the remaining part of query graph Q4 to obtain a matching result {v1,v2,v3,v4,v5,v7} for query graph Q4.
[0128] For the matching of query graph Q5, the subsequent matching process degenerates into single-subgraph matching for the remaining part of query graph Q5 (excluding the matching queue). The matching device 120 checks the nodes in the task subgraph and finds no node that matches the remaining part of query graph Q5, so the matching fails.
[0129] Based on the matching process of common candidate nodes, only one matching is required for common candidate nodes {v4,v5}, which can reduce the amount of repetitive matching work and improve the efficiency of subgraph matching.
[0130] Step 307: The matching device 120 feeds back the matching result of the matching task to the control device 110.
[0131] After matching all query graphs in the group, the matching device 120 can feed back the final matching result to the control device 110. Internally, the matching device 120 can use a hash table to store the matching results of each query graph. The hash table uses key-value pairs to represent the matching result of each query graph. Here, the key represents the identifier of the query graph, and the value represents the matching result of that query graph.
[0132] The matching device 120 can aggregate the matching nodes of each query graph in the group of query graphs into the hash table and feed the hash table back to the control device 110.
[0133] Step 308: The control device 110 summarizes the matching results fed back by each matching device 120.
[0134] When the control device 110 receives the matching results from each matching device 120, it can combine the matching results of each matching device and feed them back to the user through the client.
[0135] When the control device 110 receives the hash tables from each matching device 120 that represent the matching results of each group of query graphs, it can aggregate the multiple hash tables into one hash table and send the aggregated hash table to the client. After receiving the hash table, the client can display the hash table to the user.
[0136] Based on the same inventive concept as the method embodiments, this application also provides a multi-subgraph matching device, which is used to execute the method performed by the control device 110 and the matching device 120 in the above method embodiments. For example... Figure 9 As shown, the multi-subgraph matching device 900 includes a receiving module 901, a grouping module 902, and a matching module 903. Specifically, in the multi-subgraph matching device 900, the modules are connected through a communication path.
[0137] The receiving module 901 is used to receive multiple query graphs, each of which represents multiple nodes and the connection relationships between the nodes.
[0138] Grouping module 902 is used to group multiple query graphs according to the hash value of each query graph to generate multiple groups of query graphs, wherein multiple query graphs whose hash values are in the same range belong to the same group.
[0139] Matching module 903 is used to match multiple sets of query graphs and data graphs in parallel to obtain matching results.
[0140] As one possible implementation, the query costs of each set of query graphs in the multiple query graphs are within the same range, where the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same set.
[0141] As one possible implementation, the matching module 903 can divide the data graph to generate multiple data subgraphs; and execute multiple matching tasks in parallel, each matching task being used to match one of the multiple data subgraphs with one of the multiple sets of query graphs.
[0142] In one possible implementation, the multiple matching tasks include a first matching task, which is used to match a first data subgraph with a first set of query graphs in the multiple sets of query graphs, wherein the first data subgraph includes nodes of all query graphs in the first set of query graphs.
[0143] As one possible implementation, when performing the first matching task, the matching module 903 can determine the task subgraph of each query graph in the first group of query graphs from the first data subgraph. The task subgraph of the query graph includes all nodes of the query graph. The matching module 903 then matches the task subgraph of each query graph with a common subgraph, where the common subgraph is the common part included by all query graphs in the first group of query graphs. If the task subgraph of any query graph successfully matches the common subgraph, the matching module 903 matches the task subgraph of the query graph with the parts of the query graph excluding the common subgraph, thus obtaining the matching result between the task subgraph and the query graph.
[0144] As one possible implementation, the matching module 903 can also determine that there is no subgraph matching the query graph in the first data subgraph if the task subgraph of the query graph fails to match the public subgraph.
[0145] As one possible implementation, the hash value of each query graph is obtained according to the Local Hash Algorithm (LSH).
[0146] Based on the same inventive concept as the method embodiments, this application also provides a control device for executing the method executed by the control device 110 in the above method embodiments. For example... Figure 10 As shown, the control device 1000 includes a transmission module 1001, a grouping module 1002, and optionally, a partitioning module 1003. Specifically, in the control device 1000, the modules are connected to each other through a communication path.
[0147] The transmission module 1001 is used to receive multiple query graphs, each of which represents multiple nodes and the connection relationships between the nodes.
[0148] Grouping module 1002 is used to group multiple query graphs according to the hash value of each query graph to generate multiple groups of query graphs, wherein multiple query graphs whose hash values are in the same range belong to the same group.
[0149] The transmission module 1001 is also used to send the multiple sets of query graphs to multiple matching devices.
[0150] In one possible implementation, the partitioning module 1003 can partition the data graph to generate multiple data sub-graphs; the transmission module 1001 can send the multiple data sub-graphs to multiple matching devices, wherein one data sub-graph is sent to each matching device.
[0151] As one possible implementation, the query costs of each set of query graphs in the multiple query graphs are within the same range, where the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same set.
[0152] As one possible implementation, the hash value of each query graph is obtained according to the Local Hash Algorithm (LSH).
[0153] Based on the same inventive concept as the method embodiments, this application also provides a matching device, which is used to execute the method performed by the matching device 110 in the above method embodiments. For example... Figure 11 As shown, the matching device 1100 includes a transmission module 1101 and a query graph matching module 1102. Specifically, in the matching device 1100, the modules are connected through a communication path.
[0154] The transmission module 1101 is used to receive the multiple sets of query graphs.
[0155] The query graph matching module 1102 is used to match one set of query graphs with the data graph in parallel to obtain the matching result.
[0156] As one possible implementation, the query costs of each set of query graphs in the multiple query graphs are within the same range, where the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same set.
[0157] In one possible implementation, the transmission module 1101 is also used to receive a data subgraph. When the query graph matching module 1102 performs parallel matching of one set of query graphs with a data graph among multiple sets of query graphs, it can match the received data subgraph with one set of query graphs among the multiple sets of query graphs.
[0158] As one possible implementation, the data subgraph obtained by the query graph matching module 1102 is designated as the first data subgraph, and the set of query graphs to be matched is designated as the first set of query graphs. The first data subgraph includes nodes from all query graphs in the first set of query graphs.
[0159] As one possible implementation, when the query graph matching module 1102 performs parallel matching of the first set of query graphs and the first data subgraphs, it can first determine the task subgraph of each query graph in the first set of query graphs from the first data subgraph. The task subgraph of the query graph includes all nodes of the query graph. Then, the task subgraph of each query graph is matched with a common subgraph, which is the common part included by each query graph in the first set of query graphs. If the task subgraph of any query graph successfully matches with the common subgraph, the task subgraph of the query graph is matched with the part of the query graph excluding the common subgraph to obtain the matching result of the task subgraph and the query graph.
[0160] As one possible implementation, if the query graph matching module 1102 determines that the task subgraph of the query graph and the public subgraph are not successfully matched, it can determine that there is no subgraph in the first data subgraph that matches the query graph.
[0161] The module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0162] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a terminal device (which may be a personal computer, mobile phone, or network device, etc.) or processor to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0163] This application also provides, for example Figure 12 The computing device 1200 shown includes a bus 1201, a processor 1202, a communication interface 1203, and a memory 1204. The processor 1202, the memory 1204, and the communication interface 1203 communicate with each other via the bus 1201.
[0164] The processor 1202 can be a central processing unit (CPU). The memory 1204 can include volatile memory, such as random access memory (RAM). The memory 1204 can also include non-volatile memory, such as read-only memory (ROM), flash memory, HDD, or SSD. The memory stores executable code, and the processor 1202 executes the aforementioned code. Figure 3 The method described. The memory 1204 may also include software modules required for other running processes, such as an operating system (e.g., multiple modules in the multi-subgraph matching device 900, multiple modules in the control device 100, or multiple modules in the matching device 1100). The operating system may be LINUX. TM UNIX TM WINDOWS TM wait. Figure 12 The diagram only shows a few modules in the multi-subgraph matching device 900 as an example.
[0165] This application also provides a computing device system, the computing device system including at least one such as Figure 13 The computing device 1300 shown includes a bus 1301, a processor 1302, a communication interface 1303, and a memory 1304. The processor 1302, the memory 1304, and the communication interface 1303 communicate with each other via the bus 1301. At least one computing device 1300 in the computing device system communicates with each other via a communication path.
[0166] The processor 1302 may be a CPU. The memory 1304 may include volatile memory, such as random access memory (RAM). The memory 1304 may also include non-volatile memory, such as read-only memory (ROM), flash memory, HDD, or SSD. The memory 1304 stores executable code, which the processor 1302 executes to perform the aforementioned actions. Figure 3 The described method may include any part or all of it. The memory may also include other software modules required for running processes, such as the operating system. The operating system may be Linux. TM UNIX TM WINDOWS TM wait.
[0167] At least one computing device 1300 in the computing device system establishes communication with each other through a communication network, and each computing device 1300 can run any one or any number of modules in the multi-subgraph matching device 900.
[0168] At least one computing device 1300 in the computing device system establishes communication with each other through a communication network, and each computing device 1300 can run any one or any number of modules from the control device 1000.
[0169] At least one computing device 1300 in the computing device system establishes communication with each other through a communication network, and each computing device 1300 can run any one or any multiple modules of multiple matching devices 1100. Figure 13 The diagram only shows a few modules in the multi-subgraph matching device 900 as an example.
[0170] The descriptions of the processes corresponding to the above-mentioned figures each have their own emphasis. For parts of a process that are not described in detail, please refer to the relevant descriptions of other processes.
[0171] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, in the form of a computer program product. A computer program product includes computer program instructions, which, when loaded and executed on a computer, generate, in whole or in part, the product according to the embodiments of the present invention. Figure 3 The process or function described.
[0172] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD).
[0173] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A multi-subgraph matching method, characterized in that, The method includes: Receive multiple query graphs, each of which represents multiple nodes and the connection relationships between the nodes; The multiple query graphs are grouped according to the hash value of each query graph to generate multiple groups of query graphs. Among them, multiple query graphs with hash values in the same range belong to the same group, and the query graphs in a group of query graphs have common subgraphs. The multiple sets of query graphs and data graphs are matched in parallel to obtain matching results.
2. The method as described in claim 1, characterized in that, The query costs of each group of query graphs in the multiple query graphs are within the same range, wherein the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same group.
3. The method as described in claim 1 or 2, characterized in that, The step of matching the multiple sets of query graphs with the data graph in parallel to obtain matching results includes: Divide the data graph to generate multiple data subgraphs; Multiple matching tasks are executed in parallel, each matching task being used to match one of the multiple data subgraphs with one of the multiple sets of query graphs.
4. The method as described in claim 3, characterized in that, The plurality of matching tasks includes a first matching task, which is used to match a first data subgraph with a first set of query graphs in the plurality of query graphs, wherein the first data subgraph includes nodes of all query graphs in the first set of query graphs.
5. The method as described in claim 4, characterized in that, The execution of the first matching task includes: From the first data subgraph, a task subgraph is determined for each query graph of the first group of query graphs, and the task subgraph of the query graph includes all nodes of the query graph; For each of the query graphs, the task subgraph is matched with a common subgraph, where the common subgraph is the common part included in each query graph of the first group of query graphs; If any task subgraph of the query graph successfully matches the common subgraph, the task subgraph of the query graph is matched with the part of the query graph excluding the common subgraph to obtain the matching result of the task subgraph of the query graph and the query graph.
6. The method as described in claim 5, characterized in that, The method further includes: If the task subgraph of the query graph fails to match the common subgraph, it is determined that there is no subgraph in the first data subgraph that matches the query graph.
7. The method according to any one of claims 1 to 6, characterized in that, The hash value of each of the query graphs is obtained according to the Local Hash algorithm (LSH).
8. A multi-subgraph matching device, characterized in that, The device includes: A receiving module is used to receive multiple query graphs, each of which represents multiple nodes and the connection relationships between the nodes. The grouping module is used to group the multiple query graphs according to the hash value of each query graph to generate multiple groups of query graphs. Among them, multiple query graphs with hash values in the same range belong to the same group, and the query graphs in a group of query graphs have common subgraphs. The matching module is used to match the multiple sets of query graphs and data graphs in parallel to obtain matching results.
9. The apparatus as claimed in claim 8, characterized in that, The query costs of each group of query graphs in the multiple query graphs are within the same range, wherein the query cost is used to indicate the amount of work consumed when matching multiple query graphs belonging to the same group.
10. The apparatus as claimed in claim 8 or 9, characterized in that, The matching module is specifically used for: Divide the data graph to generate multiple data subgraphs; Multiple matching tasks are executed in parallel, each matching task being used to match one of the multiple data subgraphs with one of the multiple sets of query graphs.
11. The apparatus as claimed in claim 10, characterized in that, The plurality of matching tasks includes a first matching task, which is used to match a first data subgraph with a first set of query graphs in the plurality of query graphs, wherein the first data subgraph includes nodes of all query graphs in the first set of query graphs.
12. The apparatus as claimed in claim 11, characterized in that, The matching module performs the first matching task, specifically including: From the first data subgraph, a task subgraph is determined for each query graph of the first group of query graphs, and the task subgraph of the query graph includes all nodes of the query graph; For each of the query graphs, the task subgraph is matched with a common subgraph, where the common subgraph is the common part included in each query graph of the first group of query graphs; If any task subgraph of the query graph successfully matches the common subgraph, the task subgraph of the query graph is matched with the part of the query graph excluding the common subgraph to obtain the matching result of the task subgraph of the query graph and the query graph.
13. The apparatus as claimed in claim 12, characterized in that, The matching module is also used for: If the task subgraph of the query graph fails to match the common subgraph, it is determined that there is no subgraph in the first data subgraph that matches the query graph.
14. The apparatus as described in any one of claims 8 to 13, characterized in that, The hash value of each of the query graphs is obtained according to the Local Hash algorithm (LSH).
15. A computing device, characterized in that, The computing device includes a processor and memory; The memory is used to store computer program instructions; The processor executes computer program instructions in the memory to perform the method as described in any one of claims 1 to 7.
16. A non-transient computer-readable storage medium, characterized in that, When the non-transient computer-readable storage medium is executed by a computing device, the computing device performs the method of any one of claims 1 to 7.
17. A computing device program product, characterized in that, The computing device program product includes computer instructions that, when executed by the computing device, enable the computing device to perform the method as described in any one of claims 1 to 7.