Knowledge graph relationship reasoning optimization method
By converting knowledge graphs into spectral domain representations and processing them hierarchically, and employing Laplacian matrices and spectral clustering techniques, the problem of path explosion in large-scale knowledge graphs is solved, achieving efficient relational reasoning and dynamic adaptation capabilities, and improving real-time performance and scalability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHENGZHOU UNIV
- Filing Date
- 2026-01-05
- Publication Date
- 2026-05-29
AI Technical Summary
When dealing with large-scale or dense knowledge graphs, existing technologies based on path search are prone to path explosion, resulting in excessively high computational complexity and making it difficult to meet the technical requirements of real-time or large-scale relational reasoning.
By converting the adjacency matrix of the knowledge graph into a spectral domain representation, a feature spectrum is generated using the Laplacian matrix and divided into low-resolution and high-resolution layers. In the low-resolution layer, spectral clustering is used to compress long paths into virtual supernodes, while in the high-resolution layer, local spectral smoothing is applied to prioritize inference of short paths. The results of each layer are then fused through inverse spectral transformation, and the confidence score of the potential relationship is calculated by combining the principle of minimizing spectral energy.
It effectively solves the path explosion problem in traditional path search, can better capture the semantic depth of global coarse-grained and local fine-grained relationships, achieves globally consistent cross-layer optimization and efficient dynamic adaptation, and improves real-time performance and scalability.
Smart Images

