A method for constructing and searching an electricity graph database based on graph theory

Through the power graph database construction method based on graph theory, the problem of low efficiency in massive power knowledge management in the power system is solved, efficient storage and intelligent search of power data are realized, and the knowledge management capabilities of the power system are improved.

CN114153821BActive Publication Date: 2025-08-29SOUTHEAST UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111510601.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-11
Publication Date
2025-08-29
Estimated Expiration
2041-12-11

AI Technical Summary

Technical Problem

The existing knowledge management system cannot efficiently organize and manage massive, rapidly updated power system knowledge in the power system. The traditional knowledge base is time-consuming and inefficient, and the Neo4j graph database is not efficient when handling complex search tasks.

Method used

Based on graph theory, a power graph database is constructed, and by analyzing the power grid, a Boolean adjacency matrix and a two-dimensional floating point numerical matrix are established, and a triple format is used to store user power data. An adjacency matrix and reachable matrix are used for accurate and wide-area search and statistics are achieved to achieve intelligent and fast search.

Benefits of technology

It realizes lightweight storage and intelligent and fast search of power data, greatly shortened search time, rich functions, significantly better than Neo4j, and is suitable for intelligent knowledge management of power systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153821B_ABST
    Figure CN114153821B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for constructing and searching an electricity graph database based on graph theory, which relates to the technical field of power systems. The method first proposes a method for constructing a graph database of electricity data based on graph theory, extracts data into a triple form of "entity-relationship-entity", and stores it by an index matrix, an adjacency matrix, and a two-dimensional floating-point numerical matrix of user-time-electricity. Secondly, an intelligent search method based on a self-built database is constructed; the properties of the adjacency matrix and the principle of the reachable matrix are used to implement intelligent searches of various functions including precise search, wide-area search, wide-area statistics, and superior and subordinate statistics. Finally, it is verified through examples that the method can effectively manage large amounts of electricity data, realize richer search functions than traditional online power grids, and significantly reduce search time. It is significantly better than the open source database Neo4j in terms of search time efficiency, and has good practical application and promotion value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of power systems, and in particular relates to a method for constructing and searching an electricity graph database based on graph theory. Background Art

[0002] The power system is massive and complex. With the advancement of informatization and the expansion of power services, massive amounts of data and knowledge are constantly being generated across all production and service links—power generation, transmission, transformation, distribution, and consumption—resulting in explosive growth in the total amount of knowledge within the system. This new knowledge within the power system exhibits complex and volatile characteristics: complex knowledge structures, an ever-increasing amount of heterogeneous knowledge, rapid knowledge evolution, and decreasing frequency of updates. Faced with this rapidly increasing volume of new knowledge within the power system, traditional approaches to knowledge organization and management are no longer adequate.

[0003] Currently, knowledge bases based on knowledge representation and reasoning are widely used in power systems. However, most of these knowledge bases rely on traditional knowledge management methods, where experts extract, organize, and store data in databases in the form of graphs. The knowledge structure they can store is relatively simple, and each update requires a significant amount of time from professional technicians. Existing knowledge management methods are particularly lagging behind the development needs of the system, especially in areas with rapidly changing knowledge, such as power dispatching, equipment management, data interaction, and business queries. Power systems urgently need new, automated, and intelligent methods and tools for organizing, storing, extracting, and reasoning knowledge.

[0004] To achieve effective knowledge organization and management, research has introduced knowledge graph technology, widely used in the computer field in recent years, into the power system field. A knowledge graph is a knowledge base that represents entities and their relationships in the objective world in the form of a graph. It is a symbolic representation of knowledge in the era of big data artificial intelligence. It can effectively organize, manage, and utilize massive amounts of information, enabling intelligent knowledge extraction, reasoning, storage, and retrieval. Its characteristics and application scenarios are highly compatible with the needs of power systems.

