A method and device for pre-calculated subgraph query based on graph summarization technology

By preprocessing the knowledge graph data to generate a graph summary and using the graph summary to precompute subgraph queries, the problems of prior knowledge dependence and high computational complexity in the existing technology are solved, and efficient subgraph queries and understanding of complex knowledge graphs are achieved.

CN115794884BActive Publication Date: 2025-09-05ZHEJIANG BANGSUN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211472183.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-23
Publication Date
2025-09-05
Estimated Expiration
2042-11-23

AI Technical Summary

Technical Problem

Existing technologies require certain prior knowledge when performing subgraph queries. The queries are relatively vague, have high computational complexity and high resource consumption, and are difficult to perform efficiently in large-scale knowledge graphs.

Method used

By preprocessing knowledge graph data, generating and maintaining graph summaries, and using graph summaries to precompute subgraph queries, including initializing summary sorting queues, graph pattern expansion, verification, quality scoring, and coverage function calculation, the query process is optimized.

Benefits of technology

It reduces the user's understanding requirements for knowledge graphs, improves the efficiency of sub-graph queries, enables better understanding of complex knowledge graphs, and greatly improves query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794884B_ABST
    Figure CN115794884B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for pre-calculating subgraph queries based on graph summarization technology. The present invention performs local graph summarization on a graph in real time, thereby reducing the number of entities contained in the graph structure in order to improve the efficiency of graph queries. In the pre-summarization stage, a simplified multi-hop summary is introduced. These summaries summarize the similarities between entities in a multi-hop neighborhood and a specific entity through a small graph pattern that contains rich information. In the graph query stage, the present invention uses a designed graph summary quality scoring function to sort, maintain and update the summary queue in real time. The graph query is covered by obtaining summaries from the graph summary queue, and necessary entities are obtained from the original graph, thereby improving the efficiency of the graph query. The present invention avoids the difficulties of directly performing graph queries by pre-calculating graph summaries, thereby enhancing the effectiveness and efficiency of graph queries.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of graph mining, and specifically relates to a method and device for pre-calculating subgraph queries based on graph summarization technology. Background Art

[0002] In graph theory, a graph is a figure composed of a number of given points and the lines connecting the two points. This kind of graph is usually used to describe a specific relationship between certain things, with points representing things and lines connecting two points indicating a certain relationship between the two things. Generally speaking, the designed knowledge graph G is an ordered triple (V, E, L), where V is called the vertex set, that is, the set of all vertices in the graph. The edge set is the set of all edges between vertices. Each vertex v∈V has a label L(v) that may contain information about v, such as its type, name, or attribute values. Each edge e∈E also has a label L(e) that represents the relationship between two vertices. Simply put, vertices represent things, and edges represent relationships between things.

[0003] Graphs, as a commonly used data structure, can accurately model key features and complex relationships in data across science and engineering, leading to their widespread application in fields such as bioinformatics, chemistry, and social network analysis. Key research areas in graph mining include graph classification, graph clustering, and subgraph querying. Subgraph querying, as a key branch of graph research, holds considerable practical significance and research value.

[0004] The subgraph query problem treats a graph as a complex object. By mining the information and structure of the knowledge graph, given a query graph, all data subgraphs that contain the query graph are found within the graph. To search knowledge graphs, many query processing techniques have been proposed, primarily based on a "filter-and-verify" strategy for subgraph queries. However, for end users, without any prior knowledge of the underlying data graph, it is difficult to accurately query and obtain meaningful answers. Querying large-scale knowledge graphs is challenging due to query ambiguity, inherent computational complexity (e.g., subgraph isomorphism), and resource constraints (e.g., accessible data, response time).

[0005] Graph summaries can enable knowledge search through highly interpretable “views” (and can be queried directly as highly interpretable “views”). In addition, such summaries can help users understand complex knowledge graphs without having to examine large amounts of data, explain facts with interpretable evidence, and make meaningful queries in mining tasks.

[0006] In summary, it is meaningful to apply the proposed new ideas and methods to graph classification tasks, thereby avoiding the problems that are difficult to solve in the above methods, thereby improving the efficiency of subgraph queries and making them more suitable for the current big data context. Summary of the Invention

