Sub-graph matching method and device

By determining the node matching order based on the graph structure in the subgraph matching algorithm and calculating the selection degree, the inefficiency problem caused by randomness in the prior art is solved, and a more efficient subgraph matching is achieved.

CN119719180APending Publication Date: 2025-03-28HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311292325.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the existing subgraph matching algorithm, when computing devices determine the search order of nodes in the query graph, randomness leads to uncertainty in the search space, which in turn reduces the matching efficiency of subgraph matching.

Method used

By determining the matching order of the query graph search nodes based on the graph structure of the query graph and the data graph, the selection degree of each node in the query graph is calculated, and the starting node and subsequent matching nodes are determined based on the selection degree, thereby optimizing the subgraph matching process.

Benefits of technology

It improves the matching efficiency of sub-graph matching, reduces unnecessary search space, enhances the identification and utilization of equivalence constraint relationships, and improves the accuracy and efficiency of matching results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719180A_ABST
    Figure CN119719180A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a sub-graph matching method which is used for improving the sub-graph matching efficiency. The method comprises the steps of obtaining a query graph and a data graph, wherein the query graph is used for performing sub-graph matching in the data graph; the node matching sequence of the query graph is determined based on the graph structure of the query graph and the graph structure of the data graph, the node matching sequence is used for indicating the sequence of nodes for sub-graph matching in the query graph, the graph structure of the data graph is used for calculating the selection degree of the nodes in the query graph, and the selection degree is used for determining an initial node of the node matching sequence. Sub-graph matching is carried out in the data graph based on the node matching sequence, a matching result is generated, and the matching result comprises one or more sub-graphs with the same graph structure as the query graph in the data graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and in particular to a sub-graph matching method and device. Background Art

[0002] Subgraph matching is an important research topic in the field of graph analysis. Subgraph matching refers to matching a given query graph on a large data graph, thereby matching all subgraphs with the same structure as the query graph. Subgraph matching can be applied to social network analysis, bioinformatics, transportation, group discovery, anomaly detection and other fields.

[0003] In the current subgraph matching algorithm, when the computing device performs subgraph matching on the query graph, the computing device needs to search the nodes in the query graph. When determining the search order of the nodes in the query graph, the computing device often randomly determines a node as the starting node of the query graph search. Since the random determination of the starting node of the query graph search will lead to uncertainty in the search space, the matching efficiency of the subgraph matching is relatively low. Summary of the invention

[0004] The embodiment of the present application provides a subgraph matching method, in which a computing device can determine the node matching order of a query graph search based on the graph structure of a query graph and a data graph when performing subgraph matching, thereby improving the matching efficiency of subgraph matching. The embodiment of the present application also provides a subgraph matching device, a computing device, a computing device cluster, a computer-readable storage medium, and a computer program product corresponding to the subgraph matching method.

[0005] In the first aspect, an embodiment of the present application provides a message processing method based on tunnel technology, which can be executed by a subgraph matching system, or by a component of the subgraph matching system, such as a processor, chip or chip system of the subgraph matching system, or by a logic module or software that can implement all or part of the functions of the subgraph matching system. The method provided in the first aspect includes: the subgraph matching system obtains a query graph and a data graph, and the query graph is used to perform subgraph matching in the data graph. The node matching order of the query graph is determined based on the graph structure of the query graph and the graph structure of the data graph. The node matching order is used to indicate the node order for subgraph matching in the query graph. The graph structure of the data graph is used to calculate the selectivity of the nodes in the query graph, and the selectivity is used to determine the starting node of the node matching order. Subgraph matching is performed in the data graph based on the node matching order, and a matching result is generated. The matching result includes one or more subgraphs in the data graph that have the same graph structure as the query graph.

[0006] In the embodiment of the present application, the subgraph matching system can calculate the selectivity of each node in the query graph based on the graph structure of the query graph and the graph structure of the data graph, and determine the starting matching node of the query graph and the node matching order based on the selectivity. Compared with the current method in which the computing device randomly determines the starting matching node during the subgraph matching process, the subgraph matching method provided in the embodiment of the present application improves the subgraph matching efficiency of the query graph.

[0007] In a possible implementation, the query graph includes one or more of the following: an undirected graph, a directed graph, an attribute graph, and an attributeless graph. Among them, an undirected graph refers to a graph in which the edges in the graph have no direction. A directed graph refers to a graph in which the edges in the graph have directions, and the edges of a directed graph also indicate the direction of connecting one node to another node. An attribute graph refers to a query graph that contains attribute information of nodes and edges in addition to nodes and edges. An attributeless graph refers to a graph structure that does not have attribute information of nodes or edges.

[0008] The subgraph matching method provided in the embodiments of the present application can be applied to subgraph matching of query graphs of various graph structures, thereby improving the scope of application of the subgraph matching method of the present application.

[0009] In one possible implementation, a user may input a query graph through the display interface of the subgraph matching system 10, or may provide description information of the query graph to the subgraph matching system 10 by uploading a file. The description information of the query graph includes node attributes of the query graph and relationships between edges.

[0010] In the embodiment of the present application, the subgraph matching system can obtain the query graph for subgraph matching in a variety of ways, thereby improving the feasibility of the subgraph matching solution.

[0011] In a possible implementation, in the process of determining the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph, the subgraph matching system calculates the selectivity of each node in the query graph, the selectivity being the number of nodes in the data graph that contain the connection relationship of the node, and the subgraph matching system determines the matching start node according to the selectivity of the node in the query graph, the matching start node being the node with the smallest selectivity in the query graph. The subgraph matching system further determines the matching node after the matching start node according to the number of connection edges of the remaining nodes in the query graph, the matching node being the node with the largest number of connection edges among the remaining nodes in the query graph.

[0012] In the embodiment of the present application, the subgraph matching system can calculate the number of connection relationships of each node in the query graph that appear in the data graph, obtain the selectivity of each node, and use the node with the smallest selectivity as the starting matching node in the node matching order, thereby improving the matching efficiency of the subgraph matching.

[0013] In one possible implementation, when the number of connected edges of the remaining nodes in the query graph is the same, the matching node after the matching start node is determined according to the selectivity of the remaining nodes. Specifically, the subgraph matching system uses the node with the smallest selectivity among the remaining nodes as the matching node after the matching start node.