[0005] Currently, knowledge graphs are primarily built on the Neo4j graph database. A graph database is a new type of database that goes beyond SQL (Structured Query Language). It uses a graph-based modeling approach, with data primarily represented by nodes and edges. Graph databases leverage the natural extensibility of graph structures to solve a range of complex design problems. Neo4j is a popular graph database offering rich relational representations, comprehensive transaction support and database operations, and more intuitive data presentation. Neo4j operates using Cypher, a language specifically designed for graph databases. It is easy to understand and expressive, drawing on SQL constructs. Queries are implemented and operations are expressed using SQL-like statement combinations such as MATCH, WHERE, and DELETE. For simple searches involving small amounts of data, Neo4j can efficiently query and update graph data. However, for complex searches requiring massive amounts of data, Neo4j suffers from inefficiencies and excessive processing times. Summary of the Invention

[0006] In view of the deficiencies in the prior art, the present invention aims to provide a method for constructing and searching an electricity graph database based on graph theory, so as to solve the problems raised in the above background technology.

[0007] The purpose of the present invention can be achieved through the following technical solutions:

[0008] A method for constructing and searching an electricity graph database based on graph theory includes the following steps:

[0009] Step 1: By analyzing the composition and structural characteristics of power grid electricity data, the data is preprocessed, and a Boolean adjacency matrix describing the relationship between users, industry types, and regions is calculated. A two-dimensional floating-point numerical matrix storing users' electricity consumption data at different times is constructed to build an electricity map database.

[0010] Step 2: Based on the electricity map database, the reachability matrix describing the indirect relationship between users, industries, and regions is calculated through the adjacency matrix. Search is performed based on the adjacency matrix and the reachability matrix to obtain the search results.

[0011] As a further solution of the present invention, in step 1, data is exported through the power grid system, and the data includes user electricity consumption data, and any of the user electricity consumption data includes user number, industry, electricity consumption, management area, and time unit.

[0012] As a further solution of the present invention, in step 1, the user electricity consumption data is extracted into a triple format of "entity-relationship-entity", and the triple format is used as the basic form of data for processing. The entities are regarded as points in the graph, and the relationships are regarded as edges in the graph to construct a corresponding electricity statistics knowledge graph.

[0013] As a further solution of the present invention, after extracting user electricity usage data into "entity-relationship-entity" triples, it is categorized and stored based on the actual data characteristics. Each data type is stored using a unique storage method. The data categories and corresponding storage methods include the following three types: Boolean adjacency matrix, index matrix, and two-dimensional floating-point matrix. The adjacency matrix is ​​used to store the relationships between regions, industries, and users. The user's electricity usage data at different times is stored using a two-dimensional floating-point matrix. The correspondence between the numbers and entity names in the two-dimensional floating-point matrix is ​​stored using an index matrix.

[0014] As a further solution of the present invention, a region-industry-user graph is established, and an index matrix is ​​established using the following formula:

[0015]

[0016] Among them, I area , I indus , I user They are the indexes of region, industry and user respectively; 、 、 The names of regions, industries, and users respectively; 、 、 The index numbers corresponding to regions, industries, and users respectively; N area 、N indus 、N user They are the number of regions, industries, and users respectively;

[0017] Assuming that the number of nodes in the region-industry-user graph is N, we have:

[0018]

[0019] At this time, the order of the node adjacency matrix A is N×N, the diagonal elements in A are 0, and the non-diagonal elements are defined as the connection relationship between nodes u and v established through branches, so the elements in A are Expressed as:

[0020]

[0021] For the user-time-data relationship, first create a separate index I for time using the following formula: data :

[0022]

[0023] Among them, I data is a separate index for time, It is an eight-bit time code. is the index number corresponding to the time;

[0024] Based on the time index, a two-dimensional floating-point value matrix is ​​used to store the user-time-data relationship. Let its matrix form be B:

[0025]

[0026] in, is the electricity consumption of the corresponding user on the corresponding date, m The index number corresponding to the user, n The corresponding index number of the corresponding date.

[0027] As a further solution of the present invention, four search models are constructed: precise search, wide-area search, wide-area statistics, and superior and subordinate search:

[0028] 1) Precise search:

[0029] According to the user number and date, the index number corresponding to the user and time in the index list is obtained by the following formula:

[0030]

[0031]

[0032] in, indexuser i 、indexdata s are the user and time series index numbers obtained through retrieval respectively;

[0033] After obtaining the index number of the user and time, the specific power consumption data is obtained by indexing in the two-dimensional floating-point value matrix of user-time-power using the following formula:

[0034]

[0035] in, The electricity consumption data obtained is the desired search target;

[0036] 2) Wide-area search:

[0037] For a directed graph, the elements of the reachability matrix R are calculated using the following formula to obtain the reachability matrix R:

[0038]

[0039] Specifically, when performing a wide-area search, first obtain the region and industry numbers using the following formula:

[0040]

[0041]

[0042] Secondly, we use the formula to find the specific non-zero elements in the reachable matrix to obtain the user index under the region and industry:

[0043]

[0044]

[0045]

[0046] in, areauser s The index number of users in a specific region. indususer s The index number of users under a specific industry is obtained. Finally, the user number of the wide-area search is obtained by taking the intersection of users under a specific industry and region. indexuser s , and then use the formula to read specific row and column data in the two-dimensional floating-point value matrix of user-time-power:

[0047]

[0048] in The power data read is the target of wide-area search; indexdata s is a time index sequence;

[0049] 3) Superior and secondary statistics:

[0050] First, we get the index numbers of regions and industries through the index matrix, and then perform retrieval statistics using the formula:

[0051]

[0052] in subarea For the retrieved lower-level regions, after the regions are retrieved, wide-area search and cumulative statistics are performed on each region to obtain the results of the lower-level statistics.

[0053] The upper-level statistics also take regions as an example. First, the index numbers of regions and industries are obtained through the index matrix, and then the search statistics are performed using the formula:

[0054]

[0055] in, uparea For the retrieved superior region, after retrieving the superior region, a wide-area search and statistics are performed to finally obtain the superior statistical results;

[0056] 4) Wide-area statistics:

[0057] Wide-area statistics is a simple statistics based on wide-area search and upper-lower search. The power data obtained above is calculated through the formula to obtain the statistical results:

[0058]

[0059] in sumelectricity For statistical results, N electricity is the amount of power data, electricity q Indicates the qth value in the wide-area search power data.

[0060] Beneficial effects of the present invention:

[0061] We built our own graph database based on graph theory and Python, and implemented lightweight storage of graph data through methods such as Boolean matrices and index matrices, forming an analysis mechanism that links power analysis statistical knowledge with graphs.

[0062] Based on a self-built graph database, it implements intelligent and rapid search of electricity data through adjacency matrices and reachability matrices, significantly reducing search time while ensuring high search accuracy, and achieving richer search functions: it is significantly better than the open source database Neo4j in terms of search time efficiency, and achieves richer search functions than traditional online power grids. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0064] Figure 1 This embodiment provides an example of a triple extraction method for structured data;

[0065] Figure 2 In this embodiment, the knowledge graph of industry type connectivity;

[0066] Figure 3 An example of an index matrix in this embodiment;

[0067] Figure 4 Adjacency matrix example in this embodiment;

[0068] Figure 5 This is an example of a two-dimensional floating-point value matrix of user-time-power in this embodiment. DETAILED DESCRIPTION

[0069] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0070] A method for constructing and searching an electricity graph database based on graph theory includes the following steps:

[0071] Step 1: By analyzing the composition and structural characteristics of power grid electricity data, the data is preprocessed, and a Boolean adjacency matrix describing the relationship between users, industry types, and regions is calculated. A two-dimensional floating-point numerical matrix storing users' electricity consumption data at different times is constructed to build an electricity map database.

[0072] Step 2: Based on the electricity map database, the reachability matrix describing the indirect relationship between users, industries, and regions is calculated through the adjacency matrix. Search is performed based on the adjacency matrix and the reachability matrix to obtain the search results.