[0007] In light of the above, this paper proposes a method for pre-computing subgraph queries based on graph summarization technology to address the problems of existing methods, such as the requirement of certain prior knowledge, relatively ambiguous queries, high computational complexity, and high resource consumption. This method first pre-processes the graph data, then generates and maintains graph summaries based on the graph data. Given a graph query, a subgraph query is performed based on the resulting set of graph summaries.

[0008] The technical solution adopted by the present invention to solve the technical problem is as follows: In a first aspect, the present invention provides a method for pre-calculating subgraph queries based on graph summarization technology, the method comprising the following steps:

[0009] (1) obtaining a number of knowledge graph data and preprocessing the knowledge graph data; the graph data includes all vertices, edges, and category information in the graph;

[0010] (2) Extracting and maintaining graph summary queues for knowledge graph data, specifically including the following sub-steps:

[0011] (2.1) Initialize the summary sorting queue L and summary set C P and the summary result S is empty, and set the summary sorting queue L and the summary result S length to k, the minimum summary boundary size d and the user summary budget b P ;

[0012] (2.2) Initialize the graph pattern P with any vertex in the knowledge graph data and perform an extension operation on it, extending an edge from the vertex. The newly obtained graph pattern is recorded as P′;

[0013] (2.3) Verify the obtained graph pattern P′. If the verification result is correct, all pairs of vertices can be merged into a super vertex and the graph pattern P can be updated. If the result is incorrect, repeat step 2.2 to select other extension edges.

[0014] (2.4) Repeat steps (2.2) and (2.3) until no new graph pattern can be expanded within the set jump range boundary value;

[0015] (2.5) Add the final graph pattern P to the summary set C P and summary sorting queue L;

[0016] (2.6) Calculate the newly obtained graph pattern P and summary set C PQuality scoring function between all graph patterns in;

[0017] (2.7) Re-sort the original abstracts in the abstract sorting queue L in descending order based on the quality scoring function calculated for the graph pattern P, and obtain the queue L with the maximum quality after sorting;

[0018] (2.8) Take the first one from L For the summary, add it to the summary result S to maximize the summary result quality function value;

[0019] (2.9) Repeat steps (2.2) to (2.8) until the running time limit is reached or no new graph pattern can be generated, and get the latest summary result S named S G ;

[0020] (3) Based on the summary result set S obtained in (2) G , a given knowledge graph G and a given query graph pattern Q = (V q ,E q ,L q ,), perform the query of isomorphic graphs, which includes the following sub-steps:

[0021] (3.1) For the summary result set S G For all graph patterns P in the graph, calculate the coverage function score of the latest graph pattern P;

[0022] (3.2) Select the summary result set S G The summary with the highest coverage function score is added to the final result R, and all coverage function scores are updated;

[0023] (3.3) Repeat steps (3.1) and (3.2) until all summary results are selected or the maximum number of results is reached, and return the result set R obtained by the query.

[0024] Furthermore, in the step (2.3), when the obtained graph pattern P′ is checked, it is checked whether there is any label in the incoming path (outgoing path) of each vertex of the graph pattern P′ that is the same as all the incoming paths (outgoing paths) within a d-hop distance of the vertex. If so, the verification result is correct; if no identical label exists, the verification result is incorrect.

[0025] Furthermore, in step (2.6), the quality scoring function is calculated as follows:

[0026] F(P,P′)=(1-α)(I(P)+I(P′))+α*diff(P,P′);

[0027] Where I(P) is the information function, b P To normalize the size limit of |P| (summary budget, i.e. the maximum summary size that the user can afford), |P| represents the number of elements in P, g P is the base graph of P in G, V gP g P The vertex set of is the Jaccard distance between the two sets P and P′ in their corresponding base graphs, V GP, G P′ The vertex set G P′ is the base graph α∈[0,1] of P′ in the graph G, and is a parameter that can be modified manually to balance informativeness and diversity.

[0028] Furthermore, in step (2.8), the result quality function is calculated as follows: where num(S) represents the number of summaries in S; |P| represents the number of elements in P, It's P i and P j The Jaccard distance between these two sets in their corresponding base graphs, α∈[0,1], is a parameter that can be manually modified to balance informativeness and diversity.

[0029] Furthermore, in step (3.1), the coverage score function is calculated as follows:

[0030]

[0031] Among them, E QP is the edge set of similar attributes of summary P corresponding to Q, E cover is the set of edges that have covered the query Q, |G P | is the number of vertices corresponding to the summary P in the base graph.

[0032] In the second aspect, the present invention also provides a device for pre-calculating subgraph queries based on graph summary technology, comprising a memory and one or more processors, wherein the memory stores executable code, and when the processor executes the executable code, it is used to implement the steps of the method for pre-calculating subgraph queries based on graph summary technology.

[0033] In a third aspect, the present invention also provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps of the method for pre-calculating subgraph queries based on graph summarization technology.

[0034] Based on the above technical solution, the present invention has the following beneficial technical effects: the present invention proposes a method for pre-calculating subgraph queries based on graph summary technology, which uses pre-calculated graph summaries of graphs to perform high-level extraction of knowledge graph information, and uses graph summaries to quickly return query results when performing subgraph queries, which greatly reduces the user's requirements for understanding the knowledge graph, improves the efficiency of subgraph queries, and can better help users understand complex knowledge graphs, fundamentally improving the efficiency of subgraph queries, and can be widely used in the field of subgraph queries. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0036] Figure 1 Flowchart of the method for pre-calculating subgraph queries based on graph summarization technology provided by the present invention.

[0037] Figure 2 This is a structural diagram of the device for pre-calculating subgraph queries based on graph summarization technology provided by the present invention. DETAILED DESCRIPTION

[0038] The present invention will be described in further detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention but are not intended to limit the scope of the present invention.

[0039] We choose to query the name of an artist as the task. The knowledge graph dataset includes 17 types of elements, including movie names, managers, countries, artists, and movie types. Figure 1 As shown, the present invention proposes a method for pre-calculating subgraph queries based on graph summarization technology, and the implementation steps are as follows:

[0040] (1) Based on the acquired knowledge graph data, the knowledge graph dataset is preprocessed. The graph data includes all vertices, edges, and category information in the graph. Vertices include names, country names, movie names, etc. Edges include singers, actors, collaborators, locations, and birthplaces, etc. Categories include bands, artists, managers, awards, movies, and countries, etc. We define this knowledge graph as G = (V, E, L).

[0041] (2) Before performing a subgraph query, the present invention pre-calculates the knowledge graph to obtain a graph summary to reduce the time and resources consumed by subsequent graph queries. The graph summary queue is extracted and maintained, specifically including the following sub-steps:

[0042] (2.1) Initialize the summary sorting queue L and summary set C P and the summary result S is empty, and set L and S length k to 16, the minimum summary boundary size d to 2 and the user summary budget b P is 8;

[0043] (2.2) Initialize the graph pattern P with any vertex. Here, we can randomly select an artist such as "T.McGraw" as the initial vertex and perform an expansion operation on it. From this vertex, we extend an edge "actor" to indicate that he has starred in the movie "Four_Holidays". The newly obtained graph pattern is denoted as P′.

[0044] (2.3) Verify the obtained graph pattern P′. When verifying the obtained graph pattern P′, check whether there is any incoming path (outgoing path) of each vertex of the graph pattern P′ that has the same label as all incoming paths (outgoing paths) within a d-hop distance of the vertex. If the verification result is correct, these vertices can be merged into a super vertex and the graph pattern P is updated. If the result is incorrect, repeat step 2.2 to select other extension edges.

[0045] (2.4) Repeat steps 2.2 and 2.3 until no new pattern can be expanded within the set jump range boundary value;

[0046] (2.5) Add the newly obtained graph pattern P to the summary set C P and summary sorting queue L;

[0047] (2.6) Calculate the newly acquired pattern P and summary set C P The quality scoring function between all graph modes in is calculated as follows:

[0048] F(P,P′)=(1-α)(I(P)+I(P′))+α*diff(P,P′);

[0049] Where I(P) is the information function, b P To normalize the size limit of |P| (summary budget, i.e. the maximum summary size that the user can afford), |P| represents the number of elements in P, g P is the base graph of P in G, V gP g P The vertex set of

[0050] is the Jaccard distance between the two sets P and P′ in their corresponding base graphs, α∈[0,1] is a parameter that can be manually modified to balance informativeness and diversity, and is set to 0.2 in this embodiment.