[0014] In the embodiment of the present application, when the number of connection edges of the remaining nodes in the query graph is the same, the subgraph matching system can determine the matching nodes after the matching start node according to the selectivity of the remaining nodes, thereby improving the matching efficiency of the subgraph matching.

[0015] In one possible implementation, the subgraph matching system identifies equivalent points based on the query graph. Specifically, after the subgraph matching system exchanges the mappings of two nodes, if the graph structure of the query graph does not change, the two nodes are equivalent nodes. If the nodes are unidirectionally connected, the equivalent points form an equivalent ring.

[0016] In the embodiment of the present application, the subgraph matching system can identify equivalent nodes in the query graph, so as to constrain the equivalent nodes, thereby improving the feasibility of determining equivalent constraint relationships.

[0017] In one possible implementation, before the subgraph matching system determines the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph, the subgraph matching system determines an equivalence constraint relationship based on the query graph, and the equivalence constraint relationship is used to determine the matching range for subgraph matching in the data graph, and the subgraphs within the matching range satisfy the equivalence constraint relationship. The subgraph matching system performs subgraph matching in the data graph based on the node matching order, including performing subgraph matching in the matching range in the data graph based on the node matching order.

[0018] In the embodiment of the present application, the subgraph matching system can prune the search range of the data graph by setting an equivalent constraint relationship, avoid matching equivalent subgraphs, and thus improve the matching efficiency of subgraph matching.

[0019] In one possible implementation, in the process of determining the equivalent constraint relationship based on the query graph in the subgraph matching system, the subgraph matching system determines the equivalent constraint relationship based on the node identifiers of the query graph, and the equivalent constraint relationship includes an ascending arrangement of the node identifiers or a descending arrangement of the node identifiers of the nodes in the query graph.

[0020] In the embodiment of the present application, the subgraph matching system can set an equivalent constraint relationship based on the node identifiers in the query graph, so that the subgraph satisfies the constraints of the node identifiers during the subgraph matching process, thereby reducing the matching scope of the subgraph matching and improving the matching efficiency of the subgraph matching.

[0021] In one possible implementation, in the process of performing subgraph matching in the data graph based on the node matching order, the subgraph matching system searches the data graph for nodes in the query graph in the node matching order based on a parallel search strategy, and the parallel search strategy includes breadth-first search and depth-first search. Among them, the breadth-first search starts from the starting node and expands outward layer by layer, first visiting all adjacent nodes of the starting node, and then visiting their adjacent nodes. The depth-first search starts from a starting node and traverses along the edge of the graph until it reaches a node that can no longer move forward, and then backtracks to the nearest unvisited node and continues to explore.

[0022] In the embodiment of the present application, the subgraph matching system can search for nodes in the query graph based on a parallel search strategy, thereby improving the subgraph matching efficiency of the query graph.

[0023] In one possible implementation, the subgraph matching system determines the number of steps of the depth-first search based on the estimated memory consumption, and the estimated memory consumption is used to indicate the memory occupied by the search results of the breadth-first search in parallel with the steps of the depth-first search. Since each thread performs a complete search task in the depth-first search, the depth-first search can save memory. In the breadth-first search, after each node is matched, all the current intermediate matching results are collected and redistributed, which can improve the degree of parallelism, but it takes up more memory. The subgraph matching system predicts the memory occupied by the search results of the breadth-first search in parallel with the steps of the depth-first search, and determines the number of steps of the depth-first search corresponding to the predicted memory less than a threshold. When the subgraph matching system performs subgraph matching according to the number of steps of the depth-first search, the memory consumption of the breadth-first search will not exceed the memory threshold.

[0024] In the embodiment of the present application, the subgraph matching system can determine the number of search steps of the depth-first search based on the estimated memory consumption of the search results of the breadth-first search, thereby reducing the number of search results of the breadth-first search and reducing the memory consumption of the subgraph matching process.

[0025] The second aspect of the embodiment of the present application provides a subgraph matching device, which includes an acquisition unit, a sorting unit and a matching unit. Among them, the acquisition unit is used to acquire a query graph and a data graph, and the query graph is used to perform subgraph matching in the data graph. The sorting unit is used to determine the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph. The node matching order is used to indicate the node order for subgraph matching in the query graph. The graph structure of the data graph is used to calculate the selectivity of the nodes in the query graph, and the selectivity is used to determine the starting node of the node matching order. The matching unit is used to perform subgraph matching in the data graph based on the node matching order and generate a matching result. The matching result includes one or more subgraphs in the data graph that have the same graph structure as the query graph.

[0026] In a possible implementation, the query graph includes one or more of the following: an undirected graph, a directed graph, an attribute graph, and an attributeless graph.

[0027] In one possible implementation, the sorting unit is specifically used to calculate the selectivity of each node in the query graph, where the selectivity is the number of nodes in the data graph that contain the connection relationship of the node. The matching start node is determined based on the selectivity, and the matching start node is the node with the smallest selectivity in the query graph. The matching node after the matching start node is determined based on the number of connected edges of the remaining nodes in the query graph, and the matching node is the node with the largest number of connected edges among the remaining nodes in the query graph.

[0028] In a possible implementation, the sorting unit is further configured to determine a matching node after the matching start node according to the selectivity of the remaining nodes when the numbers of connection edges of the remaining nodes in the query graph are the same.

[0029] In a possible implementation, the device further includes a constraint unit, the constraint unit is used to determine an equivalent constraint relationship based on the query graph, the equivalent constraint relationship is used to determine a matching range for subgraph matching in the data graph, and the subgraph within the matching range satisfies the equivalent constraint relationship. The matching unit is specifically used to perform subgraph matching within the matching range in the data graph based on the node matching order.

[0030] In a possible implementation, the constraint unit is specifically used to determine an equivalent constraint relationship according to the node identifiers of the query graph, and the equivalent constraint relationship includes an ascending arrangement of the node identifiers or a descending arrangement of the node identifiers of the nodes in the query graph.

[0031] In a possible implementation, the matching unit is specifically used to search the data graph for nodes in the query graph in a node matching order based on a parallel search strategy, and the parallel search strategy includes a breadth-first search and a depth-first search.