[0073] Furthermore, in step 1, data is exported from the power grid system, including user electricity usage data. Any user electricity usage data includes user ID, industry, electricity usage, management region, and time unit. Secondly, by segmenting by industry type, connectivity between users is achieved, making the graph truly a connected network. In addition to enabling industry-based retrieval, it is also possible to directly retrieve user electricity usage data from both time and region dimensions.

[0074] Furthermore, in step 1, the user electricity consumption data is extracted into a triple format of "entity-relationship-entity", and the triple format is used as the basic form of data for processing. The entities are regarded as points in the graph and the relationships are regarded as edges in the graph to construct the corresponding electricity statistics knowledge graph. The graph architecture is shown in the attached figure. Figure 2 .

[0075] Furthermore, after extracting user electricity usage data into "entity-relationship-entity" triples, the data is categorized and stored based on its specific characteristics. Each data type is stored using a unique storage method. The data categories and corresponding storage methods include the following: a Boolean adjacency matrix, an index matrix, and a two-dimensional floating-point matrix. The adjacency matrix stores relationships between regions, industries, and users, while a two-dimensional floating-point matrix stores user electricity usage data over time. The index matrix stores the correspondence between the numbers and entity names in the two-dimensional floating-point matrix.

[0076] Furthermore, a region-industry-user graph is established, and an index matrix is ​​created using the following formula:

[0077]

[0078] Among them, I area , I indus , I user They are the indexes of region, industry and user respectively; 、 、 The names of regions, industries, and users respectively; 、 、 The index numbers corresponding to regions, industries, and users respectively; N area 、N indus 、N user They are the number of regions, industries, and users respectively;

[0079] Assuming that the number of nodes in the region-industry-user graph is N, we have:

[0080]

[0081] At this time, the order of the node adjacency matrix A is N×N, the diagonal elements in A are 0, and the non-diagonal elements are defined as the connection relationship between nodes u and v established through branches, so the elements in A are Expressed as:

[0082]

[0083] For the user-time-data relationship, first create a separate index I for time using the following formula: data :

[0084]

[0085] Among them, I data is a separate index for time, It is an eight-bit time code. is the index number corresponding to the time;

[0086] Based on the time index, a two-dimensional floating-point value matrix is ​​used to store the user-time-data relationship. Let its matrix form be B:

[0087]

[0088] in, is the electricity consumption of the corresponding user on the corresponding date, m The index number corresponding to the user, n The corresponding index number of the corresponding date.

[0089] The electricity graph database built based on graph theory uses an adjacency matrix with Boolean elements and a two-dimensional floating-point numerical matrix for storage according to the entity relationship type. The use of a two-dimensional floating-point numerical matrix eliminates a large number of redundant user-data and time-data relationships in the graph, reduces the dimension of the adjacency matrix, and provides a technical foundation for subsequent intelligent search.

[0090] The electricity graph database constructed in the present invention is based on graph theory. It adopts the bool type adjacency matrix and two-dimensional database storage according to the entity relationship type. The bool type adjacency matrix is ​​conducive to reducing storage capacity requirements and improving subsequent search speed. The use of the two-dimensional database deletes a large number of redundant user-data and time-data relationships in the graph, reduces the dimension of the adjacency matrix, and provides a technical foundation for subsequent intelligent search.

[0091] Furthermore, four search models are constructed: precise search, wide-area search, wide-area statistics, and superior and subordinate search. The search functions are summarized in the following table:

[0092]

[0093] In graph theory, we can use a 0,1 adjacency matrix to represent the edge set in a graph. The reachability matrix is ​​used to describe reachability, which reflects the ability of one node to reach another. Based on this principle, the present invention first uses the properties of the adjacency matrix to achieve precise entity search, then uses the reachability matrix to achieve wide-area search, and further implements range search, ultimately realizing intelligent search capabilities based on a self-built graph database.

[0094] 1) Precise search:

[0095] Precise search refers to information that is accurate to the user level, and is used to quickly and accurately query the power consumption data of a specific user on a specific date. For this type of search that relies on simple relationships, it can be directly searched through the two-dimensional power database established in Chapter 2.

[0096] According to the user number and date, the index number corresponding to the user and time in the index list is obtained by the following formula:

[0097]

[0098]

[0099] in, indexuser i 、indexdata s are the user and time series index numbers obtained through retrieval,

[0100] After obtaining the index number of the user and time, the specific power consumption data is obtained by indexing in the two-dimensional floating-point value matrix of user-time-power using the following formula:

[0101]

[0102] in The electricity consumption data obtained is the desired search target;

[0103] 2) Wide-area search:

[0104] Wide-area search refers to searching for users and their electricity consumption data in a specific region, specific industry, and specific time range.

[0105] Because the adjacency matrix created during graph construction can only reflect the relationship between adjacent nodes and cannot reflect the connectivity between non-adjacent nodes, we propose using a reachability matrix for wide-area search. In graph theory, a reachability matrix is ​​used to describe reachability, which reflects the ability of one node to reach another.

[0106] For a directed graph, the elements of the reachability matrix R are calculated using the following formula to obtain the reachability matrix R:

[0107]

[0108] Specifically, when performing a wide-area search, first obtain the region and industry numbers using the following formula:

[0109]

[0110]

[0111] Secondly, we use the formula to find the specific non-zero elements in the reachable matrix to obtain the user index under the region and industry:

[0112]

[0113]

[0114]

[0115] in, areauser s The index number of users in a specific region. indususer s The index number of users under a specific industry is obtained. Finally, the user number of the wide-area search is obtained by taking the intersection of users under a specific industry and region. indexuser s , and then use the formula to read specific row and column data in the two-dimensional floating-point value matrix of user-time-power:

[0116]

[0117] in, The power data is read, which is the target of wide-area search; indexdata s is a time index sequence;

[0118] 3) Superior and secondary statistics:

[0119] Up-down statistics is a function that counts the electricity consumption of users in upstream and downstream industries or regions within a given industry or region. This function relies primarily on the properties of the adjacency matrix. Down-down statistics is similar to wide-area search, so let's take a down-down search of a region as an example.

[0120] First, we get the index numbers of regions and industries through the index matrix, and then perform retrieval statistics using the formula:

[0121]

[0122] Where subarea is the subarea obtained by retrieval. After the area is retrieved, a wide-area search and cumulative statistics are performed on each area to obtain the results of the subarea statistics.

[0123] The upper-level statistics also take regions as an example. First, the index numbers of regions and industries are obtained through the index matrix, and then the search statistics are performed using the formula:

[0124]

[0125] Among them, uparea is the parent area retrieved. After retrieving the parent area, a wide-area search and statistics are performed to finally obtain the parent statistical results;

[0126] 4) Wide-area statistics:

[0127] Wide-area statistics is a simple statistics based on wide-area search and upper-lower search. The power data obtained above is calculated through the formula to obtain the statistical results:

[0128]

[0129] in sumelectricity For statistical results, N electricity is the amount of power data, electricity q Indicates the qth value in the wide-area search power data.

[0130] This example builds and stores a graph based on electricity usage data from over 9,000 users in a city over two years, totaling approximately five million records. This graph is compared to Neo4j-based search capabilities in terms of time and to the State Grid data management platform in terms of functionality. Testing was conducted on a computer with an Intel Core i5-10400 2.90GHz CPU and 16GB of RAM.

[0131] First, the electricity graph database is constructed, and the data is extracted into triples. For example, for electricity user 12****48, the data to be processed includes: rated capacity 160 kVA, voltage level 10 kV, industry type civil engineering and construction, user status in operation, user category high, electricity consumption 196.2 kWh, account establishment date 20051009, and management unit service area A, dated 20190501. Triples are extracted from the entities and relationships, with each specific data point treated as an entity and the category as a relationship. The user's rated capacity and industry category are extracted as follows: the specific value of the user number, 12****48, is treated as entity one, and the specific value of the user's rated capacity (kVA) is treated as entity two. The connection between entity one and entity two is "rated capacity (kVA)." Furthermore, the specific value of the user number, 12****48, is treated as entity one, and the specific industry category of the user is treated as entity two. The newly created connection between entity one and entity two is "industry category." By analogy, the triple relationship of each electricity user is extracted. The specific extraction results are shown in the attached Figure 1 shown.

