A power knowledge graph question answering method based on hierarchical community detection
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-08-11
AI Technical Summary
[0005]本发明旨在解决大规模电力知识图谱场景下智能问答面临的关键技术问题,即如何实现高效、准确且可追溯的问答能力,并弥补传统RAG方法在检索过程中存在的碎片化、效率低以及答案不可追溯等不足
本发明通过分层社区检测和逐层过滤策略,逐步收缩候选知识范围,减少无关节点遍历及冗余运算,提升了电力知识图谱问答的检索效率与响应速度。基于社区结构化摘要与用户问题语义向量的匹配机制,提高了复杂问题理解的准确性和答案生成的相关性。采用Map-Reduce架构融合多社区信息,保障最终回答的完整性。同时,在最终回答中附加实体列表与关系路径,使答案来源清晰可追溯,增强系统回答的可解释性,有效弥补传统检索增强生成方法中知识碎片化及答案来源难以追溯的不足。
Smart Images

Figure CN122547952A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph question answering, and more particularly to a power knowledge graph question answering method based on hierarchical community detection. Background Technology
[0002] The rapid development of digital technology is driving the evolution of power systems towards greater complexity and intelligence. Vast amounts of professional knowledge have become crucial resources supporting daily operations, fault diagnosis, and decision-making. Both power industry experts and maintenance personnel urgently need an efficient and accurate tool to acquire, organize, and manage this knowledge.
[0003] Traditional question-answering methods generally suffer from insufficient natural language understanding, imprecise semantic relationship characterization, and inflexible knowledge update mechanisms when dealing with complex query tasks in the power sector, thus failing to meet practical application needs. Specifically, while rule-based methods offer strong interpretability, they have high maintenance costs and limited knowledge coverage; text retrieval-based methods struggle to accurately identify semantically similar but significantly different query intents; and general-purpose deep learning models are limited by a lack of high-quality domain-specific labeled data and insufficient generalization ability in specialized domains, leaving considerable room for improvement in their application performance in power scenarios.
[0004] Knowledge graphs (KGs), as a structured knowledge representation method, can organize entities, relationships, and attributes through graph structures and perform associative modeling of professional information such as equipment topology, fault modes, and operating procedures in power systems. This provides reliable knowledge support for question-answering systems, improving the accuracy and interpretability of answer generation. However, when facing natural language queries, existing knowledge graph question-answering methods still suffer from problems such as large retrieval scope, low matching efficiency, insufficient ability to recognize complex semantic relationships, and unclear answer sources, which limits the efficiency of knowledge retrieval and the reliability of answers. In recent years, large language models (LLMs) have demonstrated strong capabilities in natural language understanding, semantic reasoning, and text generation, providing a new technical path for the development of intelligent question-answering systems. Retrieval-Augmented Generation (RAG) technology, by introducing external knowledge retrieval results before answer generation, can alleviate, to some extent, the problems of untimely knowledge updates, insufficient domain knowledge, and unstable generated content in large language models. However, traditional RAG methods typically rely on text fragment or vector similarity retrieval. When faced with complex entity relationships and multi-hop related queries in the power knowledge graph, they are prone to problems such as fragmented knowledge retrieval, incomplete coverage of relevant information, and difficulty in tracing the source of answers. Therefore, there is an urgent need for an intelligent question-answering method in the power field that integrates large language models, knowledge graphs, and retrieval enhancement generation technologies to improve the ability to understand complex queries, retrieve professional knowledge, and generate accurate answers. Summary of the Invention
[0005] This invention aims to solve the key technical problems faced by intelligent question answering in the context of large-scale power knowledge graphs, namely, how to achieve efficient, accurate and traceable question answering capabilities, and to make up for the shortcomings of traditional RAG methods in the retrieval process, such as fragmentation, low efficiency and lack of traceability of answers.
[0006] To achieve the above objectives, this invention provides a power knowledge graph question-answering method based on hierarchical community detection, comprising the following steps: S1. Based on the constructed power knowledge graph, assign type weights to entities and association weights to relationships to obtain a weighted set of entities and a set of relationships. S2. Based on the weighted entity set and relation set, the Leiden algorithm is used to perform three-level community detection on the weighted knowledge graph to generate a hierarchical community structure; S3. Based on the hierarchical community structure, generate structured summaries for each level of the community, and integrate the community hierarchy information to generate community semantic vectors; S4. Based on the semantic vector of the community and the user's question, a layer-by-layer filtering strategy is used to locate the target community. Based on the summary information and entity relationship path within the target community, the final answer is generated through the Map-Reduce architecture.
[0007] Preferably, in step S1, the steps of obtaining the weighted entity set and relation set include: Based on the power knowledge graph, read the entity nodes and relationship edges; Based on the predefined weight mapping table, assign corresponding weights to entities and relationships respectively; Based on the weighted entities and relationships, deduplication is performed to obtain a weighted set of entities and a set of relationships.
[0008] Preferably, in step S2, the step of generating the hierarchical community structure includes: Construct a graph structure with edge weights based on the weighted set of entities and the set of relations; Based on the graph structure, perform first-level community detection on the complete knowledge graph to generate first-level communities; Based on the primary community, a secondary community detection is performed within each primary community to generate a secondary community; Based on the secondary communities, a third-level community check is performed within each secondary community to generate a third-level community, resulting in a hierarchical community structure.
[0009] Preferably, in step S3, the step of generating a structured summary for each level of community includes: Based on the hierarchical community structure, a bottom-up aggregation strategy is adopted, starting from the lowest level community and aggregating upwards to generate a structured summary for each community. Each community's structured summary includes a community title, a core overview, and a list of key facts.
[0010] Preferably, in step S3, the step of generating a community semantic vector by fusing community-level information includes: Based on the structured summary of each community, the community title, core overview, and list of key facts are concatenated into a unified text; Based on the unified text, the embedding model is invoked to generate semantic vectors, which are then normalized to obtain the community semantic vectors.
[0011] Preferably, in step S4, the step of locating the target community using a layer-by-layer filtering strategy includes: Based on the user's question, the embedded model is invoked to convert it into a query vector; Based on the query vector and the community semantic vector, similarity is calculated layer by layer starting from the highest level community. For the first-level community, candidate communities are determined directly based on their similarity to the query vector. For non-first-level communities, the similarity of the current level is weighted and fused with the similarity of the previous level, and communities whose weighted scores meet the preset conditions are used as the search scope for the next level. The search scope is narrowed down step by step using the above method until the target community is located.
[0012] Preferably, in step S4, the step of generating the final answer using the Map-Reduce architecture includes: Based on the target community, generate local answers for each target community during the Map phase; Based on the local responses, all local responses are merged into a global response during the Reduce phase, which serves as the final response.
[0013] Preferably, in step S4, after generating the final answer, the following is also included: Based on the final answer, the information sources will be attached to the final answer, including a list of relevant entities and entity relationship paths.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention improves the retrieval efficiency and response speed of power knowledge graph question answering by gradually narrowing the candidate knowledge range through hierarchical community detection and layer-by-layer filtering strategies, reducing traversal of irrelevant nodes and redundant calculations. Based on a matching mechanism between community structured summaries and user question semantic vectors, it enhances the accuracy of understanding complex questions and the relevance of answer generation. A Map-Reduce architecture is employed to fuse information from multiple communities, ensuring the completeness of the final answer. Furthermore, entity lists and relationship paths are appended to the final answer, making the answer source clear and traceable, enhancing the interpretability of the system's answers, and effectively compensating for the shortcomings of traditional retrieval enhancement generation methods, such as knowledge fragmentation and difficulty in tracing the source of answers. Attached Figure Description
[0015] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 A flowchart illustrating the power knowledge graph question answering method based on hierarchical community detection provided in an embodiment of the present invention; Figure 2 This is a structural block diagram of a power knowledge graph question-answering system based on hierarchical community detection, provided in an embodiment of the present invention. Detailed Implementation
[0017] The technical solutions of 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.
[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0019] Example 1 like Figures 1-2 As shown, this embodiment proposes a power knowledge graph question answering method based on hierarchical community detection, the steps of which include: S1. Based on the constructed power knowledge graph, assign type weights to entities and association weights to relationships to obtain a weighted set of entities and a set of relationships.
[0020] Furthermore, the steps in this embodiment include: Read the constructed power knowledge graph from the graph database. The knowledge graph contains entity nodes and relation edges. Assign type weights to each entity according to a predefined entity type weight mapping table; Assign association weights to each relationship based on a predefined relationship association weight mapping table; Remove duplicates from entities by name and from relations by the <source entity, relation type, target entity> triple.
[0021] More specifically, in this embodiment, the constructed power knowledge graph is read from the Neo4j graph database. The entity type weight mapping table includes: equipment entities with a weight of 1.2, procedure entities with a weight of 1.1, organization entities with a weight of 1.1, standard entities with a weight of 1.0, location entities with a weight of 1.0, personnel entities with a weight of 1.0, fault entities with a weight of 0.9, protection entities with a weight of 0.9, alarm entities with a weight of 0.9, event entities with a weight of 0.9, parameter entities with a weight of 0.8, and other types of entities with a weight of 0.5. The relationship association weight mapping table includes: causal relationship with a weight of 0.9, disposal relationship with a weight of 0.9, connection relationship with a weight of 0.85, trigger relationship with a weight of 0.85, attribution relationship with a weight of 0.8, configuration relationship with a weight of 0.8, reference relationship with a weight of 0.75, monitoring relationship with a weight of 0.7, spatial relationship with a weight of 0.6, temporal relationship with a weight of 0.5, and other types of relationships with a weight of 0.5. After the weights are assigned, entities are deduplicated by name, and relationships are deduplicated by triples to ensure data uniqueness.
[0022] S2. Based on the weighted entity set and relation set, the Leiden algorithm is used to perform three-level community detection on the weighted knowledge graph to generate a hierarchical community structure.
[0023] Furthermore, this step includes: Entity nodes and relation edges are read from the graph database to construct the igraph graph structure, and entity type weights are used as node weight parameters and relation association weights are used as edge weight parameters. Perform Level 1 community detection on the complete knowledge graph to generate Level 1 communities; Within each primary community, a subgraph is constructed, and community checks are re-performed on the subgraphs to generate secondary communities; Within each secondary community, a subgraph is constructed, and community checks are re-performed on the subgraphs to generate a tertiary community.
[0024] More specifically, in this embodiment, firstly, entity node and relation edge data are read to complete the graph structure construction, and entity type weights are used as node weights, while relational weights are used as edge weights and introduced into the graph model. Then, a first-level community division is performed on the overall graph, forming several first-level communities. Each first-level community corresponds to a core business area, such as substation operation and maintenance, line operation and maintenance, and dispatch management. Next, corresponding subgraphs are extracted within each first-level community, and community division is further performed on the subgraphs to obtain second-level communities. Each second-level community corresponds to a more specific business module, such as setting principles, operation instructions, and fault handling regulations. Based on this, subgraphs are constructed for each second-level community, and further fine-grained community division is performed to form third-level communities. Each third-level community corresponds to a specific business unit, such as bus protection and transformer protection. For second-level communities with no more than 10 entities, further subdivision is not performed, and the second-level community is directly determined as the lowest-level community.
[0025] Furthermore, the process of generating structured summaries for each community level and fusing community-level information to generate community semantic vectors includes: A bottom-up aggregation strategy is used to generate structured summaries of communities at all levels; Each community's structured summary includes three parts: community title, core overview, and a list of key facts; The title, core overview, and list of key facts for each community are concatenated into a unified text, and an embedding model is used to generate semantic vectors.
[0026] More specifically, in this embodiment, the community structured summary is generated through a large language model. Each summary contains three parts: a community title, which concisely summarizes the core characteristics of the community, such as "Community for Handling Cross-Section and Equipment Overload Faults"; a core overview, describing the business scenarios, core entities, and key relationships covered by the community; and a list of key facts, extracting high-frequency and core entity-relationship pairs within the community to provide core knowledge support for subsequent question answering. The summary generation adopts a bottom-up three-level aggregation strategy: first, a summary is generated independently for each third-level community (micro-community); then, second-level community summaries are generated based on the third-level community summaries, extracting and merging key facts from each sub-community; finally, first-level community summaries are generated based on the second-level community summaries. Simultaneously, a global summary is generated to statistically analyze the number of entities and community distribution across the entire graph. After summary generation, the title, core overview, and list of key facts for each community are concatenated into a unified text, and an embedding model is used to generate semantic vectors. The semantic vectors are then processed... L 2. Normalization processing facilitates subsequent similarity calculations. The semantic vectors of all communities are constructed into matrix form and stored in a vector database to support fast retrieval.
[0027] S3. Based on the hierarchical community structure, generate structured summaries for each level of the community, and integrate the community hierarchy information to generate community semantic vectors.
[0028] Furthermore, this step includes: The embedded model is invoked to convert the user's question into a query vector; Calculate the cosine similarity between the query vector and the semantic vectors of all first-level communities within each community, and select the top communities with the highest similarity. N One primary community was used as the coarse positioning result; In the coarsely located first-level communities, the similarity is recalculated among the second-level communities. This similarity is then combined with the similarity from the higher-level communities for weighted fusion, and the communities with the highest weighted scores are selected. M The secondary communities were used as the precise positioning results; The similarity is recalculated again among the third-level communities under the precisely positioned second-level communities, and a three-level weighted fusion is performed to select the top communities with the highest weighted scores. K The three-level communities serve as the final micro-location target community set.
[0029] More specifically, in this embodiment, the layer-by-layer filtering strategy adopts a three-level layer-by-layer filtering process of "coarse positioning → fine positioning → micro positioning". First, the cosine similarity between the query vector and the semantic vectors of all first-level communities is calculated in the first-level community. L 1 sim Select the first one with the highest similarity N indivual( N =3) The first-level community is used as the coarse localization result. Then, the similarity is recalculated in the second-level communities under the coarsely localized first-level community.L 2 sim The similarity between the two is weighted and fused using the following formula: Select the top score with the highest weighted score M indivual( M =5) The second-level communities serve as the refined localization results. Finally, the similarity is calculated again within the third-level communities under the refined localized second-level communities. L 3 sim A three-layer weighted fusion is performed, and the weighting formula is as follows: Select the top score with the highest weighted score K indivual( K =3) The three-level community serves as the final target community set. The advantages of the layer-by-layer filtering strategy are: First, it gradually narrows the search scope, reducing the traversal of irrelevant nodes and redundant calculations; second, through a weighted fusion strategy, it considers both the semantic coverage of the upper-level community and the precise matching of the lower-level community; third, it supports multi-level search, allowing users to gradually delve into specific entities from the global perspective.
[0030] S4. Based on the semantic vector of the community and the user's question, a layer-by-layer filtering strategy is used to locate the target community. Based on the summary information and entity relationship path within the target community, the final answer is generated through the Map-Reduce architecture.
[0031] Furthermore, this step includes: Map phase: For each target community, collect community summary information, find relevant entities and their relationship paths within the community, and assemble the community summary information and entity relationship paths into prompt words to input into the large language model to generate local answers; Reduce phase: Assemble all local responses and entity relationship paths into fusion prompt words, input them into the large language model to generate a global response; The final answer should include a section on the sources of information, including a list of relevant entities and the paths of entity relationships.
[0032] More specifically, in this embodiment, the Map phase performs the following operations for each target community: collecting community summary information (title, core overview, key facts), finding relevant entities and their relationship paths within the community, assembling the community summary information and entity relationship paths into prompt words and inputting them into the large language model to generate a local answer, while simultaneously recording the relevant entities and entity relationship paths involved in the local answer. The search for entity relationship paths adopts a single-hop search strategy; after constructing the adjacency list, only edges where both the source and target are in the community entity list are retained, and the path is presented in the format of "source entity → [relationship type] → target entity". The Reduce phase assembles all local answers and entity relationship paths generated in the Map phase into fusion prompt words and inputs them into the large language model to generate a global answer. The fusion prompt words include the following parts: user question, multiple local answer lists, entity relationship path lists, and fusion instructions. The large language model deduplicates, sorts, and logically reorganizes multiple local answers according to the fusion instructions to generate a coherent and accurate global answer. An information source section is appended to the final answer, including a list of relevant entities and entity relationship paths. Users can click on the entity name to view detailed information and click on the relationship path to view the complete reasoning chain, achieving traceability and explainability of the answer.
[0033] More specifically, in this embodiment, based on the constructed power knowledge graph, the proposed power knowledge graph question answering method based on hierarchical community detection follows this process: First, based on the constructed power knowledge graph, business weights are assigned to entities and relationships; second, the Leiden algorithm is used to perform three-level community detection on the weighted knowledge graph, generating a hierarchical structure of "Level 1 Community (Global Community) → Level 2 Community (Sub-community) → Level 3 Community (Micro-community)"; then, a structured summary and semantic vector are generated for each community to construct a community semantic index; finally, user questions are received, a layer-by-layer filtering strategy is used to locate the target community, and the final answer is generated through a Map-Reduce architecture based on the summary information and entity relationship paths within the target community.
[0034] Example 2 This embodiment is implemented using Python 3.12. It selects QwQ-32B as the core model for answer generation, Qwen3-Embedding-0.6B as the semantic vector generation model, Neo4j as the graph database, and igraph and leidenalg as community detection algorithm libraries. Figure 1 As shown, the method process of this embodiment is as follows.
[0035] Step 1: Based on the constructed power knowledge graph, assign type weights to entities and association weights to relationships; Step 1.1: Read the constructed power knowledge graph from the Neo4j graph database, which contains entity nodes and relation edges; Step 1.2: Assign type weights to each entity according to the predefined entity type weight mapping table: Equipment 1.2, Procedure 1.1, Organization 1.1, Standard 1.0, Location 1.0, Personnel 1.0, Fault 0.9, Protection 0.9, Alarm 0.9, Event 0.9, Parameter 0.8, Other 0.5; Step 1.3: Assign association weights to each relationship according to the predefined relationship association weight mapping table: causality 0.9, action 0.9, connection 0.85, trigger 0.85, attribution 0.8, configuration 0.8, reference 0.75, monitoring 0.7, space 0.6, time 0.5, and other 0.5. Step 1.4: Deduplicate entities by name and relationships by <source entity, relationship type, target entity> triples to ensure data uniqueness.
[0036] Step 2: Use the Leiden algorithm to perform three-level community detection on the weighted knowledge graph; Step 2.1: Read entity nodes and relationship edges from the graph database, construct the igraph graph structure, and use entity type weights as node weight parameters and relationship association weights as edge weight parameters; Step 2.2: First-level community detection: Execute the Leiden algorithm on the complete knowledge graph, call the community_leiden function to generate first-level communities (global communities), and each first-level community corresponds to a core business domain; Step 2.3: Second-level community detection: Construct a subgraph within each first-level community, re-execute the community_leiden function to generate second-level communities (sub-communities), and each second-level community corresponds to a specific business module; Step 2.4: Third-level community detection: Construct a subgraph within each second-level community, re-execute the community_leiden function to generate third-level communities (micro-communities), and do not further subdivide second-level communities with no more than 10 entities; Step 2.5: When the community detection algorithm malfunctions, a fault-tolerant scheme is adopted, treating each entity as an independent community.
[0037] Step 3: Generate a structured summary and semantic vector for each community, and construct a community semantic index; Step 3.1: Use a bottom-up aggregation strategy to generate structured summaries for each level of community. First, generate a summary for each third-level community independently. Then, aggregate the third-level community summaries to generate second-level community summaries. Finally, aggregate the second-level community summaries to generate first-level community summaries. Step 3.2: The structured summary for each community includes three parts: community title, core overview, and a list of key facts; Step 3.3: Concatenate the title, core overview, and key fact list of each community into a unified text, and call the Qwen3-Embedding-0.6B embedding model to generate a 1024-dimensional semantic vector; Step 3.4: Process the generated semantic vectors L 2. Normalize the data, construct it into a matrix form, and store it in a vector database; Step 3.5: When the embedded model call fails, a fault-tolerant scheme is adopted to generate a simplified summary based on the entity information within the community.
[0038] Step 4: Receive user questions and use a layer-by-layer filtering strategy to locate the target community; Step 4.1: Use the embedded model to convert the user question into a query vector; Step 4.2: Coarse localization: Calculate the cosine similarity between the query vector and the semantic vectors of all first-level communities in the first-level community, and select the top 3 first-level communities with the highest similarity as the coarse localization results; Step 4.3: Fine-tuning: Recalculate the similarity among the second-level communities under the first-level community identified by coarse-tuning, and perform weighted fusion by combining the similarity from the higher-level community. The weighting formula is as follows: , The top 5 secondary communities with the highest weighted scores were selected as the precise positioning results; Step 4.4: Micro-location: Calculate the similarity again within the third-level communities under the precisely located second-level communities, and perform a three-layer weighted fusion. The weighting formula is as follows: , The top three third-level communities with the highest weighted scores were selected as the final target community set. Step 4.5: When the embedding model call fails, a text matching fault tolerance scheme is adopted, and the text relevance score between the user question and the community summary is calculated by keyword matching.
[0039] Step 5: Based on the summary information and entity relationship paths within the target community, generate the final answer using a Map-Reduce architecture; Step 5.1: Mapping Phase: For each target community, collect community summary information (title, core overview, key facts) and find relevant entities and their relationship paths within the community; Step 5.2: Assemble the community summary information and entity relationship paths into prompt words, input them into the large language model to generate local answers, and record the relevant entities and entity relationship paths involved in the local answers; Step 5.3: The entity relationship path is found using a single-hop search strategy. After constructing the adjacency list, only edges where both the source and target are in the community entity list are retained. The path is presented in the format of "source entity → [relationship type] → target entity". Step 5.4: Reduce phase: Assemble all local answers and entity relationship paths into fusion prompts, input them into the large language model to generate a global answer. The fusion prompts are required to ensure that the answer is comprehensive, covers all relevant information, and is fluent and natural in language. Step 5.5: If there is only one target community, directly output a portion of the community's answers as the final answer to save costs; Step 5.6: When the large language model call fails, the Map phase fault tolerance is to return the community overview text, and the Reduce phase fault tolerance is to simply concatenate the text.
[0040] Step 6: Attach an information source section to the final answer, including a list of relevant entities and the path of entity relationships, to make the answer traceable and explainable.
[0041] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A question-answering method for power knowledge graphs based on hierarchical community detection, characterized in that, Includes the following steps: S1. Based on the constructed power knowledge graph, assign type weights to entities and association weights to relationships to obtain a weighted set of entities and a set of relationships. S2. Based on the weighted entity set and relation set, the Leiden algorithm is used to perform three-level community detection on the weighted knowledge graph to generate a hierarchical community structure. S3. Based on the hierarchical community structure, generate structured summaries for each level of the community, and integrate the community hierarchy information to generate community semantic vectors; S4. Based on the semantic vector of the community and the user's question, a layer-by-layer filtering strategy is used to locate the target community. Based on the summary information and entity relationship path within the target community, the final answer is generated through the Map-Reduce architecture.
2. The power knowledge graph question-answering method based on hierarchical community detection according to claim 1, characterized in that, In step S1, the steps of obtaining the weighted entity set and relation set include: Based on the power knowledge graph, read the entity nodes and relationship edges; Based on the predefined weight mapping table, assign corresponding weights to entities and relationships respectively; Based on the weighted entities and relationships, deduplication is performed to obtain a weighted set of entities and a set of relationships.
3. The power knowledge graph question-answering method based on hierarchical community detection according to claim 1, characterized in that, In step S2, the step of generating the hierarchical community structure includes: Construct a graph structure with edge weights based on the weighted set of entities and the set of relations; Based on the graph structure, perform first-level community detection on the complete knowledge graph to generate first-level communities; Based on the primary community, a secondary community detection is performed within each primary community to generate a secondary community; Based on the secondary communities, a third-level community check is performed within each secondary community to generate a third-level community, resulting in a hierarchical community structure.
4. The power knowledge graph question-answering method based on hierarchical community detection according to claim 1, characterized in that, In step S3, the step of generating a structured summary for each level of community includes: Based on the hierarchical community structure, a bottom-up aggregation strategy is adopted, starting from the lowest level community and aggregating upwards to generate a structured summary for each community. Each community's structured summary includes a community title, a core overview, and a list of key facts.
5. The power knowledge graph question-answering method based on hierarchical community detection according to claim 1, characterized in that, In step S3, the step of generating a community semantic vector by fusing community-level information includes: Based on the structured summary of each community, the community title, core overview, and list of key facts are concatenated into a unified text; Based on the unified text, the embedding model is invoked to generate semantic vectors, which are then normalized to obtain the community semantic vectors.
6. The power knowledge graph question-answering method based on hierarchical community detection according to claim 1, characterized in that, In step S4, the step of locating the target community using a layer-by-layer filtering strategy includes: Based on the user's question, the embedded model is invoked to convert it into a query vector; Based on the query vector and the community semantic vector, similarity is calculated layer by layer starting from the highest level community. For the first-level community, candidate communities are determined directly based on their similarity to the query vector. For non-first-level communities, the similarity of the current level is weighted and fused with the similarity of the previous level, and communities whose weighted scores meet the preset conditions are used as the search scope for the next level. The search scope is narrowed down step by step using the above method until the target community is located.
7. The power knowledge graph question-answering method based on hierarchical community detection according to claim 1, characterized in that, In step S4, the steps for generating the final answer using the Map-Reduce architecture include: Based on the target community, generate local answers for each target community during the Map phase; Based on the local responses, all local responses are merged into a global response during the Reduce phase, which serves as the final response.
8. The power knowledge graph question-answering method based on hierarchical community detection according to claim 7, characterized in that, In step S4, after generating the final answer, the following is also included: Based on the final answer, the information sources will be attached to the final answer, including a list of relevant entities and entity relationship paths.