[0032] In a possible implementation, the matching unit is further configured to determine the number of depth-first search steps according to an estimated memory consumption, where the estimated memory consumption is used to indicate the memory occupied by search results of a breadth-first search performed in parallel with the depth-first search steps.

[0033] A third aspect of an embodiment of the present application provides a computing device, comprising a processor coupled to a memory, the processor being used to store instructions, and when the instructions are executed by the processor, the computing device executes the method described in the first aspect or any possible implementation manner of the first aspect.

[0034] A fourth aspect of an embodiment of the present application provides a computing device cluster, the computing device cluster includes one or more computing devices, the computing device includes a processor, the processor is coupled to a memory, the processor is used to store instructions, when the instructions are executed by the processor, the computing device cluster executes the method described in the first aspect or any possible implementation method of the first aspect.

[0035] A fifth aspect of an embodiment of the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed, the computer executes the method described in the first aspect or any possible implementation manner of the first aspect.

[0036] A sixth aspect of an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed, the computer implements the method described in the first aspect or any possible implementation method of the first aspect.

[0037] It can be understood that the beneficial effects that can be achieved by any of the sub-graph matching devices, computing devices, computing device clusters, computer-readable media or computer program products provided above can refer to the beneficial effects in the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of the system architecture of a sub-graph matching system provided in an embodiment of the present application;

[0039] Figure 2 A schematic diagram of a flow chart of a sub-graph matching method provided in an embodiment of the present application;

[0040] Figure 3a A schematic diagram of a flow chart of another sub-graph matching method provided in an embodiment of the present application;

[0041] Figure 3b A schematic diagram of a type of query graph provided in an embodiment of the present application;

[0042] Figure 4 A schematic diagram of determining a node matching order provided in an embodiment of the present application;

[0043] Figure 5 A schematic diagram of an equivalent constraint relationship provided in an embodiment of the present application;

[0044] Figure 6 A schematic diagram of a parallel search strategy provided in an embodiment of the present application;

[0045] Figure 7 A schematic diagram of the structure of a sub-graph matching device provided in an embodiment of the present application;

[0046] Figure 8A schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0047] Fig. 9 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The embodiments of the present application provide a sub-graph matching method and device for improving the matching efficiency of sub-graph matching.

[0049] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0050] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0051] First, some terms involved in the embodiments of the present application are introduced to facilitate technical personnel in this field to understand the technical solution.

[0052] Subgraph matching is to find a subgraph in a given large graph that is isomorphic to a given small graph. Subgraph matching is a basic graph query operation, and its purpose is to discover important substructures in the graph.

[0053] Graph isomorphism means that given two graphs G1 = (V1, E1) and G2 = (V2, E2), if there exists a bijective function f:V(G1)→V(G2), such that Graphs G1 and G2 are called isomorphic if and only if e2=(f(vi),f(vj))∈E2 and the multiplicity of e1 and e2 is the same.

[0054] An equivalent point refers to two nodes vi,vj∈G=(V,E) in a given graph. If there exists a bijective function f:V(G)→V(G),f(vi)=vj,f(vj)=vi,f(vk)=vk,k≠i,j, such that f(G) is isomorphic to G, then vi and vj are called equivalent points in the graph G.

[0055] Selectivity is the degree of selection in the specified query graph P = (V1, E1) and data graph G = (V2, E2). After matching according to the in-and-out degree conditions vj.indeg ≥ vi.indeg AND vj.outdeg ≥ vi.outdeg, vj∈G, the size of the mapped point set in the data graph G is called the selectivity of the point in the query graph P under the real graph G. The selectivity can reflect the size of the possible candidate set of the node in the query graph in the data graph.

[0056] In order to make the technical solution of the present application clearer and easier to understand, the system architecture of the present application is introduced below with reference to the accompanying drawings.

[0057] See also Figure 1 , Figure 1 A schematic diagram of a subgraph matching system architecture provided for this application example. Figure 1 In the example shown, the subgraph matching system 10 includes a software layer 100 and a hardware layer 200, wherein the software layer 100 includes a graph data reading module 101, an equivalent point constraint module 102, a mining plan generation module 103 and a dynamic search matching module 104, and the hardware layer 200 includes one or more computing devices 201, and multiple computing devices 201 can constitute a subgraph matching system of a distributed architecture. The functions of each part of the subgraph matching system 10 are described in detail below.

[0058] The software layer 10 is used to implement the software functions of the subgraph matching system, including the storage and management of graph data and the matching algorithm for subgraph matching. The software layer 10 includes a graph data reading module 101, an equivalent point constraint module 102, a mining plan generation module 103 and a dynamic search matching module 104.

[0059] The graph data reading module 101 is used to read the data graph and the query graph. For example, the graph data reading module 101 can export the data graph from the database, or generate the data graph based on comma separated values ​​(CSV) data. The query graph is the subgraph that the subgraph matching system 10 is going to perform subgraph matching on, and the data graph is the original graph that is to be searched for the query graph.

[0060] The equivalent point constraint module 102 is used to generate an equivalent constraint relationship corresponding to the query graph, and the equivalent point constraint is used to prune the data graph. Among them, the equivalent point refers to the node in the query graph that is exchanged with each other without changing the graph structure. By constraining the equivalent points in the query graph, the equivalent point constraint module 102 can avoid matching equivalent graphs of multiple query graphs during the subgraph matching process.

[0061] The mining plan generation module 103 is used to determine the node matching order of the subgraph matching. Specifically, the mining plan generation module 103 is used to calculate the selectivity of each node in the query graph in the data graph, and determine the starting node of the subgraph matching based on the selectivity. After the mining plan generation module 103 determines the starting node of the subgraph matching, the matching node after the starting node is determined based on the number of connecting edges of the remaining nodes, thereby determining the node matching order of the subgraph matching.

[0062] The dynamic search and matching module 104 is used to search the data graph for nodes in the query graph according to the node matching order based on the parallel search strategy to obtain the subgraph corresponding to the query graph. Among them, the parallel search strategy includes depth-first search and breadth-first search. The dynamic search and matching module 104 is also used to determine the number of steps of the depth-first search based on the estimated memory consumption, and the estimated memory consumption is the memory occupied by the search results of the breadth-first search in parallel with the steps of the depth-first search.