[0132] After the extraction is completed, the present invention uses the adjacency matrix and two-dimensional floating point value matrix to store the main entity relationship type. The index matrix and adjacency matrix are constructed for region-industry-user to store, and the user-time-data relationship is stored in a two-dimensional floating point value matrix. The specific formula is as described above. Figure 1 Take the data intercepted in the example as an example, and create an index matrix as shown in the attached figure. Figure 3 , build the adjacency matrix as shown in the following Figure 4 , establish a two-dimensional user time and power database as shown in the attached Figure 5 .

[0133] Next, we implemented a smart search function based on the aforementioned principles, building on our self-built electricity map database. We selected the wide-area search function and targeted service area A, the financial industry, for the daily electricity consumption of each user from March 1, 2019, to March 4, 2019. The results are shown in the table.

[0134] The wide area search results are displayed in the table

[0135]

[0136] The vertical columns represent user IDs, and the horizontal columns represent electricity usage data. This wide-area search on the self-built electricity map database took 1.009ms, while the graph built on open-source Neo4j took 32s. While achieving the same search results, the difference in search time between the self-built electricity map database and the open-source Neo4j graph was a thousandfold, with the self-built electricity map database having a significant search time advantage.

[0137] This paper also compares other search functions, and the specific examples and results are shown below:

[0138] (1) Precise search: Search for user 22****45, electricity consumption from 20190301 to 20190331;

[0139] (2) Wide-area search: Search service area A, rubber and plastic products industry, daily electricity consumption of each user from March 1, 2019 to March 31, 2019

[0140] (3) Wide-area statistics: Statistics of service area A, rubber and plastic products industry, daily electricity consumption of each user and total electricity consumption from March 1, 2019 to March 31, 2019

[0141] (4) Secondary statistics: Statistical service area A, rubber and plastic products industry, secondary industry electricity consumption from March 1, 2019 to March 31, 2019

[0142] (5) Superior statistics: Statistics of service area A, rubber and plastic products industry, electricity consumption in the superior area from March 1, 2019 to March 31, 2019

[0143] The efficiency of these features is compared with that of Neo4j and with or without the online power grid feature. The results are shown in the following table.

[0144] Table Calculation Example Comparison Results

[0145]

[0146] As can be seen from the table, the timeliness of the self-built electricity diagram database is very high, and its search time is significantly better than the open source Neo4j database. At the same time, compared with the traditional online power grid, the self-built electricity diagram database has richer and more comprehensive functions, which can provide a strong technical foundation for subsequent business and management.

[0147] Those skilled in the art will appreciate that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the present invention. Therefore, the embodiments should be considered as instructive and non-restrictive in all respects. The scope of the present invention is defined by the appended claims, not the foregoing description. These embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention. All modifications, equivalent substitutions, improvements, etc. that fall within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for constructing and searching an electricity graph database based on graph theory, characterized in that: The steps include: Step 1: By analyzing the composition and structural characteristics of power grid electricity data, the data is preprocessed and a Boolean adjacency matrix describing the relationships between users, industry types, and regions is calculated. A two-dimensional floating-point numerical matrix storing users' electricity consumption data at different times is constructed to build an electricity map database. Step 2: Based on the electricity map database, the reachability matrix describing the indirect relationship between users, industries, and regions is calculated through the adjacency matrix. Search is performed based on the adjacency matrix and the reachability matrix to obtain search results. Create a region-industry-user graph and create an index matrix using the following formula: Among them, I user The index of the user; is the user's name; The index number of the user; N area 、N indus 、N user They are the number of regions, industries, and users respectively; Assuming that the number of nodes in the region-industry-user graph is N, we have: At this time, the order of the node adjacency matrix A is N×N, the diagonal elements in A are 0, and the non-diagonal elements are defined as the connection relationship between nodes u and v established through branches, so the elements in A are Expressed as: For the user-time-data relationship, first create a separate index I for time using the following formula: data : Among them, I data is a separate index for time, It is an eight-bit time code. is the index number corresponding to the time; Based on the time index, a two-dimensional floating-point value matrix is ​​used to store the user-time-data relationship. Let its matrix form be B: in, is the electricity consumption of the corresponding user on the corresponding date, m The index number corresponding to the user, n The corresponding index number of the corresponding date.