[0051] (2.7) Re-sort the original abstracts in the abstract sorting queue L in descending order based on the quality scoring function calculated for P, and obtain the queue L with the maximum quality after sorting;

[0052] (2.8) Take from L For the summary, use it to update the summary result S to maximize the summary result quality function value. The result quality function is calculated as follows: where num(S) represents the number of summaries in S; |P| represents the number of elements in P,

[0053] It's P i and P j The Jaccard distance between the two sets in their corresponding base graphs, α∈[0,1], is a parameter that can be manually modified to balance informativeness and diversity, and is set to 0.2 in this embodiment.

[0054] (2.9) Repeat steps 2.2 to 2.8 until the running time limit is reached or no new summary pattern can be generated, and obtain the summary result S G The summary pattern obtained here includes the artist and his country, gender, and the name of the movie he participated in.

[0055] (3) Based on the summary result set S obtained in (2) G , a given knowledge graph G and a given query graph pattern Q = (V q ,E q ,L q ,), perform the query of isomorphic graphs, which includes the following sub-steps:

[0056] (3.1) For the summary result set S G For all summaries P in the database, calculate the coverage function score of the latest summary P. The coverage score function is calculated as follows:

[0057]

[0058] Among them, E QP is the edge set of similar attributes of summary P corresponding to Q, E cover is the set of edges that have covered the query Q, |G P | is the number of vertices corresponding to the summary P in the base graph.

[0059] (3.2) Select the summary result set S G The summary with the highest coverage function score is added to the final result R, so that all coverage function scores can be updated again;

[0060] (3.3) Repeat steps 3.1 and 3.2 until all summary modes are selected or the maximum number of results is reached, and return the artist name result set R obtained by the query.

[0061] If a subgraph query is performed directly on the knowledge graph without pre-calculation, the user is first required to have a certain understanding of the knowledge graph. In the subsequent query process, it is necessary to traverse the nodes corresponding to the query type in the entire knowledge graph, which will consume a lot of resources. The present invention proposes a method for pre-calculating subgraph queries based on graph summary technology, which uses the pre-calculated graph summary of the graph to perform high-level extraction of knowledge graph information, and uses the graph summary to quickly return query results when performing subgraph queries, greatly reducing the user's understanding requirements for the knowledge graph, improving the efficiency of subgraph queries, and can better help users understand complex knowledge graphs, fundamentally improving the efficiency of subgraph queries, and can be widely used in the field of subgraph queries.

[0062] Corresponding to the aforementioned embodiment of the method for pre-calculating subgraph queries based on graph summary technology, the present invention also provides an embodiment of an apparatus for pre-calculating subgraph queries based on graph summary technology.

[0063] See also Figure 2 An embodiment of the present invention provides a device for pre-calculating subgraph queries based on graph summary technology, including a memory and one or more processors, wherein the memory stores executable code, and when the processor executes the executable code, it is used to implement the method for pre-calculating subgraph queries based on graph summary technology in the above embodiment.

[0064] The embodiment of the device for pre-calculating subgraph queries based on graph summarization technology of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution. From the hardware level, if Figure 2 As shown in the figure, it is a hardware structure diagram of any device with data processing capability where the device for pre-calculating subgraph query based on graph summarization technology of the present invention is located. Figure 2 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiment is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.

[0065] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0066] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein 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 across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present invention. A person of ordinary skill in the art can understand and implement the present invention without inventive work.

[0067] An embodiment of the present invention also provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, the method for pre-calculating subgraph queries based on graph summarization technology in the above embodiment is implemented.

[0068] The computer-readable storage medium may be an internal storage unit of any device with data processing capabilities described in any of the aforementioned embodiments, such as a hard disk or memory. The computer-readable storage medium may also be an external storage device of any device with data processing capabilities, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capabilities. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capabilities, and may also be used to temporarily store data that has been output or is to be output.

[0069] The above embodiments are used to illustrate the present invention rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.

Claims