[0063] The hardware layer 20 is used to provide hardware devices of the subgraph matching system, and each module in the software layer 10 is deployed in the hardware devices in the hardware layer 20. The hardware devices in the hardware layer 20 include one or more computing devices 201, and multiple computing devices 201 can constitute a distributed subgraph matching system architecture.

[0064] It can be understood that the computing device 201 in the embodiment of the present application can be a cloud server, a local server or a personal computer, without specific limitation.

[0065] based on Figure 1 The sub-graph matching system 10 shown in the figure, the present application also provides a sub-graph matching method. The sub-graph matching method provided in the embodiment of the present application is introduced below in conjunction with the embodiment.

[0066] See also Figure 2 , Figure 2 A flowchart of a method for converting a network address provided in an embodiment of the present application. Figure 2 In the example shown, the method includes the following steps:

[0067] 201. The subgraph matching system obtains a query graph and a data graph, and the query graph is used to perform subgraph matching in the data graph.

[0068] The subgraph matching system 10 obtains a query graph and a data graph, and the query graph is used to perform subgraph matching in the data graph. Specifically, the subgraph matching system 10 receives a query graph provided by a user. For example, the user can input the query graph through the display interface of the subgraph matching system 10, or provide the description information of the query graph to the subgraph matching system 10 by uploading a file. The description information of the query graph includes the node attributes of the query graph and the relationship between the edges.

[0069] The query graph in the embodiment of the present application includes one or more of the following graph structures: an undirected graph, a directed graph, an attributed graph, and an attributeless graph. Among them, an undirected graph refers to a graph in which the edges in the graph have no direction. In an undirected graph, an edge can go from one node to another without considering any directionality. An undirected graph can be represented as a set consisting of nodes and edges, where the edges are used to represent the connection relationship between nodes, but no direction is specified.

[0070] A directed graph is a graph in which the edges are directed. The edges of a directed graph also indicate the direction of the connection from one node to another. In a directed graph, the path from one node to another can only be taken in the direction of the edge. A directed graph can also be represented as a set of nodes and edges, but the edges represent the directed relationship between nodes.

[0071] An attribute graph refers to a query graph that contains not only nodes and edges, but also attribute information of nodes and edges. Node attributes are attributes or features associated with each node in the graph, while edge attributes are attributes or features associated with each edge in the graph. Attribute graphs can be used to indicate more attribute information of nodes and edges. Non-attribute graphs refer to graph structures that do not have attribute information of nodes or edges. Non-attribute graphs only contain the connection relationship between nodes and edges, but not the attribute information of nodes and edges. That is, non-attribute graphs only represent the topological structure between nodes and edges.

[0072] It should be noted that there is no correlation between the attributes and directions of the query graph, that is, the attribute graph can be either an undirected graph or a directed graph, and the non-attribute graph can be either a directed graph or an undirected graph.

[0073] See also Figure 3a , Figure 3a A schematic diagram of another sub-graph matching method provided in an embodiment of the present application. Figure 3a In step a of the illustrated example, the subgraph matching system 10 receives a query graph input by a user, and the query graph may be an undirected graph, a directed graph, a non-attributed graph, or an attributed graph, without specific limitation.

[0074] See also Figure 3b , Figure 3b A diagram of the structure of a query graph provided in an embodiment of the present application. Figure 3bIn the example shown, Figure (a) is an example of an undirected graph, in which there is no connection direction between nodes A, node B and node C, and Figure (b) is an example of a directed graph, in which there is a connection direction in the connection relationship between nodes A, node B and node C, for example, node A points to node B and node C respectively.

[0075] exist Figure 3b In the example shown, Figure (c) is an example of an attribute graph, in which nodes A, B and C have different attributes, and the different shapes of nodes A, B and C in the figure represent different node attributes. Figure (d) is an example of a non-attribute graph, in which nodes A, B and C do not carry attribute information.

[0076] The subgraph matching system 10 can obtain the data graph through the graph data storage system. The data graph is usually stored in a graph database or other forms of graph data storage system. The graph data storage system contains a large amount of graph structure data. The subgraph matching system 10 can initiate a query request to the database through the application program interface API to obtain the data graph required for subgraph matching.

[0077] 202. The subgraph matching system determines the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph. The node matching order is used to indicate the order of nodes in the query graph for subgraph matching. The graph structure of the data graph is used to calculate the selectivity of the nodes in the query graph, and the selectivity is used to determine the starting node of the node matching order.

[0078] After the subgraph matching system 10 obtains the query graph and the data graph, the subgraph matching system 10 determines the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph. The node matching order is used to indicate the order of nodes for subgraph matching in the query graph, and the graph structure of the data graph is used to calculate the selectivity of the nodes in the query graph.

[0079] Specifically, the subgraph matching system 10 calculates the selectivity of each node in the query graph, and the selectivity of a node refers to the number of nodes in the data graph that contain the connection relationship of the node. The subgraph matching system 10 determines the matching start node based on the selectivity, and the matching start node is the node with the smallest selectivity in the query graph. The subgraph matching system 10 determines the matching node after the matching start node based on the number of connection edges of the remaining nodes in the query graph, and the matching node is the node with the largest number of connection edges among the remaining nodes in the query graph.

[0080] See also Figure 4 , Figure 4 A schematic diagram of calculating the selectivity of a query graph provided in an embodiment of the present application. Figure 4In the example shown, the subgraph matching system calculates the selectivity of each node in the query graph, and determines the matching start node based on the selectivity of the node. For example, the subgraph matching system calculates the selectivity of nodes A, B, C, and D in the query graph, respectively, where the connection relationship of node A in the query graph is "1 incoming edge and 2 outgoing edges", and the only node that contains the connection relationship of node A in the data graph is node 1, so the selectivity of node A in the data graph is 1. The connection relationship of node B in the query graph is "1 incoming edge and 1 outgoing edge", and the connection relationship of node B in the data graph includes nodes 1, 2, 3, and 4, so the selectivity of node B in the data graph is 4.

[0081] Similarly, in Figure 4 In the example shown, the data graph contains nodes 1, 2, 3, and 4 that have a connection relationship with node C, and the data graph contains node 4 that has a connection relationship with node D. Therefore, the subgraph matching system 10 calculates that the selectivity of node C in the query graph in the data graph is 4, and the selectivity of node D in the data graph is 1.