2. The method for constructing and searching an electricity graph database based on graph theory according to claim 1, characterized in that: In step 1, data is exported through the power grid system, and the data includes user electricity consumption data. Any of the user electricity consumption data includes user number, industry, electricity consumption, management area, and time unit.

3. The method for constructing and searching an electricity graph database based on graph theory according to claim 2, characterized in that: In step 1, the user electricity consumption data is extracted into a triple format of "entity-relationship-entity", and the triple format is used as the basic form of data for processing. The entities are regarded as points in the graph, and the relationships are regarded as edges in the graph, and the corresponding electricity statistics knowledge graph is constructed.

4. The method for constructing and searching an electricity graph database based on graph theory according to claim 3, characterized in that: After extracting user electricity consumption data in the "entity-relationship-entity" triple format, it is classified and stored based on the actual data characteristics. Each type of data is stored in a unique storage method. The data categories and corresponding storage methods include the following three categories: Boolean adjacency matrix, index matrix and two-dimensional floating-point numerical matrix; among them, the relationship between regions, industries and users is stored in the adjacency matrix, the electricity consumption data of users at different times is stored in the two-dimensional floating-point numerical matrix, and the correspondence between the numbers and entity names in the two-dimensional floating-point numerical matrix is ​​stored in the index matrix.

5. The method for constructing and searching an electricity graph database based on graph theory according to claim 1, characterized in that: Construct four search models: precise search, wide-area search, wide-area statistics, and superior and subordinate search. 1) Precise search: Based on the user ID and date, the index number corresponding to the user and time in the index list is obtained using the following formula: in, indexuser i 、indexdata s are the user and time series index numbers obtained through retrieval respectively; After obtaining the index number of the user and time, the specific power consumption data is obtained by indexing in the two-dimensional floating-point value matrix of user-time-power using the following formula: in, The electricity consumption data obtained by indexing is the desired search target; 2) Wide-area search: For a directed graph, the elements of the reachability matrix R are calculated using the following formula to obtain the reachability matrix R: Specifically, when performing a wide-area search, first obtain the region and industry numbers using the following formula: in, 、 Index numbers corresponding to regions and industries respectively; 、 The names of the corresponding regions and industries respectively; I area , I indus These are the indexes of region and industry respectively; Secondly, find the non-zero elements in the reachable matrix through the formula to obtain the user index under region and industry: in, areauser s The index number of the users under the region. indususer s The index number of the users under the industry is obtained. Finally, the user number of the wide-area search is obtained by taking the intersection of the users under the industry and the region. indexuser s , and then read the row and column data from the two-dimensional floating-point value matrix of user-time-power through the formula: in, The power data read is the target of wide-area search; 3) Superior and secondary statistics: First, we get the index numbers of regions and industries through the index matrix, and then perform retrieval statistics using the formula: in subarea For the retrieved lower-level regions, after retrieving the regions, wide-area search and cumulative statistics are performed for each region to obtain the lower-level statistical results. The superior statistics also take regions as an example. First, the index numbers of regions and industries are obtained through the index matrix, and then the search statistics are performed through the formula: in, uparea For the retrieved superior region, after retrieving the superior region, a wide-area search and statistics are performed to finally obtain the superior statistical results; 4) Wide-area statistics: Wide-area statistics is a simple statistics based on wide-area search and upper-lower search. The power data obtained above is calculated through the formula to obtain the statistical results: in sumelectricity For statistical results, N electricity is the amount of power data, electricity q Indicates the qth value in the wide-area search power data.

Citation Information

Patent Citations

  • Design method of interactive digital education television programs

    CN105574276A

  • Electric energy replacement potential mining method based on user information big data

    CN113590685A