1. A method for pre-calculating subgraph queries based on graph summarization technology, characterized in that: The method comprises the following steps: (1) obtaining a number of knowledge graph data and preprocessing the knowledge graph data; the graph data includes all vertices, edges, and category information in the graph; (2) Extracting and maintaining graph summary queues for knowledge graph data, specifically including the following sub-steps: (2.1) Initialize the summary sorting queue L and summary set C P and the summary result S is empty, and set the summary sorting queue L and the summary result S length to k, the minimum summary boundary size d and the user summary budget b P ; (2.2) Initialize the graph pattern P with any vertex in the knowledge graph data and perform an extension operation on it, extending an edge from the vertex. The newly obtained graph pattern is recorded as P′; (2.3) Verify the obtained graph pattern P′. If the verification result is correct, all pairs of vertices can be merged into a super vertex and the graph pattern P can be updated. If the result is incorrect, repeat step 2.2 to select other extension edges. (2.4) Repeat steps (2.2) and (2.3) until no new graph pattern can be expanded within the set jump range boundary value; (2.5) Add the final graph pattern P to the summary set C P and summary sorting queue L; (2.6) Calculate the newly obtained graph pattern P and summary set C P Quality scoring function between all graph patterns in; (2.7) Re-sort the original abstracts in the abstract sorting queue L in descending order based on the quality scoring function calculated for the graph pattern P, and obtain the queue L with the maximum quality after sorting; (2.8) Take the first one from L For the summary, add it to the summary result S to maximize the summary result quality function value; (2.9) Repeat steps (2.2) to (2.8) until the running time limit is reached or no new graph pattern can be generated, and get the latest summary result S named S G ; (3) Based on the summary result set S obtained in (2) G , a given knowledge graph G and a given query graph pattern Q = (V q ,E q ,L q, ), perform a query on the isomorphic graph, which specifically includes the following sub-steps: (3.1) For the summary result set S G For all graph patterns P in the graph, calculate the coverage function score of the latest graph pattern P; (3.2) Select the summary result set S G The summary with the highest coverage function score is added to the final result R, and all coverage function scores are updated; (3.3) Repeat steps (3.1) and (3.2) until all summary results are selected or the maximum number of results is reached, and return the result set R obtained by the query.

2. The method for pre-calculating subgraph queries based on graph summarization technology according to claim 1, characterized in that: In the step (2.3), when checking the obtained graph pattern P′, it is checked whether there is any label in the incoming path (outgoing path) of each vertex of the graph pattern P′ that is the same as all the incoming paths (outgoing paths) within a d-hop distance of the vertex. If so, the verification result is correct. If no identical label exists, the verification result is incorrect.

3. The method for pre-calculating subgraph queries based on graph summarization technology according to claim 1, characterized in that: In the step (2.6), the quality scoring function is calculated as follows: F(P,P')=(1-α)(I(P)+I(P'))+α*diff(P,P'); Where I(P) is the information function, b P To normalize the size limit of |P| (summary budget, i.e. the maximum summary size that the user can afford), |P| represents the number of elements in P, G P is the base graph of P in graph G, G P The vertex set of is the Jaccard distance between the two sets P and P′ in their corresponding base graphs, G P ′’s vertex set, G P′ is the base graph α∈[0,1] of P′ in the graph G, and is a parameter that can be modified manually to balance informativeness and diversity.

4. The method for pre-calculating subgraph queries based on graph summarization technology according to claim 1, characterized in that: In the step (2.8), the result quality function is calculated as follows: Where num(S) represents the number of summaries in S; |P| represents the number of elements in P, It's P i and P j The Jaccard distance between these two sets in their corresponding base graphs, α∈[0,1], is a parameter that can be manually modified to balance informativeness and diversity.

5. The method for pre-calculating subgraph queries based on graph summarization technology according to claim 1, characterized in that: In step (3.1), the coverage score function is calculated as follows: in, is the edge set of similar attributes of summary P corresponding to Q, E cover is the set of edges that have covered the query Q, |G P | is the number of vertices corresponding to the summary P in the base graph.

6. A device for pre-calculating subgraph queries based on graph summarization technology, comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the processor executes the executable code, it is used to implement the steps of the method for pre-calculating subgraph queries based on graph summarization technology as described in any one of claims 1 to 5.

7. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method for pre-calculating subgraph queries based on graph summarization technology as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Graph query method and device and storage medium

    CN111651641A

  • Event mode frequent subgraph mining and prediction method

    CN112287118A