[0082] exist Figure 4 In the example shown, after the subgraph matching system 10 calculates the selectivity of nodes A, B, C, and D in the query graph, it determines the matching start node based on the selectivity. Specifically, the subgraph matching system 10 uses the node with the smallest selectivity as the matching start node. For example, the subgraph matching system selects node A or node D with a selectivity of 1 as the matching start node.

[0083] exist Figure 4 In the example shown, after the subgraph matching system 10 determines that the starting matching node is node A, it determines the matching nodes after node A based on the number of connection edges of the remaining nodes in the query graph. The remaining nodes in the data graph are node B, node C, and node D, where the number of connection edges of node B is 2, the number of connection edges of node C is 2, and the number of connection edges of node D is 3. The node with the largest number of connection edges among the remaining nodes is node D. Therefore, node D is the next matching node after node A.

[0084] In a possible implementation, after the subgraph matching system 10 determines the matching start node, when the number of connection edges of the remaining nodes in the query graph is the same, the subgraph matching system 10 determines the matching node after the matching start node according to the selectivity of the remaining nodes. Specifically, when the number of connection edges of the remaining nodes in the query graph is the same, the subgraph matching system 10 determines the node with the smallest selectivity among the remaining nodes as the next matching node.

[0085] Please continue reading Figure 4 ,exist Figure 4In the example shown, after the subgraph matching system determines that node D is the next matching node after node A, since the number of connecting edges of node B and node C in the remaining nodes is both 2, the subgraph matching system 10 determines the node after node D based on the selectivity of the remaining nodes. Since the selectivity of node B and node C in the remaining nodes is both 4, the subgraph matching system 10 can randomly select node B as the matching node after node D. Node C is the matching node after node B.

[0086] exist Figure 4 In the example shown, the node matching order generated by the subgraph matching system 10 is node A, node D, node B, and node C. The subgraph matching system 10 performs subgraph matching of the query graph according to the node matching order.

[0087] In one possible implementation, before determining the node matching order of the query graph, the subgraph matching system 10 determines the equivalence constraint relationship of the query graph based on the query graph. The equivalence constraint relationship is used to limit the matching range for subgraph matching in the data graph, and the subgraphs within the matching range satisfy the equivalence constraint relationship. The subgraph matching system 10 performs subgraph matching within the matching range in the data graph based on the node matching order. Specifically, the subgraph matching system 10 identifies equivalent points in the query graph. After the subgraph matching system exchanges the mapping of two nodes, if the graph structure of the query graph has not changed, the two nodes are equivalent nodes. The subgraph matching system sets constraint rules for the equivalent points in the query graph to obtain an equivalence constraint relationship.

[0088] In a possible implementation, when determining the equivalence constraint relationship of the query graph, the subgraph matching system 10 determines the equivalence constraint relationship according to the node identifiers of the query graph, and the equivalence constraint relationship includes an ascending arrangement of the node identifiers or a descending arrangement of the node identifiers of the nodes in the query graph.

[0089] Please continue reading Figure 3a ,exist Figure 3a In steps b to c of the example shown, the subgraph matching system 10 identifies equivalent points on the query graph and determines the equivalent constraint relationship of the query graph based on the equivalent points. The subgraph matching system 10 further calculates the selectivity of all nodes in the query and uses the node with the smallest selectivity as the starting matching node. The subgraph matching system 10 determines the matching nodes after the starting matching node based on the node association of the starting matching node in the query graph, thereby generating a mining plan for the query graph.

[0090] See also Figure 5 , Figure 5 A schematic diagram of determining an equivalent constraint relationship of a query graph provided in an embodiment of the present application. Figure 5In the example shown in Figure (a), the data graph G is a graph without attributes. For the query graph P1, the equivalent nodes in the query graph P1 are node A, node B, and node C. The subgraph matching system 10 sets an equivalent constraint relationship based on the node number. For example, the equivalent constraint relationship set is that the numbers of nodes A and B are arranged in descending order, and the numbers of nodes A and C are arranged in descending order. Under this equivalent constraint relationship, the number of subgraphs in the data graph G that match the query graph P1 is 1. If this equivalent constraint relationship does not exist, the number of subgraphs in the data graph G that match the query graph P1 is 3.

[0091] exist Figure 5 In Figure (a) of the example shown, for the query graph P2, the equivalent nodes in the query graph P2 are node B and node C. The subgraph matching system 10 sets an equivalence constraint based on the node number. The equivalence constraint relationship is, for example, that the numbers of node B and node C are arranged in descending order. Under this equivalence constraint relationship, the number of subgraphs in the data graph G that match the query graph P2 is 3.

[0092] For another example, for query graph P3, nodes A, B and C in query graph P3 form an equivalence ring. The subgraph matching system 10 sets equivalence constraints based on the node numbers. For example, the equivalence constraint relationship is that the numbers of nodes A and B are arranged in descending order, and the numbers of nodes A and C are arranged in descending order. Under this equivalence constraint relationship, the number of subgraphs in the data graph G that match the query graph P3 is 2.

[0093] For another example, for the query graph P4, there is no equivalent node in the query graph P4, and the subgraph matching system 10 does not set an equivalent constraint relationship. Therefore, the number of subgraphs in the data graph G that match the query graph P4 is 6.

[0094] Please continue reading Figure 5 ,exist Figure 5 In the example shown in Figure (b), the data graph G is an attribute graph. For the query graph P1, since nodes A and B are nodes with different attributes, the equivalent nodes in the query graph P1 are nodes B and C. The subgraph matching system 10 sets an equivalent constraint relationship based on the node numbers. For example, the equivalent constraint relationship is set such that the numbers of nodes B and C are arranged in descending order. Under this equivalent constraint relationship, the number of subgraphs in the data graph G that match the query graph P1 is 1.

[0095] exist Figure 5 In Figure (b) of the example shown, for the query graph P2, the equivalent nodes in the query graph P2 are node B and node C. The subgraph matching system 10 sets an equivalence constraint based on the node number. The equivalence constraint relationship is, for example, that the numbers of node B and node C are arranged in descending order. Under this equivalence constraint relationship, the number of subgraphs in the data graph G that match the query graph P2 is 1.