Figure CN122114134A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method for optimizing relational reasoning in knowledge graphs. Background Technology
[0002] Knowledge graphs, as a structured semantic knowledge base, construct large-scale graph-structured data through entities and relationships, and are widely used in fields such as search engines, intelligent question answering, and recommendation systems. Relational reasoning is one of the core tasks of knowledge graphs, aiming to infer missing or implicit relationships from existing entities and relationships, thereby achieving automatic completion and expansion of knowledge graphs and improving the completeness and usability of knowledge.
[0003] In existing technologies, relational reasoning optimization algorithms mainly employ path-search-based methods. These methods enumerate multiple paths from the starting entity to the target entity within the knowledge graph, combining information such as path length, path weight, or path pattern to rank and reason about potential relationships. Existing solutions typically use breadth-first search, depth-first search, or variations thereof to discover possible reasoning paths, and evaluate these paths using path statistical features or heuristic rules to calculate the confidence level of the potential relationship. These methods achieve good results in small-scale or sparse knowledge graphs and are relatively intuitive to implement.
[0004] However, in the process of implementing the technical solution of this application, the inventors of this application discovered that the above-mentioned technology has at least the following technical problems: when processing large-scale or dense knowledge graphs, the path search-based method is prone to path explosion, which leads to an exponential increase in the number of potential paths, resulting in excessively high computational complexity and difficulty in meeting the technical requirements of real-time or large-scale relational reasoning. Summary of the Invention
[0005] To overcome the above shortcomings, this invention provides a knowledge graph relation reasoning optimization method, which aims to improve the problem that path search-based methods are prone to path explosion when dealing with large-scale or dense knowledge graphs.
[0006] In a first aspect, the present invention provides the following technical solution: a knowledge graph relation reasoning optimization method, comprising the following steps:
[0007] S1. The processor obtains the graph structure data corresponding to the knowledge graph and constructs a Laplace matrix based on the graph structure data;
[0008] S2. The processor performs eigenvalue decomposition on the Laplacian matrix to obtain the corresponding eigenvalue set and eigenvector set, and divides the eigenvalue set into a low-resolution spectral layer and a high-resolution spectral layer according to a preset segmentation condition.
[0009] S3. In the low-resolution spectral layer, multiple entity nodes are aggregated based on the similarity relationship between feature vectors to generate virtual super nodes in order to compress long path structures.
[0010] S4. In the high-resolution spectral layer, short-path relationships between entity nodes are prioritized based on local spectral smoothing operations.
[0011] S5. Calculate the confidence level of potential relationships based on the energy constraints of the path in the spectral domain;
[0012] S6. Map the inference results of the low-resolution spectral layer and the high-resolution spectral layer back to the graph structure space through inverse spectral transformation, and adaptively adjust the fusion weights according to the spectral energy characteristics corresponding to each spectral layer to generate the final relational inference results.
[0013] S7. When the knowledge graph is updated, incremental update operation is performed only on the spectral components affected by the update.
[0014] Preferably, in S2, the step of dividing the feature set into low-resolution spectral layers and high-resolution spectral layers according to preset segmentation conditions includes:
[0015] Construct the Laplacian matrix of the undirected graph based on the adjacency matrix and degree matrix of the knowledge graph;
[0016] Perform eigenvalue decomposition on the Laplacian matrix to obtain a set of eigenvalues sorted by their magnitude and a set of corresponding orthogonal eigenvectors.
[0017] Based on a preset threshold or the statistical distribution characteristics of feature values, the feature value set is divided into a low-resolution spectral layer and a high-resolution spectral layer, wherein the low-resolution spectral layer is used to characterize global relational features and the high-resolution spectral layer is used to characterize local relational features.
[0018] Spectral noise suppression processing was performed in both the low-resolution and high-resolution spectral layers.
[0019] Preferably, in S2, the step of performing spectral noise suppression processing in the low-resolution spectral layer and the high-resolution spectral layer respectively includes:
[0020] After completing the eigenvalue decomposition and obtaining the spectral coefficients, statistical analysis was performed on the spectral coefficients corresponding to the low-resolution and high-resolution spectral layers, respectively.
[0021] Determine the corresponding spectral coefficient threshold based on the amplitude or energy distribution characteristics of the spectral coefficients;
[0022] Spectral coefficients below the threshold are suppressed or filtered out to reduce the impact of noise spectral components on subsequent relational inference results.
[0023] Preferably, the step of generating virtual supernodes includes:
[0024] Calculate the spectral similarity matrix based on the eigenvectors corresponding to the low-resolution spectral layer;
[0025] Clustering operations are performed based on the spectral similarity matrix to generate multiple sets of virtual supernodes;
[0026] Each virtual supernode represents a group of entity nodes with global relevance.
[0027] Preferably, in S3, the step of compressing the long path structure includes:
[0028] Based on the feature vectors corresponding to the virtual supernodes, calculate the spectral distance between any two virtual supernodes.
[0029] The spectral distance is used as the path weight or path length of the compressed long path;
[0030] The long paths in the original knowledge graph are uniformly mapped and represented by the path weights or path lengths.
[0031] Preferably, in S4, the step of performing short-path inference based on local spectral smoothing operation includes:
[0032] Calculate the local spectral smoothing matrix based on the sub-Laplace matrix corresponding to the high-resolution spectral layer;
[0033] The confidence level of the short path relationship is determined based on the element values of the corresponding entity node positions in the local spectral smoothing matrix.
[0034] Preferably, in S5, the step of calculating the confidence level based on the spectral domain energy constraint includes:
[0035] For any potential relationship, select a path from the corresponding set of compressed paths that satisfies the preset spectral energy constraint conditions;
[0036] The confidence score of the potential relationship is determined based on the selected path.
[0037] Preferably, in S6, the step of adaptively adjusting the fusion weights based on the spectral energy characteristics corresponding to each spectral layer to generate the final relational inference result includes:
[0038] Inverse spectral transforms are performed on the inference results of the low-resolution and high-resolution spectral layers, respectively, to obtain the corresponding graph structure signals.
[0039] Calculate the cross-layer fusion weights based on the spectral norm or energy distribution characteristics of each spectral layer;
[0040] The graph structure signals are weighted and fused based on the fusion weights to generate the final relational reasoning result.
[0041] Preferably, in S7, the step of performing incremental update operations on the spectral components affected by the update includes:
[0042] Detect the addition, deletion, or weight change of nodes or relations in a knowledge graph, and construct the incremental change of the Laplace matrix based on the changes;
[0043] Based on the incremental change of the Laplace matrix, the original eigenvalues and eigenvectors are approximately updated using perturbation theory;
[0044] Only the spectral components affected by the incremental change are recalculated, while the remaining spectral components remain unchanged, in order to reduce the overall computational cost.
[0045] Secondly, the invention provides the following technical solution: a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the aforementioned knowledge graph relation reasoning optimization method.
[0046] The present invention has the following beneficial effects:
[0047] 1. This invention effectively solves the path explosion problem in traditional path search by converting the adjacency matrix of the knowledge graph into a spectral domain representation, using the Laplacian matrix to generate a feature spectrum and dividing it into a low-resolution layer and a high-resolution layer. In the low-resolution layer, spectral clustering is used to compress long paths into virtual supernodes, and in the high-resolution layer, the technical feature of prioritizing local spectral smoothing inference for short paths is applied.
[0048] 2. This invention calculates the confidence score of potential relationships based on the principle of minimizing spectral energy, and combines the technical features of intra-layer path compression and inference, so that the inference process pays more attention to the energy distribution in the spectral domain, and can better capture the semantic depth of global coarse-grained relationships and local fine-grained relationships, avoiding the cumulative error in traditional statistical probability methods.
[0049] 3. This invention integrates the inference results of each layer through inverse spectral transformation and introduces a cross-layer weight adjustment mechanism. It also incorporates the technical features of supporting incremental spectral update weight calculation for affected spectral components in dynamic graphs. This achieves globally consistent cross-layer optimization and efficient dynamic adaptability, enabling the algorithm to be applied to continuously updated knowledge graph scenarios and improving its real-time performance and scalability in practical applications. Attached Figure Description
[0050] Figure 1 This is a flowchart of the knowledge graph relation reasoning optimization method proposed in this invention. Detailed Implementation
[0051] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Example 1
[0053] Reference Figure 1 In the first embodiment of the present invention, the present invention provides a knowledge graph relation reasoning optimization method, comprising the following steps:
[0054] S1. The processor obtains the graph structure data corresponding to the knowledge graph and constructs the Laplace matrix based on the graph structure data;
[0055] S2. The processor performs eigenvalue decomposition on the Laplacian matrix to obtain the corresponding set of eigenvalues and eigenvectors, and divides the set of eigenvalues into low-resolution spectral layers and high-resolution spectral layers according to preset segmentation conditions.
[0056] S3. In the low-resolution spectral layer, multiple entity nodes are aggregated based on the similarity relationship between feature vectors to generate virtual super nodes in order to compress long path structures.
[0057] S4. In high-resolution spectral layers, short-path relationships between entity nodes are prioritized based on local spectral smoothing operations.
[0058] S5. Calculate the confidence level of potential relationships based on the energy constraints of the path in the spectral domain;
[0059] S6. Map the inference results of low-resolution and high-resolution spectral layers back to the graph structure space through inverse spectral transformation, and adaptively adjust the fusion weights according to the spectral energy characteristics of each spectral layer to generate the final relational inference results.
[0060] S7. When the knowledge graph is updated, incremental update operations are performed only on the spectral components affected by the update.
[0061] Specifically, knowledge graphs are represented as undirected graphs. ;in, Represents a set of entity nodes. Represents the set of relationships between entity nodes. Construct an adjacency matrix based on an undirected graph. Among them, when the entity node With entity nodes When a relationship exists, ,otherwise Further construct the degree matrix ;in, Represents entity nodes The degree value. Based on the adjacency matrix. degree matrix Construct the graph Laplace matrix Where L is A real symmetric matrix.
[0062] In S2, the eigenvalue decomposition operation is performed on the Laplacian matrix L to obtain... ;in, For the eigenvalue matrix, The corresponding orthogonal eigenvector matrix, Indicates the first Each feature vector. Based on preset segmentation conditions, it will satisfy... The eigenvalues and their corresponding eigenvectors are divided into low-resolution spectral layers, satisfying... The eigenvalues and their corresponding eigenvectors are divided into high-resolution spectral layers, where, The preset spectral segmentation threshold is used. In the spectral domain, the graph-structured signal... Projecting onto the spectral domain yields the spectral coefficient vector. ;in, This represents a graph signal defined on an entity node. Indicates the corresponding number The spectral coefficients of each feature vector are analyzed. Based on the amplitude distribution of the spectral coefficients, threshold suppression is applied to the spectral coefficients in both the low-resolution and high-resolution spectral layers, retaining those that satisfy the following conditions: The spectral components, among which, This is the threshold for suppressing spectral noise.
[0063] In S3, based on the set of feature vectors corresponding to the low-resolution spectral layer. Calculate the spectral similarity matrix between entity nodes: ;in, This represents the eigenvector submatrix of the low-resolution spectral layer. Aggregation operations are performed on the entity nodes based on the spectral similarity matrix to generate multiple sets of virtual supernodes. Each virtual supernode represents a group of entity nodes with similar spectral representations in the low-resolution spectral layer. Based on the eigenvectors corresponding to the virtual supernodes, the spectral distance between any two virtual supernodes is calculated. ;in, These represent the unit indicator vectors of the corresponding virtual supernodes, and the spectral distance is used to represent the compressed long path weight or path length.
[0064] In S4, based on the Laplace submatrix corresponding to the high-resolution spectral layer. Construct the local spectral smoothing matrix: ;in, represents the spectral smoothing parameters. Based on the matrix element values corresponding to the entity node positions in the local spectral smoothing matrix, the inference result of the shortest path relationship between entity nodes and its corresponding relationship strength are determined.
[0065] In S5, for any potential relation to be reasoned about, based on the compressed path set... Calculate the spectral energy of the path: ;in, Indicates a path. This indicates the number of spectral components contained in the path. Indicates the path signal at the 1st The coefficients on each spectral component. Based on the spectral domain energy, paths that satisfy the energy constraints are selected from the path set, and the confidence scores of the potential relationships are determined accordingly.
[0066] In S6, the inference results of the low-resolution spectral layers are respectively... Inference results from high-resolution spectral layers Perform an inverse spectral transform to obtain the corresponding graph-structured domain signal. Calculate the cross-layer fusion weights based on the spectral norms corresponding to the low-resolution and high-resolution spectral layers. ;in, and These represent the eigenvalue matrices of the low-resolution and high-resolution spectral layers, respectively. Based on the fusion weights, the final relation inference result is generated: .
[0067] exist In the context of a knowledge graph, when nodes or relationships are updated, the incremental change in the Laplace matrix is calculated. And based on perturbation theory, the original eigenvalues and eigenvectors are approximately updated: ;in, This represents the updated eigenvalues. Only the spectral components affected by the increment are recalculated, while the remaining spectral components remain unchanged.
[0068] Furthermore, in S2, the step of dividing the feature set into low-resolution and high-resolution spectral layers according to preset segmentation conditions includes:
[0069] Construct the Laplacian matrix of the undirected graph based on the adjacency matrix and degree matrix of the knowledge graph;
[0070] Perform eigenvalue decomposition on the Laplacian matrix to obtain the set of eigenvalues sorted by their magnitude and the corresponding set of orthogonal eigenvectors;
[0071] Based on preset thresholds or statistical distribution characteristics of feature values, the feature value set is divided into low-resolution spectral layers and high-resolution spectral layers, where the low-resolution spectral layers are used to characterize global relational features and the high-resolution spectral layers are used to characterize local relational features.
[0072] Spectral noise suppression processing was performed in both the low-resolution and high-resolution spectral layers.
[0073] In S2, the steps of performing spectral noise suppression processing in the low-resolution and high-resolution spectral layers respectively include:
[0074] After completing the eigenvalue decomposition and obtaining the spectral coefficients, statistical analysis was performed on the spectral coefficients corresponding to the low-resolution and high-resolution spectral layers, respectively.
[0075] Determine the corresponding spectral coefficient threshold based on the amplitude or energy distribution characteristics of the spectral coefficients;
[0076] Spectral coefficients below a threshold are suppressed or filtered out to reduce the impact of noise spectral components on subsequent relational inference results.
[0077] Specifically, the processor uses the adjacency matrix obtained in step S1. Sum-degree matrix Constructing the Laplacian matrix of an undirected graph: ;in adjacency matrix Represents entity nodes With entity nodes Connection relationship between For degree matrix, It is a real symmetric positive semi-definite matrix. The Laplace matrix is processed by the processor. Performing eigenvalue decomposition yields: ;in, Let be an eigenvalue matrix, satisfying: ; The corresponding orthogonal eigenvector matrix, Representation and eigenvalues The corresponding feature vector.
[0078] After feature decomposition, the processor performs hierarchical processing on the feature set according to preset segmentation conditions. These preset segmentation conditions include segmentation methods based on feature value thresholds or segmentation methods based on the statistical distribution of feature values. Setting the spectral segmentation threshold... When the eigenvalue When the corresponding eigenvalues and their eigenvectors are divided into low-resolution spectral layers; when the eigenvalues At that time, the corresponding eigenvalues and their eigenvectors are divided into high-resolution spectral layers.
[0079] The set of feature vectors contained in the low-resolution spectral layer is denoted as: The set of feature vectors contained in a high-resolution spectral layer is denoted as: ; Indicates satisfaction The maximum eigenvalue index. Low-resolution spectral layers are used to characterize global structural features in the knowledge graph, while high-resolution spectral layers are used to characterize local structural features. After the spectral layers are divided, the processor performs spectral noise suppression processing in both the low-resolution and high-resolution spectral layers.
[0080] The specific process is as follows:
[0081] First, the graph structure signal Projecting onto the spectral domain yields the spectral coefficient vector: ;in, This represents a graph signal defined on an entity node. Indicates the first The spectral coefficients corresponding to each spectral component.
[0082] The processor processes the spectral coefficient sets corresponding to the low-resolution spectral layers separately: The set of spectral coefficients corresponding to high-resolution spectral layers Statistical analysis is performed to obtain the amplitude distribution or energy distribution characteristics of the spectral coefficients.
[0083] Based on statistical results, the spectral coefficient suppression threshold was determined. These are used for low-resolution and high-resolution spectral layers, respectively. When the spectral coefficients satisfy: or When the spectral coefficients meet the threshold conditions, the processor performs suppression or filtering operations on the corresponding spectral coefficients; when the spectral coefficients meet the threshold conditions, the spectral coefficients are retained for subsequent relational reasoning calculations.
[0084] Through the above processing, the spectral components used for subsequent inference in both the low-resolution and high-resolution spectral layers are effective spectral components that satisfy the amplitude or energy constraints, thereby completing feature selection and noise suppression based on spectral layering.
[0085] Furthermore, in S3, the steps for generating virtual supernodes include:
[0086] Calculate the spectral similarity matrix based on the eigenvectors corresponding to the low-resolution spectral layer;
[0087] Clustering operations are performed based on the spectral similarity matrix to generate multiple sets of virtual supernodes;
[0088] Each virtual supernode represents a group of entity nodes with global relevance.
[0089] In S3, the steps for compressing long path structures include:
[0090] Based on the feature vectors corresponding to the virtual supernodes, calculate the spectral distance between any two virtual supernodes.
[0091] The spectral distance is used as the path weight or path length of the compressed long path;
[0092] Long paths in the original knowledge graph are uniformly mapped and represented by path weight or path length.
[0093] Specifically, after the low-resolution spectral layer is divided, the processor extracts the eigenvector submatrix corresponding to the low-resolution spectral layer: ;in, Representation and eigenvalues The corresponding feature vector, This represents the number of feature vectors contained in the low-resolution spectral layer.
[0094] The processor calculates the spectral similarity matrix between entity nodes based on the aforementioned eigenvector submatrices. ;in, ;in, Represents entity nodes With entity nodes Similarity in low-resolution spectral space and Representing entity nodes respectively With entity nodes Eigenvector representation in low-resolution spectral layers.
[0095] In obtaining the spectral similarity matrix Then, the processor performs clustering operations on the entity nodes based on the spectral similarity matrix, grouping entity nodes whose spectral similarity meets the preset aggregation conditions into the same node set. Each node set corresponds to a virtual supernode, which is used to represent the global correlation features reflected by the entity nodes in the low-resolution spectral layer.
[0096] Let the generated set of virtual supernodes be: ;in, Indicates the first A virtual supernode, This indicates the number of virtual supernodes. Each virtual supernode... With its contained set of entity nodes Correspondingly, each entity node belongs to only one virtual supernode.
[0097] In S3, the steps for compressing long path structures include the following:
[0098] After generating virtual supernodes, the processor calculates the spectral distance between virtual supernodes based on the spectral identifiers corresponding to the virtual supernodes. Specifically, for any two virtual supernodes... Its spectral distance is defined as: ;in, and Representing virtual supernodes and Indicator vector in virtual supernode space This represents the L2 norm operation.
[0099] The processor will determine the spectral distance. As a virtual supernode With virtual supernodes The path weights or path lengths between nodes are used to represent the equivalent path relationships of long paths composed of multiple entity nodes in the original knowledge graph under compressed representation. Based on this, for any long path in the original knowledge graph formed by sequentially connecting multiple entity nodes... ;in, This indicates the path length, which is determined by the processor based on the mapping relationship between physical nodes and virtual supernodes, mapping long paths to corresponding virtual supernode paths: ;in, Indicates the presence of entity nodes The virtual supernode. The connection weights between adjacent nodes in the virtual supernode path are determined by the corresponding spectral domain distance. express.
[0100] Through the above processing, the long paths in the original knowledge graph are uniformly mapped to compressed path representations based on virtual supernodes, and the compressed paths are used for subsequent relational reasoning calculations.
[0101] Furthermore, in S4, the steps for short-path inference based on local spectral smoothing include:
[0102] Calculate the local spectral smoothing matrix based on the sub-Laplace matrix corresponding to the high-resolution spectral layer;
[0103] The confidence level of the short path relationship is determined based on the element values of the corresponding entity node positions in the local spectral smoothing matrix.
[0104] Specifically, after the high-resolution spectral layers are divided, the processor extracts the eigenvector submatrices corresponding to the high-resolution spectral layers: ;in, Representation and eigenvalues The corresponding feature vector, Thresholds are set for spectral layer division. Based on the sub-matrix of the high-resolution spectral layer feature vectors, the sub-Laplace matrix corresponding to the high-resolution spectral layer is constructed: ;in, This represents the eigenvalue matrix of a high-resolution spectral layer.
[0105] The processor is based on the sub-Laplace matrix Calculate the local spectral smoothing matrix: ;in, For spectral smoothing parameters, Represents matrix exponentiation. Local spectral smoothing matrix. matrix elements Represents entity nodes With entity nodes Local smooth response values in high-resolution spectral space.
[0106] After the local spectral smoothing matrix is calculated, the processor performs matrix-based processing. The element values corresponding to the entity node positions are used to infer short-path relationships. For any two entity nodes that are directly or indirectly connected in the original knowledge graph with a finite number of hops... and The processor reads the corresponding matrix element values. And use the matrix element values as the representation of entity nodes. With entity nodes The numerical basis for the strength of the shortest path relationship.
[0107] The processor processes the matrix element values Normalization is performed to obtain the confidence value of the shortest path relationship: ;in, Represents entity nodes With entity nodes Confidence of short path relationship between Represents the local spectral smoothing matrix The maximum element value in the array.
[0108] Through the above processing, the local structural information reflected in the high-resolution spectral layer is used to infer the short-path relationship between entity nodes, and the confidence value is used as the input parameter for subsequent relationship inference and cross-spectral layer fusion.
[0109] Furthermore, in S5, the steps for calculating confidence based on spectral domain energy constraints include:
[0110] For any potential relationship, select a path from the corresponding set of compressed paths that satisfies the preset spectral energy constraint conditions;
[0111] Confidence scores for potential relationships are determined based on the selected path.
[0112] Specifically, after completing the long path compression process of S3, for any entity node to be reasoned about... and The processor obtains the set of compressed paths corresponding to the two in the compressed representation: ;in, This represents a compressed path consisting of a sequence of virtual supernodes. Indicates the number of compression paths.
[0113] The processor maps the compression path to the spectral domain, and for any compression path... Constructing path signal vectors And based on the feature vector sets of the low-resolution and high-resolution spectral layers, a spectral domain projection is performed on the path signal vector to obtain the path representation in the spectral domain: ;in, The eigenvector matrix represents the Laplacian matrix. Representing a path In the Projection coefficients on each spectral component.
[0114] After obtaining the spectral domain representation of the path, the processor calculates the spectral domain energy corresponding to the compressed path: ;in, Indicates the first The eigenvalues corresponding to each spectral component This indicates the energy contribution of the path to that spectral component.
[0115] The processor converts the spectral energy Compare with the preset spectral energy constraints and select those that meet the requirements. The compressed path is used as a valid path, where, This is a preset spectral energy threshold. Compressed paths that do not meet the spectral energy constraint are not included in subsequent confidence calculations.
[0116] After the valid path selection is completed, the processor uses the valid path set as a basis. Determine entity nodes With entity nodes The confidence score is the score representing the potential relationship between the paths. The confidence score is obtained by aggregating the spectral energies of the effective paths; the aggregation calculation is as follows:
[0117] ;
[0118] in, The confidence score represents the potential relationship between entity node i and entity node j. This indicates the number of valid paths.
[0119] Through the above processing, the paths in the compressed path whose spectral energy satisfies the constraints are used to calculate the confidence of potential relationships, thereby completing the relationship screening and confidence determination based on spectral energy constraints.
[0120] Furthermore, in S6, the steps for adaptively adjusting the fusion weights based on the spectral energy characteristics corresponding to each spectral layer to generate the final relational inference result include:
[0121] Inverse spectral transforms are performed on the inference results of the low-resolution and high-resolution spectral layers, respectively, to obtain the corresponding graph structure signals.
[0122] Calculate the cross-layer fusion weights based on the spectral norm or energy distribution characteristics of each spectral layer;
[0123] The graph structure signals are weighted and fused based on the fusion weights to generate the final relational reasoning results.
[0124] Specifically, after completing the relational inference calculations in the low-resolution and high-resolution spectral layers, the processor obtains the spectral domain inference result vectors corresponding to the low-resolution spectral layer. and the spectral domain inference result vector corresponding to the high-resolution spectral layer ;in, This represents the relational inference results obtained in the low-resolution spectral space. This represents the relational inference results obtained in the high-resolution spectral space. The processor performs inverse spectral transform operations on the spectral inference results respectively, mapping the spectral results back to the graph structure space. The graph structure signal corresponding to the low-resolution spectral layer is represented as follows: The graph structure signal corresponding to the high-resolution spectral layer is represented as: ;in, This represents the eigenvector matrix of the low-resolution spectral layer. This represents the eigenvector matrix of a high-resolution spectral layer. These represent relation signals obtained by reasoning from different spectral layers in the graph structure space.
[0125] After completing the inverse spectral transform, the processor calculates the cross-layer fusion weights based on the spectral energy characteristics corresponding to the low-resolution and high-resolution spectral layers. The spectral norms of the low-resolution and high-resolution spectral layers are calculated separately. ;in, This represents the eigenvalue matrix corresponding to the low-resolution spectral layer. This represents the eigenvalue matrix corresponding to the high-resolution spectral layer. This represents the 2-norm of a matrix.
[0126] Based on the spectral norm, the processor calculates the fusion weights corresponding to the low-resolution and high-resolution spectral layers: ;in, The fusion weights corresponding to the low-resolution spectral layers are represented. This represents the fusion weights corresponding to the high-resolution spectral layers, and satisfies... After obtaining the fusion weights, the processor performs weighted fusion of the graph structure signals corresponding to the low-resolution and high-resolution spectral layers based on the fusion weights to obtain the final relational inference result: ;in, This represents the final relational reasoning result in the graph structure space.
[0127] Through the above processing, the relational reasoning results obtained from different spectral layers are mapped to the same graph structure space, and weighted fusion is performed based on the spectral energy characteristics corresponding to each spectral layer, thereby generating relational reasoning results for output or subsequent processing.
[0128] Furthermore, in S7, the steps for performing incremental update operations on the affected spectral components include:
[0129] Detect the addition, deletion, or weight changes of nodes or relations in a knowledge graph, and construct the incremental change of the Laplacian matrix based on the changes;
[0130] Based on the incremental change of the Laplace matrix, the original eigenvalues and eigenvectors are approximately updated using perturbation theory;
[0131] Only the spectral components affected by the incremental change are recalculated, while the remaining spectral components remain unchanged, in order to reduce the overall computational cost.
[0132] Specifically, when the knowledge graph undergoes structural updates, the processor performs change detection on the graph structure data. This detection includes detecting the addition or deletion of entity nodes, the addition or deletion of relationships between entity nodes, and changes in the weights of existing relationships. Based on the detection results, the processor updates the adjacency matrix. Record the changes and construct the incremental changes in the adjacency matrix: ;in, Represents the adjacency matrix before the update. This represents the updated adjacency matrix.
[0133] The incremental change of the processor based on the adjacency matrix Incremental change of the degree matrix ;in, Represents entity nodes The change in degree value. Based on the incremental change, construct the incremental change of the Laplace matrix. ;in, This represents the change in the Laplacian matrix caused by updating the knowledge graph.
[0134] After obtaining the incremental change of the Laplace matrix, the processor approximates and updates the original eigenvalues and eigenvectors based on perturbation theory. For the original Laplace matrix... The eigenvalues and its corresponding eigenvectors The updated eigenvalues are approximately represented as follows: ;
[0135] in This represents the updated feature value. Simultaneously, the processor approximates the change in the feature vector based on the incremental change, and the updated feature vector is represented as: ;
[0136] in This represents the updated feature vector. Representation and eigenvalues The corresponding original feature vector.
[0137] After performing approximate updates to the eigenvalues and eigenvectors, the processor updates them based on the incremental changes. The distribution of non-zero elements is used to determine the set of spectral components affected by knowledge graph updates: ;in, This is the threshold used to determine the degree to which spectral components are affected.
[0138] For those belonging to the spectral component set The eigenvalues and eigenvectors are recalculated by the processor; for eigenvalues and eigenvectors that do not belong to the spectral component set, their original calculation results remain unchanged. Based on the above processing, recalculation is performed only on spectral components affected by knowledge graph updates, while other spectral components do not participate in the recalculation.
[0139] Through the above incremental update operation, the spectral component update process is completed under the condition of changes in the knowledge graph structure, so that subsequent relation reasoning calculations are performed based on the updated spectral decomposition results.
[0140] Example 2
[0141] In a second embodiment of the present invention, based on the same inventive concept, the present invention proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the knowledge graph relation reasoning optimization method of the above embodiments.
[0142] Example 3
[0143] In the third embodiment of the present invention, based on the same inventive concept, the present invention proposes a terminal, the terminal comprising: a processor and a memory; the processor and the memory communicate with each other; the memory is used to store instructions; the processor is used to execute the instructions in the memory to execute the knowledge graph relationship reasoning optimization method of the above embodiment.
[0144] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0145] Finally, it should be noted that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A knowledge graph relation reasoning optimization method, characterized in that, Includes the following steps: S1. The processor obtains the graph structure data corresponding to the knowledge graph and constructs a Laplace matrix based on the graph structure data; S2. The processor performs eigenvalue decomposition on the Laplacian matrix to obtain the corresponding eigenvalue set and eigenvector set, and divides the eigenvalue set into a low-resolution spectral layer and a high-resolution spectral layer according to a preset segmentation condition. S3. In the low-resolution spectral layer, multiple entity nodes are aggregated based on the similarity relationship between feature vectors to generate virtual super nodes in order to compress long path structures. S4. In the high-resolution spectral layer, short-path relationships between entity nodes are prioritized based on local spectral smoothing operations. S5. Calculate the confidence level of potential relationships based on the energy constraints of the path in the spectral domain; S6. Map the inference results of the low-resolution spectral layer and the high-resolution spectral layer back to the graph structure space through inverse spectral transformation, and adaptively adjust the fusion weights according to the spectral energy characteristics corresponding to each spectral layer to generate the final relational inference results. S7. When the knowledge graph is updated, incremental update operation is performed only on the spectral components affected by the update.
2. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S2, the step of dividing the feature value set into a low-resolution spectral layer and a high-resolution spectral layer according to a preset segmentation condition includes: Construct the Laplacian matrix of the undirected graph based on the adjacency matrix and degree matrix of the knowledge graph; Perform eigenvalue decomposition on the Laplacian matrix to obtain a set of eigenvalues sorted by their magnitude and a set of corresponding orthogonal eigenvectors. Based on a preset threshold or the statistical distribution characteristics of feature values, the feature value set is divided into a low-resolution spectral layer and a high-resolution spectral layer, wherein the low-resolution spectral layer is used to characterize global relational features and the high-resolution spectral layer is used to characterize local relational features. Spectral noise suppression processing was performed in both the low-resolution and high-resolution spectral layers.
3. The knowledge graph relation reasoning optimization method according to claim 2, characterized in that, In S2, the step of performing spectral noise suppression processing in the low-resolution spectral layer and the high-resolution spectral layer respectively includes: After completing the eigenvalue decomposition and obtaining the spectral coefficients, statistical analysis was performed on the spectral coefficients corresponding to the low-resolution and high-resolution spectral layers, respectively. Determine the corresponding spectral coefficient threshold based on the amplitude or energy distribution characteristics of the spectral coefficients; Spectral coefficients below the threshold are suppressed or filtered out to reduce the impact of noise spectral components on subsequent relational inference results.
4. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S3, the step of generating the virtual supernode includes: Calculate the spectral similarity matrix based on the eigenvectors corresponding to the low-resolution spectral layer; Clustering operations are performed based on the spectral similarity matrix to generate multiple sets of virtual supernodes; Each virtual supernode represents a group of entity nodes with global relevance.
5. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S3, the step of compressing the long path structure includes: Based on the feature vectors corresponding to the virtual supernodes, calculate the spectral distance between any two virtual supernodes. The spectral distance is used as the path weight or path length of the compressed long path; The long paths in the original knowledge graph are uniformly mapped and represented by the path weights or path lengths.
6. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S4, the step of performing short-path inference based on local spectral smoothing operation includes: Calculate the local spectral smoothing matrix based on the sub-Laplace matrix corresponding to the high-resolution spectral layer; The confidence level of the short path relationship is determined based on the element values of the corresponding entity node positions in the local spectral smoothing matrix.
7. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S5, the step of calculating the confidence level based on the spectral domain energy constraint includes: For any potential relationship, select a path from the corresponding set of compressed paths that satisfies the preset spectral energy constraint conditions; The confidence score of the potential relationship is determined based on the selected path.
8. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S6, the step of adaptively adjusting the fusion weights based on the spectral energy characteristics corresponding to each spectral layer to generate the final relational inference result includes: Inverse spectral transforms are performed on the inference results of the low-resolution and high-resolution spectral layers, respectively, to obtain the corresponding graph structure signals. Calculate the cross-layer fusion weights based on the spectral norm or energy distribution characteristics of each spectral layer; The graph structure signals are weighted and fused based on the fusion weights to generate the final relational reasoning result.
9. The knowledge graph relation reasoning optimization method according to claim 1, characterized in that, In S7, the step of performing incremental update operations on the spectral components affected by the update includes: Detect the addition, deletion, or weight change of nodes or relations in a knowledge graph, and construct the incremental change of the Laplace matrix based on the changes; Based on the incremental change of the Laplace matrix, the original eigenvalues and eigenvectors are approximately updated using perturbation theory; Only the spectral components affected by the incremental change are recalculated, while the remaining spectral components remain unchanged, in order to reduce the overall computational cost.
10. A computer device comprising a processor and a memory, characterized in that, The memory stores a computer program, which, when executed by the processor, is used to implement the knowledge graph relation reasoning optimization method as described in any one of claims 1 to 9.