[0096] For another example, for query graph P3, there is no equivalent node in query graph P3, and the subgraph matching system 10 does not set an equivalent constraint relationship. Therefore, the number of subgraphs matching query graph P3 in data graph G is 2. For query graph P4, there is no equivalent node in query graph P4, and the subgraph matching system 10 does not set an equivalent constraint relationship. Therefore, the number of subgraphs matching query graph P4 in data graph G is 2.

[0097] 203. The subgraph matching system performs subgraph matching in the data graph based on the node matching order and generates matching results. The matching results include one or more subgraphs in the data graph with the same graph structure as the query graph.

[0098] After determining the node matching order of the query graph, the subgraph matching system 10 performs subgraph matching in the data graph based on the node matching order to generate a matching result, which includes one or more subgraphs in the data graph having the same graph structure as the query graph.

[0099] Please continue reading Figure 3a ,exist Figure 3a In step d to step e of the example shown, the subgraph matching system 10 performs a dynamic depth-first search based on the node matching order in the mining plan. During the dynamic depth-first search, the subgraph matching system 10 determines the minimum number of steps of the depth-first search based on the predicted memory consumption of the breadth-first search. After the subgraph matching is completed, the subgraph matching system 10 outputs the matching results of the subgraph matching, which include one or more subgraphs in the data graph that have the same graph structure as the query graph.

[0100] In a possible implementation, the subgraph matching system 10 searches the data graph for nodes in the query graph in a node matching order based on a parallel search strategy, wherein the parallel search strategy includes breadth first search (BFS) and depth first search (DFS).

[0101] Among them, breadth-first search is an iterative graph search algorithm. Breadth-first search starts from the starting node and expands outward layer by layer, first visiting all adjacent nodes of the starting node, then visiting their adjacent nodes, and so on. Breadth-first search uses a queue to save the nodes to be visited, and ensures the first-in-first-out order. Depth-first search is a recursive graph search algorithm. Depth-first search starts from a starting node and traverses along the edges of the graph until it reaches a node that can no longer move forward, then backtracks to the nearest unvisited node and continues to explore. Depth-first search explores a branch as deeply as possible until it can no longer go deeper. This makes it suitable for in-depth traversal of the graph to find all possible paths and nodes. When depth-first search executes only one step at a time, it is equivalent to breadth-first search.

[0102] See also Figure 6 , Figure 6 A schematic diagram of a parallel search strategy provided in an embodiment of the present application. Figure 6 In the example shown, the subgraph matching system 10 searches the data graph for the nodes in the query graph in a node matching order based on a parallel search strategy. The node matching order of the query graph is node A, node B, and node C. The subgraph matching system 10 searches for node A, node B, and node C based on a depth-first search algorithm and a breadth-first search algorithm at the same time. The equivalence constraint relationship between node A, node B, and node C is that the number of node A is greater than the number of node B, and the number of node A is greater than the number of node C.

[0103] exist Figure 6 In the example shown, the subgraph matching system 10 performs both a breadth-first search and a depth-first search on the data graph based on the query graph. In the breadth-first search, the subgraph matching system 10 searches for node 1, node 2, and node 3 based on the node matching order. For example, during the search for node 1, node 1 pointing to node 2 does not satisfy the equivalence constraint relationship, and node 1 pointing to node 3 also does not satisfy the equivalence constraint relationship. When the subgraph matching system 10 has searched all adjacent nodes of node 1, the breadth-first search is stopped.

[0104] In the depth-first search, the subgraph matching system 10 searches for node 1, node 2, and node 3 based on the node matching order. For example, during the search for node 3, node 3 points to node 1 to satisfy the equivalence constraint relationship. The subgraph matching system 10 further performs a depth search on node 1, and node 1 points to node 2 to also satisfy the equivalence constraint relationship. Node 2 cannot be found anymore.

[0105] It is understandable that in the subgraph matching process of a large-scale data graph, the subgraph matching system 10 usually adopts multi-threaded parallel query. Figure 6 In the example shown, Node 1, Node 2, and Node 3 may be searched in parallel based on different threads.

[0106] In one possible implementation, the subgraph matching system 10 determines the number of steps of the depth-first search based on the estimated memory consumption, and the estimated memory consumption is used to indicate the memory occupied by the search results of the breadth-first search in parallel with the steps of the depth-first search. Since the subgraph matching system 10 performs a parallel search, in the depth-first search, each thread performs a complete search task, so the depth-first search can save memory. In the breadth-first search, after each node is matched, all the current intermediate matching results are collected and redistributed, which can improve the degree of parallelism, but it takes up a lot of memory, so the subgraph matching system 10 also needs to control the memory consumption during the search process.

[0107] In the depth-first search and breadth-first search parallel search strategies of the embodiment of the present application, since the subgraph matching system needs the memory consumption of the intermediate results of the breadth-first search, and the memory consumption of the intermediate results of the breadth-first search corresponding to different depth-first search steps is different, the subgraph matching system 10 can determine the minimum number of search steps of the depth-first search by predicting the memory occupied by the search results of the breadth-first search in parallel with the depth-first search steps. The number of search steps of the depth-first search is the minimum number of steps for the search results of the parallel breadth-first search to not exceed the memory threshold.

[0108] In the embodiment of the present application, the subgraph matching system can dynamically determine the number of depth-first search steps based on the estimated memory consumption, so the parallel search strategy in the embodiment of the present application can also be called a dynamic depth-first search algorithm.

[0109] It can be seen from the above embodiments that the subgraph matching system in the embodiments of the present application can calculate the selectivity of each node in the query graph based on the graph structure of the query graph and the graph structure of the data graph, and determine the node matching order of the query graph based on the selectivity and the graph structure of the query graph, thereby improving the subgraph matching efficiency of the query graph.

[0110] Based on the above method embodiment, the embodiment of the present application further provides a sub-graph matching device. The sub-graph matching device provided by the embodiment of the present application is described in detail below.

[0111] See also Figure 7 , Figure 7 A schematic diagram of the structure of a sub-graph matching device provided in an embodiment of the present application. Figure 7 In the example shown, the subgraph matching device 700 is used to implement the various steps performed by the subgraph matching system in the above embodiments. The subgraph matching device 700 includes an acquisition unit 701 , a sorting unit 702 , a matching unit 703 , and a constraint unit 704 .

[0112] Among them, the acquisition unit 701 is used to acquire the query graph and the data graph, and the query graph is used to perform subgraph matching in the data graph. The sorting unit 702 is used to determine the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph. The node matching order is used to indicate the node order for subgraph matching in the query graph, and the graph structure of the data graph is used to calculate the selectivity of the nodes in the query graph, and the selectivity is used to determine the starting node of the node matching order. The matching unit 703 is used to perform subgraph matching in the data graph based on the node matching order and generate a matching result, and the matching result includes one or more subgraphs in the data graph with the same graph structure as the query graph.

[0113] In a possible implementation, the query graph includes one or more of the following: an undirected graph, a directed graph, an attribute graph, and an attributeless graph.

[0114] In a possible implementation, the sorting unit 702 is specifically used to calculate the selectivity of each node in the query graph, where the selectivity is the number of nodes in the data graph that contain the connection relationship of the node. The matching start node is determined based on the selectivity, and the matching start node is the node with the smallest selectivity in the query graph. The matching node after the matching start node is determined based on the number of connected edges of the remaining nodes in the query graph, and the matching node is the node with the largest number of connected edges among the remaining nodes in the query graph.

[0115] In a possible implementation, the sorting unit 702 is further configured to determine a matching node after the matching start node according to the selectivity of the remaining nodes when the numbers of connection edges of the remaining nodes in the query graph are the same.

[0116] In a possible implementation, the device further includes a constraint unit 704, which is used to determine an equivalent constraint relationship based on the query graph, and the equivalent constraint relationship is used to determine a matching range for subgraph matching in the data graph, and the subgraph within the matching range satisfies the equivalent constraint relationship. The matching unit 703 is specifically used to perform subgraph matching within the matching range in the data graph based on the node matching order.

[0117] In a possible implementation, the constraint unit 704 is specifically configured to determine an equivalent constraint relationship according to the node identifiers of the query graph, where the equivalent constraint relationship includes an ascending arrangement of the node identifiers or a descending arrangement of the node identifiers of the nodes in the query graph.

[0118] In a possible implementation, the matching unit 703 is specifically configured to search the data graph for nodes in the query graph in a node matching order based on a parallel search strategy, where the parallel search strategy includes a breadth-first search and a depth-first search.

[0119] In a possible implementation, the matching unit 703 is further configured to determine the number of depth-first search steps according to an estimated memory consumption, where the estimated memory consumption is used to indicate the memory occupied by the search results of a breadth-first search performed in parallel with the depth-first search steps.

[0120] It should be noted that the acquisition unit 701 may be the Figure 1 In the illustrated embodiment, the graph data reading module 101 and the sorting unit 702 may be the above Figure 1 In the mining plan generation module 103 of the embodiment shown, the matching unit 703 may be the above Figure 1 In the dynamic search and matching module 104 of the illustrated embodiment, the constraint unit 704 may be the above Figure 1 The equivalent point constraint module 102 in the illustrated embodiment.

[0121] It should be understood that the division of the units in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some units can also be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware. For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, and called and executed by a certain processing element of the device. The function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software calling through a processing element.

[0122] It is worth noting that, for the above method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required for the present application.

[0123] Other reasonable step combinations that can be thought of by those skilled in the art based on the above description also fall within the scope of protection of this application. Secondly, those skilled in the art should also be familiar with the fact that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by this application.

[0124] See also Figure 8 , Figure 8 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 8 As shown, the computing device 800 includes: a processor 801, a memory 802, a communication interface 803 and a bus 804. The processor 801, the memory 802 and the communication interface 803 are coupled via a bus (not marked in the figure). The memory 802 stores instructions. When the execution instructions in the memory 802 are executed, the computing device 800 executes the method executed by the subgraph matching system in the above method embodiment.

[0125] The computing device 800 may be one or more integrated circuits configured to implement the above method, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms. For another example, when a unit in the device can be implemented in the form of a processing element scheduler, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0126] The processor 801 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.

[0127] The memory 802 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0128] The memory 802 stores executable program codes, and the processor 801 executes the executable program codes to respectively implement the functions of the aforementioned acquisition unit 701, sorting unit 702, matching unit 703, and constraint unit 704, thereby implementing the aforementioned subgraph matching method. That is, the memory 802 stores instructions for executing the aforementioned subgraph matching method.

[0129] The communication interface 803 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.

[0130] In addition to the data bus, the bus 804 may also include a power bus, a control bus, a status signal bus, etc. The bus may be a peripheral component interconnect express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus may be divided into an address bus, a data bus, a control bus, etc.

[0131] See also Fig. 9 , Fig. 9 A schematic diagram of a computing device cluster provided in an embodiment of the present application. Fig. 9 As shown, the computing device cluster 900 includes at least one computing device 800 .

[0132] like Fig. 9 As shown, the computing device cluster 900 includes at least one computing device 800. The memory 802 in one or more computing devices 800 in the computing device cluster 900 may store the same instructions for executing the above subgraph matching method.

[0133] In some possible implementations, the memory 802 of one or more computing devices 800 in the computing device cluster 900 may also respectively store some instructions for executing the above subgraph matching method. In other words, the combination of one or more computing devices 800 may jointly execute the instructions for executing the above subgraph matching method.

[0134] It should be noted that the memory 802 in different computing devices 800 in the computing device cluster 900 may store different instructions, which are respectively used to execute part of the functions of the above-mentioned subgraph matching device. That is, the instructions stored in the memory 802 in different computing devices 800 may implement the functions of one or more modules in the acquisition unit 701, the sorting unit 702, the matching unit 703 and the constraint unit 704.

[0135] In some possible implementations, one or more computing devices 800 in the computing device cluster 900 may be connected via a network, which may be a wide area network or a local area network.

[0136] In another embodiment of the present application, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the sub-graph matching system in the above method embodiment.

[0137] In another embodiment of the present application, a computer program product is further provided, the computer program product comprising computer executable instructions, the computer executable instructions being stored in a computer readable storage medium. When a processor of a device executes the computer executable instructions, the device executes the method executed by the subgraph matching system in the above method embodiment.

[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0139] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0140] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0142] If the integrated unit is implemented in the form of a software functional unit 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 the present application is essentially 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, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A subgraph matching method, characterized in that: include: Obtaining a query graph and a data graph, wherein the query graph is used to perform subgraph matching in the data graph; Determining a node matching order of the query graph based on a graph structure of the query graph and a graph structure of the data graph, wherein the node matching order indicates an order of nodes in the query graph for subgraph matching, and the graph structure of the data graph is used to calculate the selectivity of nodes in the query graph, and the selectivity is used to determine a starting node of the node matching order; Subgraph matching is performed in the data graph based on the node matching order to generate a matching result, wherein the matching result includes one or more subgraphs in the data graph having the same graph structure as the query graph.

2. The method according to claim 2, characterized in that: The query graph includes one or more of the following: an undirected graph, a directed graph, an attribute graph, and an attributeless graph.

3. The method according to claim 1 or 2, characterized in that: The determining the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph comprises: Calculate the selectivity of each node in the query graph, where the selectivity is the number of nodes in the data graph that contain a connection relationship with the node; Determine a matching start node according to the selectivity, wherein the matching start node is a node with the smallest selectivity in the query graph; The matching node after the matching start node is determined according to the number of connection edges of the remaining nodes in the query graph, and the matching node is the node with the largest number of connection edges among the remaining nodes in the query graph.

4. The method according to claim 3, characterized in that The method further comprises: When the number of connection edges of the remaining nodes in the query graph is the same, the matching node after the matching start node is determined according to the selectivity of the remaining nodes.

5. The method according to any one of claims 1 to 4, characterized in that Before determining the node matching order of the query graph based on the graph structure of the query graph and the graph structure of the data graph, the method further includes: Determine an equivalence constraint relationship based on the query graph, wherein the equivalence constraint relationship is used to determine a matching range for subgraph matching in the data graph, and the subgraphs within the matching range satisfy the equivalence constraint relationship; The performing subgraph matching in the data graph based on the node matching order includes: Subgraph matching is performed within a matching range in the data graph based on the node matching order.

6. The method according to claim 5, characterized in that Determining the equivalent constraint relationship based on the query graph includes: An equivalence constraint relationship is determined according to the node identifiers of the query graph, wherein the equivalence constraint relationship includes an ascending arrangement of the node identifiers of the nodes in the query graph or a descending arrangement of the node identifiers.

7. The method according to any one of claims 1 to 5, characterized in that The performing subgraph matching in the data graph based on the node matching order includes: The data graph is searched for nodes in the query graph in a node matching order based on a parallel search strategy, wherein the parallel search strategy includes a breadth-first search and a depth-first search.

8. The method according to claim 7, characterized in that The method further comprises: The number of steps of the depth-first search is determined according to the estimated memory consumption, where the estimated memory consumption is used to indicate the memory occupied by the search results of the breadth-first search in parallel with the steps of the depth-first search.

9. A sub-graph matching device, characterized in that: include: An acquisition unit, used to acquire a query graph and a data graph, wherein the query graph is used to perform subgraph matching in the data graph; A sorting unit, configured to determine a node matching order of the query graph based on a graph structure of the query graph and a graph structure of the data graph, wherein the node matching order indicates an order of nodes in the query graph for performing subgraph matching, and the graph structure of the data graph is used to calculate a selectivity of a node in the query graph, and the selectivity is used to determine a starting node of the node matching order; A matching unit is used to perform subgraph matching in the data graph based on the node matching order to generate a matching result, wherein the matching result includes one or more subgraphs in the data graph having the same graph structure as the query graph.

10. The device according to claim 9, characterized in that The query graph includes one or more of the following: an undirected graph, a directed graph, an attribute graph, and an attributeless graph.

11. The device according to claim 9 or 10, characterized in that The sorting unit is specifically used for: Calculate the selectivity of each node in the query graph, where the selectivity is the number of nodes in the data graph that contain a connection relationship with the node; Determine a matching start node according to the selectivity, wherein the matching start node is a node with the smallest selectivity in the query graph; The matching node after the matching start node is determined according to the number of connection edges of the remaining nodes in the query graph, and the matching node is the node with the largest number of connection edges among the remaining nodes in the query graph.

12. The device according to claim 11, characterized in that The sorting unit is also used for: When the number of connection edges of the remaining nodes in the query graph is the same, the matching node after the matching start node is determined according to the selectivity of the remaining nodes.

13. The device according to any one of claims 9 to 12, characterized in that The device further comprises a constraint unit, which is used to: Determine an equivalence constraint relationship based on the query graph, wherein the equivalence constraint relationship is used to determine a matching range for subgraph matching in the data graph, and the subgraphs within the matching range satisfy the equivalence constraint relationship; The matching unit is specifically used for: Subgraph matching is performed within a matching range in the data graph based on the node matching order.

14. The device according to claim 12, characterized in that The constraint unit is specifically used for: An equivalence constraint relationship is determined according to the node identifiers of the query graph, wherein the equivalence constraint relationship includes an ascending arrangement of the node identifiers of the nodes in the query graph or a descending arrangement of the node identifiers.

15. The device according to any one of claims 9 to 14, characterized in that The matching unit is specifically used for: The data graph is searched for nodes in the query graph in a node matching order based on a parallel search strategy, wherein the parallel search strategy includes a breadth-first search and a depth-first search.

16. The device according to claim 15, characterized in that The matching unit is also used for: The number of steps of the depth-first search is determined according to the estimated memory consumption, where the estimated memory consumption is used to indicate the memory occupied by the search results of the breadth-first search in parallel with the steps of the depth-first search.

17. A computing device, characterized in that The electronic device comprises a processor coupled to a memory, wherein the processor is used to store instructions. When the instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8.

18. A computing device cluster, characterized in that: The method comprises at least one computing device, wherein the computing device comprises a processor, wherein the processor is coupled to a memory, and the processor is used to store instructions. When the instructions are executed by the processor, the computing device cluster executes the method according to any one of claims 1 to 8.

19. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed, the computer is caused to perform the method according to any one of claims 1 to 8.

20. A computer program product, comprising instructions, characterized in that: When the instructions are executed, the computer implements the method according to any one of claims 1 to 8.