Image data storage method, device, and electronic device

By dividing graph data into subgraphs and establishing a graph data header storage structure, the problem of time-consuming graph data adjustment in the existing technology is solved, and more efficient graph data adjustment and processing is achieved.

CN114840524BActive Publication Date: 2025-09-16LOONGSON TECH CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210493398.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-07
Publication Date
2025-09-16
Estimated Expiration
2042-05-07

AI Technical Summary

Technical Problem

Existing technologies take a long time to adjust graph data, especially for the adjustment of equal-increment graph data, which requires adjusting the structure of the entire graph data, resulting in low efficiency.

Method used

The graph data is divided into multiple subgraphs with the same graph structure. A graph data header is established to store the same information between multiple subgraphs, and the difference information is stored through an information set. Only the corresponding information set is updated when the node is adjusted without adjusting the structure of the entire graph data.

Benefits of technology

This method reduces the time consumption of graph data adjustment and improves the adjustment efficiency, especially for the storage and processing of equal-increment graph data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114840524B_ABST
    Figure CN114840524B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a graph data storage method, device and electronic device, which relate to the field of computers. The method includes: acquiring graph data, establishing and storing a graph data header, adding connection information of non-fixed edges in the graph data header, setting and storing a subgraph number that uniquely identifies a subgraph, and storing a first information set of key nodes correspondingly when a key node is included in the subgraph. For equal-increment graph data, a graph data header for multiple subgraphs is established, the same information between multiple subgraphs is stored through the graph data header, and the difference information between each subgraph is stored through the information set. When adjusting the graph data, it is only necessary to adjust the corresponding information set according to the node, and there is no need to adjust the structure of the entire graph data, which is time-saving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a method, device and electronic device for storing graph data. Background Art

[0002] A graph is an abstract data structure used to represent the relationships between objects. It is described using nodes (vertices) and edges (edges). Nodes represent objects, and edges represent relationships between objects. Graph data is the data that can be abstracted and described as a graph. Graph data is commonly stored in formats such as the Adjacency Matrix (AM) and Compressed Sparse Row (CSR).

[0003] When using graph data, adjustments are often necessary, such as adding or deleting vertices and edges. If the graph data is incremental, storing it in existing formats requires adjusting the entire graph structure, which is time-consuming. Summary of the Invention

[0004] In view of the above problems, an embodiment of the present invention is proposed to provide a graph data storage method that overcomes the above problems or at least partially solves the above problems, so as to solve the problem of long time consumption when adjusting data.

[0005] Correspondingly, an embodiment of the present invention further provides a graph data storage device and an electronic device to ensure the implementation and application of the above method.

[0006] A first aspect of an embodiment of the present invention discloses a method for storing graph data, the method comprising:

[0007] Obtaining graph data; the graph data includes a plurality of subgraphs, each of the subgraphs including a plurality of nodes and fixed edges connecting the plurality of nodes; the graph data also includes at least one non-fixed edge connecting nodes in different subgraphs; the plurality of subgraphs having the same graph structure;

[0008] Creating and storing a graph data header, wherein the graph data header includes structural information of the graph structure;

[0009] Adding connection information of the non-fixed edge to the graph data header, where the connection information is used to describe the source node and destination node of the non-fixed edge;

[0010] A subgraph number that uniquely identifies the subgraph is set and stored, and when a key node is included in the subgraph, a first information set of the key node is correspondingly stored; the key node is the destination node of the target non-fixed edge; the first information set includes the subgraph number of the subgraph where the source node of the target non-fixed edge is located, and the index of the connection information of the target non-fixed edge in the graph data header.

[0011] Optionally, the method further includes: when the weight of the target non-fixed edge is acquired, adding the weight of the target non-fixed edge to the first information set.

[0012] Optionally, the method further includes: when the weight of the fixed edge is obtained, storing a second information set of the fixed edge; the second information set includes the weight of the fixed edge, and the second information set is stored corresponding to the subgraph number of the subgraph where the fixed edge is located.

[0013] Optionally, the establishing and storing the graph data header includes:

[0014] Acquire multiple reference node numbers; each of the reference node numbers corresponds to a node at the same position in the multiple subgraphs;

[0015] Establishing a coding matrix; wherein the row numbers and column numbers with the same values ​​in the coding matrix correspond to the same reference node number;

[0016] Determine a matrix position corresponding to the fixed edge from the encoding matrix, and add an index corresponding to the fixed edge to the matrix position; the row number of the matrix position is the reference node number corresponding to the source node of the fixed edge, and the column number of the matrix position is the reference node number corresponding to the destination node of the fixed edge.

[0017] Optionally, the second information set also includes the index of the corresponding fixed edge in the graph data header.

[0018] Optionally, the method further includes: when the attributes of the node are obtained, storing a third information set of the node; the third information set is stored corresponding to the subgraph number of the subgraph where the node is located, and the third information set includes the attributes of the node.

[0019] A second aspect of an embodiment of the present invention discloses a graph data storage device, comprising:

[0020] an acquisition module configured to acquire graph data; the graph data comprising a plurality of subgraphs, each of the subgraphs comprising a plurality of nodes and fixed edges connecting the plurality of nodes; the graph data further comprising at least one non-fixed edge connecting nodes in different subgraphs; the plurality of subgraphs having the same graph structure;

[0021] An establishing module, configured to establish and store a graph data header, wherein the graph data header includes structural information of the graph structure;

[0022] An adding module, configured to add connection information of the non-fixed edge to the graph data header, wherein the connection information is used to describe a source node and a destination node of the non-fixed edge;

[0023] A storage module is used to set and store a subgraph number that uniquely identifies the subgraph, and when a key node is included in the subgraph, store a first information set of the key node accordingly; the key node is the destination node of the target non-fixed edge; the first information set includes the subgraph number of the subgraph where the source node of the target non-fixed edge is located, and the index of the connection information of the target non-fixed edge in the graph data header.

[0024] Optionally, the storage module is further configured to add the weight of the target non-fixed edge to the first information set when the weight of the target non-fixed edge is acquired.

[0025] Optionally, the storage module is also used to store a second information set of the fixed edge when the weight of the fixed edge is obtained; the second information set includes the weight of the fixed edge, and the second information set is stored corresponding to the subgraph number of the subgraph where the fixed edge is located.

[0026] Optionally, the establishing module includes:

[0027] An acquiring unit, configured to acquire a plurality of reference node numbers, each of the reference node numbers corresponding to a node at the same position in the plurality of subgraphs;

[0028] An establishing unit, configured to establish a coding matrix; wherein row numbers and column numbers with the same values ​​in the coding matrix correspond to the same reference node number;

[0029] an adding unit, configured to determine a matrix position corresponding to the fixed edge from the encoding matrix, and add an index corresponding to the fixed edge in the matrix position; the row number of the matrix position is a reference node number corresponding to the source node of the fixed edge, and the column number of the matrix position is a reference node number corresponding to the destination node of the fixed edge.

[0030] Optionally, the second information set also includes the index of the corresponding fixed edge in the graph data header.

[0031] Optionally, the storage module is also used to store a third information set of the node when the attributes of the node are obtained; the third information set is stored corresponding to the subgraph number of the subgraph where the node is located, and the third information set includes the attributes of the node.

[0032] A third aspect of an embodiment of the present invention further discloses an electronic device comprising the image data storage device according to the second aspect. This embodiment of the present invention has the following advantages:

[0033] In an embodiment of the present invention, graph data is obtained, a graph data header is established and stored, connection information of non-fixed edges is added to the graph data header, a subgraph number that uniquely identifies the subgraph is set and stored, and when a key node is included in the subgraph, a first information set of the key node is correspondingly stored. For equal-increment graph data, a graph data header is established for multiple subgraphs, the same information between the multiple subgraphs is stored through the graph data header, and the difference information between the subgraphs is stored through the information set. When adjusting the graph data, it is only necessary to adjust the corresponding information set according to the node, and there is no need to adjust the structure of the entire graph data, which is time-saving. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A schematic diagram showing the composition of graph data in an embodiment of the present invention is shown;

[0035] Figure 2 A flowchart showing a method for storing graph data according to an embodiment of the present invention is shown;

[0036] Figure 3 A schematic diagram of a graph data header according to an embodiment of the present invention is shown;

[0037] Figure 4 A schematic diagram of storing graph data in an embodiment of the present invention is shown;

[0038] Figure 5 Another schematic diagram of storing graph data in an embodiment of the present invention is shown;

[0039] Figure 6 A schematic diagram showing a hardware implementation of a graph data storage method according to an embodiment of the present invention is shown;

[0040] Figure 7 A schematic structural diagram of a graph data storage device according to an embodiment of the present invention is shown;

[0041] Figure 8 A structural block diagram of an electronic device in an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0042] To facilitate understanding of the present invention, firstly, a brief introduction is given to the equal increment graph data involved in the embodiments of the present invention.

[0043] In some usage scenarios, graph data can be divided into multiple subgraphs with the same graph structure, and edges connecting nodes in different subgraphs. Multiple subgraphs have the same graph structure, and each subgraph includes multiple nodes and edges connecting nodes in the subgraph. Since the subgraphs have the same structure, the edges in each subgraph are fixed, and the edges between subgraphs are not fixed. To facilitate distinction, this embodiment names the edges connecting nodes in different subgraphs as non-fixed edges, and the edges connecting nodes in the same subgraph as fixed edges. Figure 1 As shown, Figure 1 A schematic diagram showing the composition of a graph data in an embodiment of the present invention is shown. Taking program operation as an example, the program includes Figure 1 Instructions i0, i1, i2, i3, and i4 are shown, and the CPU (Central Processing Unit) uses pipeline technology to run the program. During program execution, the execution process of each instruction can be divided into five pipeline stages, namely the dispatch stage, the ready stage, the execute stage, the complete stage, and the commit stage. The dispatch stage is represented by the symbol D, the ready stage is represented by the symbol R, the execute stage is represented by the symbol E, the complete stage is represented by the symbol P, and the commit stage is represented by the symbol C. When using pipeline technology to execute multiple instructions, the CPU processes the multiple instructions in parallel. For example, during the preparation stage of instruction i0, the dispatch stage of instruction i1 can be performed. During the execution stage of instruction i0, the preparation stage of instruction i1 and the dispatch stage of instruction i2 can be performed. Similarly, multiple instructions can be processed in parallel. The division method of the pipeline stage may include but is not limited to the above examples, and this embodiment does not limit this.

[0044] Figure 1Each circle in the figure can represent a pipeline stage in an instruction, and the subscript of the symbol corresponds to the instruction. In the same instruction, the execution of the latter pipeline stage depends on the execution result of the previous pipeline stage, and there is an association relationship between the two stages. For example, in instruction i0, the execution of the preparation stage R0 depends on the execution result of the dispatch stage D0. Between two pipeline stages of different instructions, the execution of a pipeline stage in the latter instruction depends on the execution result of a pipeline stage in the previous instruction, and the two pipeline stages have an association relationship. For example, between instruction i3 and instruction i1, the preparation stage of instruction i3 needs to obtain the execution result of the completion stage of instruction i1, and there is an association relationship between the preparation stage of instruction i3 and the completion stage of instruction i1. The above is only an illustrative example, and the association relationship between each pipeline stage can be set according to actual needs, and this embodiment does not limit this. During the execution of each instruction, the CPU can generate a node for each pipeline stage in the instruction, and the subsequent pipeline stage depends on the execution result of the previous pipeline stage. There is an association relationship between the two stages, and a fixed edge connecting the two nodes can be generated. The source node of the fixed edge is the node of the previous pipeline stage, and the destination node is the node of the next pipeline stage.

[0045] Figure 1 Each circle shown can represent a pipeline stage or a node corresponding to a pipeline stage, and the symbol in the circle is the node number of the node. The line between two nodes represents an edge, and the arrow of the edge indicates the direction of the edge, and the arrow starts from the source node of the edge and points to the destination node. For example, during the execution of instruction i0, for the five pipeline stages of instruction i0, five nodes D0, R0, E0, P0 and C0 can be generated respectively, and the five nodes have a first coding order from D0 to C0. In some cases, in order to reflect the first coding order between each node in the subgraph, the nodes can be encoded with Arabic numerals. While generating the five nodes corresponding to instruction i0, four fixed edges can be generated, and the source node connected to each fixed edge is the node of the previous pipeline stage, and the destination node is the node of the next pipeline stage. For example, the source node connected by fixed edge 101 is D0, and the destination node is R0. At this time, nodes D0, R0, E0, P0 and C0, as well as fixed edges 101, 102, 103 and 104 form a subgraph 100 belonging to instruction i0. Similarly, a subgraph 200 belonging to instruction i1 and subgraphs belonging to other instructions can be generated. Figure 1The graph structures of different subgraphs are the same, and different subgraphs have the same number of nodes, and nodes at the same position have the same fixed edges. The position of a node refers to the coding order of the node among all the nodes included in the subgraph. For example, subgraph 100 and subgraph 200 have the same number of nodes, node D0 is the first node in subgraph 100, and node D1 is the first node in subgraph 200. Node D0 and node D1 are two nodes at the same position. In addition, node D0 and node D1 have the same fixed edges, namely fixed edge 101 and fixed edge 201. Fixed edge 101 points from the first node D0 in subgraph 100 to the second node R0, and fixed edge 201 points from the first node D1 in subgraph 200 to the second node R2. The fixed edge 101 in subgraph 100 corresponds to the fixed edge 201 in subgraph 200.

[0046] Between two pipeline stages of different instructions, if the execution of a pipeline stage in the latter instruction depends on the execution result of a pipeline stage in the former instruction, the two pipeline stages are associated, and a corresponding non-fixed edge can be generated. For example, between instructions i0 and i1, the preparation phase of instruction i1 requires the execution result of the completion phase of instruction i0, which can generate a non-fixed edge 1021. The source node of non-fixed edge 1021 is node P0 in subgraph 100, and the destination node is node R1 in subgraph 200. Similarly, other non-fixed edges in graph data can be generated. Figure 1 The graph structures of different subgraphs are the same, and the subgraphs have the same number of nodes, the same node encoding order, and the nodes at the same position have the same fixed edges. For example, subgraph 100 and subgraph 200 have the same number of nodes, and the first node D0 in subgraph 100 and the first node D1 in subgraph 200 have the same fixed edges, namely fixed edge 101 and fixed edge 201. Fixed edge 101 points from the first node D0 in subgraph 100 to the second node R0, and fixed edge 201 points from the first node D1 in subgraph 200 to the second node R1. The fixed edge 101 in subgraph 100 corresponds to the fixed edge 201 in subgraph 200.

[0047] exist Figure 1 In the process of obtaining the graph data shown in the figure, the nodes in the graph data are based on subgraphs, and a subgraph node is added each time. Figure 1 The graph data shown can be referred to as equal-increment graph data. It should be noted that the equal-increment graph data is not limited to the usage scenarios in the above examples, and other usage scenarios in actual applications can also be expressed using the equal-increment graph data. Figure 1 The graph data shown may be automatically generated and stored by the electronic device during operation, or may be acquired and stored from other connected electronic devices.

[0048] One of the core concepts of the embodiments of the present invention is to divide the graph data into multiple subgraphs with the same graph structure for equal increments. A graph data header can be established for the multiple subgraphs, describing the graph structure of the multiple subgraphs through the graph data header, storing the same information between the multiple subgraphs, and storing the difference information between the subgraphs through an information set. When adjusting the graph data, it is only necessary to adjust the corresponding information set according to the node, without having to adjust the structure of the entire graph data, which is time-saving.

[0049] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0050] Reference Figure 2 , shows a flowchart of a method for storing graph data according to an embodiment of the present invention. The method may include the following steps:

[0051] Step 201: Obtain graph data.

[0052] The graph data includes multiple subgraphs, each subgraph includes multiple nodes and fixed edges connecting the multiple nodes; the graph data also includes at least one non-fixed edge connecting nodes in different subgraphs; and the multiple subgraphs have the same graph structure.

[0053] In this embodiment, the graph data storage method can be implemented by electronic devices such as computers and servers. In the process of obtaining and storing graph data, the electronic devices can obtain one or more subgraphs each time, as well as non-fixed edges connecting nodes in different subgraphs, or they can obtain all subgraphs and non-fixed edges at once. In conjunction with the above example, if the graph data is automatically generated by the electronic device, the electronic device can continuously generate subgraphs and non-fixed edges; if the graph data is obtained from other connected electronic devices, the entire graph data can be directly obtained. Specific methods for obtaining graph data may include but are not limited to the above examples.

[0054] Step 202: Create and store the graph data header.

[0055] The graph data header includes structural information of the graph structure, which is used to describe the nodes and fixed edges in the graph structure. The structural information may include a set of nodes and a set of fixed edges in the graph structure.

[0056] In this embodiment, a reference node number corresponding to the node number of each starting node included in the starting subgraph can be generated, and a graph data header can be established based on the connection information and reference node number of each starting fixed edge included in the starting subgraph. The starting subgraph is the first subgraph in multiple subgraphs, for example Figure 1The first instruction i0 corresponds to the subgraph 100 shown in the figure. The starting nodes are nodes D0, R0, E0, P0, and C0 in the starting subgraph. The starting fixed edges are fixed edges 101, 102, 103, and 104 in the starting subgraph. Multiple subgraphs have the same graph structure. The same reference node number can be used in the graph data header to represent nodes at the same position in different subgraphs. For example, Figure 1 Nodes D0, D1, D2, D3, and D4 in the graph can be represented by reference node number D, and nodes R0, R1, R2, R3, and R4 can be represented by reference node number R. Multiple reference node numbers can be used to correspond to nodes at the same location in multiple subgraphs to describe the node sets in the multiple subgraphs. The connection relationships between multiple reference node numbers can be used to describe the set of fixed edges in the multiple subgraphs.

[0057] In one embodiment, the graph data header may be composed of a number array and a connection information list, wherein the number array is used to sequentially store multiple reference node numbers, and the connection information list is used to store the first connection information of the fixed edge and the second connection information of the non-fixed edge. The first connection information is used to describe the reference node numbers of the source node and the destination node of the fixed edge connection, and the second connection information is used to describe the reference node numbers of the source node and the destination node of the non-fixed edge connection. The number array is, for example, a one-dimensional array N[5]={D, R, E, P, C}, the first element in the number array stores the reference node number D of the first node in the subgraph, the second element stores the reference node number R of the second node in the subgraph, and so on. The reference node number corresponding to each node in the subgraph can be stored to describe the node set of multiple subgraphs. The node number of each node in the starting subgraph can be directly used as the corresponding reference node number, or a unique number can be set for each node in the starting subgraph as the reference node number. Multiple reference node numbers are set sequentially in the number array, so the node corresponding to the reference node number can be determined based on the position of the reference node number in the number array. For example, if the reference node number E is in the third position in the number array, then the reference node number E can be determined as the reference node number of the third node in the subgraph; if the reference node number P is in the fourth position in the number array, then the reference node number P can be determined as the reference node number of the fourth node in the subgraph.

[0058] As shown in Table 1, Table 1 is an exemplary connection information list.

[0059] index 1 2 3 4 5 Connection Information DR RE EP PC DD

[0060] Table 1

[0061] The connection information list includes multiple connection information and the index of each connection information. In Table 1, the first connection information and the second connection information are connection information of the same format. Each connection information is used to describe the source node and destination node of an edge. The first digit of the connection information is the reference node number of the source node connected to the edge, and the second digit is the reference node number of the destination node connected to the edge. For example, the connection information (DR) is the connection information, the first digit D indicates that the reference node number of the source node connected to the edge is D, and the second digit R indicates that the reference node number of the destination node connected to the edge is R. The index of the connection information is used to obtain the connection information from the connection information list. For example, when the index of a fixed edge is 1, the connection information (DR) can be determined from Table 1 according to the index 1, so that it can be determined that the source node connected to the fixed edge is the first node in the subgraph (the reference node number D corresponds to the first node in the subgraph), and the destination node is the second node in the subgraph (the reference node number R corresponds to the second node in the subgraph). Furthermore, according to the subgraph number of the subgraph where the fixed edge is located, the source node and destination node of the fixed edge can be determined. For example, if the subgraph number of the subgraph where the fixed edge is located is 1, it can be determined that the source node connected by the fixed edge is D1 and the destination node is R1.

[0062] When the connection information is the second connection information, it is necessary to determine the subgraph number of the source subgraph where the source node of the non-fixed edge connection is located, and the subgraph number of the destination subgraph where the destination node is located. For example, when the index of a non-fixed edge is 5, the second connection information (DD) can be determined from Table 1. Further, if it is determined that the subgraph number of the source subgraph where the source node of the non-fixed edge connection is located is 1, and the subgraph number of the destination subgraph where the destination node is located is 2, then it can be determined that the source node of the non-fixed edge connection is D1 and the destination node is D2.

[0063] Optionally, the step of establishing and storing the graph data header may include:

[0064] Get multiple reference node numbers; each reference node number corresponds to a node at the same position in multiple subgraphs;

[0065] Establish a coding matrix; the row and column numbers with the same values ​​in the coding matrix correspond to the same reference node number;

[0066] Determine the matrix position corresponding to the fixed edge from the encoding matrix and add the index of the corresponding fixed edge to the matrix position; the row number of the matrix position is the reference node number corresponding to the source node of the fixed edge, and the column number of the matrix position is the reference node number corresponding to the destination node of the fixed edge.

[0067] In one embodiment, the graph data header can be established in the form of a coding matrix. Figure 3 As shown, Figure 3A schematic diagram of a graph data header in an embodiment of the present invention is shown, in which the encoding matrix is ​​a 5-row 5-column encoding matrix, with the row numbers from the 1st row to the 5th row being the reference node numbers D, R, E, P, and C, respectively, and the column numbers from the 1st column to the 5th column being the reference node numbers D, R, E, P, and C, respectively. Row numbers and column numbers with the same numerical values ​​are encoded by the same reference node number, for example, the row number of the 3rd row and the column number of the 3rd column are both the reference node number E. The row numbers of the encoding matrix correspond to the source nodes connected by fixed edges and non-fixed edges, and the column numbers correspond to the destination nodes connected by fixed edges and non-fixed edges. For example, the Pth row represents the reference node number P of the source node connected by a fixed edge or a non-fixed edge, and the Rth column represents the reference node number R of the destination node connected by a fixed edge or a non-fixed edge.

[0068] After establishing the encoding matrix, the matrix position of the starting fixed edge can be determined from the encoding matrix based on the reference node numbers of the source and destination nodes connected by the starting fixed edge, and a unique index can be added to the corresponding position. For example, if the source node connected to the starting fixed edge 102 is R0 and the destination node is E0, the reference node number of the source node is R, and the reference node number of the destination node is E, then the matrix position of the starting fixed edge 102 is in row R and column E. A unique index "3" can be set in row R and column E of the encoding matrix. Index "3" corresponds to the fixed edge between nodes R0 and E0, and also corresponds to the fixed edge between nodes R1 and E1 at the same location, as well as the fixed edge between nodes R2 and E2, the fixed edge between nodes R3 and E3, and the fixed edge between nodes R4 and E4. The above reference node numbers can also be replaced with Arabic numerals 1, 2, 3, 4, and 5. The specific type of reference node number can be set as required, and this embodiment does not limit this.

[0069] In an embodiment of the present invention, when a graph data header is established in the form of a coding matrix, the source node and destination node corresponding to the first connection information and the second connection information can be stored through the row and column relationship of the coding matrix, so that a graph data header with a smaller data volume can be obtained, thereby reducing the storage space required for the graph data.

[0070] In another embodiment, the starting subgraph can be directly used as the graph data header. Since the graph structure of the starting subgraph is the same as that of other subgraphs, the graph structure of all other subgraphs can be determined based on the structure of the starting subgraph. The node set and the fixed edge set of the starting subgraph can be directly used as the graph data header. When adding the connection information of the non-fixed edge to the graph data header, the connection information of the non-fixed edge can be stored in the adjacent position of the starting subgraph, and the connection information of the non-fixed edge can only include the number of the source node and the number of the destination node of the non-fixed edge. Among them, the format of the graph data header can include but is not limited to the above examples, and the graph data header can be flexibly designed according to the first type of edge and the second type of edge in the subgraph. The specific form of the graph data header can include but is not limited to the above examples.

[0071] In practical applications, the graph data header can be flexibly designed according to the fixed edges and non-fixed edges in the subgraph. The specific form of the graph data header may include but is not limited to the above examples.

[0072] Step 203: Add connection information of non-fixed edges to the graph data header.

[0073] The connection information is used to describe the source and destination nodes of non-fixed edges.

[0074] In this embodiment, after obtaining the non-fixed edge, the electronic device can first determine whether the second connection information of the non-fixed edge is already stored in the graph data header. If the second connection information of the non-fixed edge is not stored, the second connection information is added to the graph data header. In combination with the above example, if for subgraph 200, the electronic device can generate a node R1 corresponding to the preparation stage in instruction i1 during the execution of instruction i1, and can generate a non-fixed edge 1021. The source node connected to the non-fixed edge 1021 is P0, and the destination node is R1. At this time, it is possible to find out whether the second connection information (PR) of the non-fixed edge 1021 is included in the graph data header. For example, if the graph data header consists of a number array and a connection information list, it can be determined that Table 1 does not include the second connection information (PR) corresponding to the fixed edge 1021. An item of connection information (PR) can be added to the connection information list shown in Table 1, and a unique index "6" can be set to obtain the connection information list shown in Table 2.

[0075] index 1 2 3 4 5 6 Connection Information DR RE EP PC DD PR

[0076] Table 2

[0077] Similarly, if the image data header is a coding matrix, when it is detected Figure 3When the Pth row and the Rth column in the encoding matrix shown are empty, a unique index 6 may be set at the position of the Pth row and the Rth column. Conversely, if the second connection information (PR) already exists in the connection information list or the encoding matrix, the second connection information (PR) may not be added to the connection information list or the encoding matrix.

[0078] Step 204: Set and store a subgraph number that uniquely identifies the subgraph, and if the subgraph includes a key node, store a corresponding first information set of the key node.

[0079] Among them, the key node is the destination node of the target non-fixed edge; the first information set includes the subgraph number of the subgraph where the source node of the target non-fixed edge is located, and the index of the connection information of the target non-fixed edge in the graph data header.

[0080] In this embodiment, after obtaining the starting sub-image, the electronic device may set a sub-image number that uniquely identifies the starting sub-image and store the sub-image number of the starting sub-image. When obtaining other sub-images after the starting sub-image, the electronic device may set a unique sub-image number for the sub-image. The sub-image numbers of the multiple sub-images may be encoded in a second encoding order to set a unique sub-image code for each sub-image. Figure 4 As shown, Figure 4 A schematic diagram of graph data storage in an embodiment of the present invention is shown. Subgraph number 401 is subgraph number 0 of the starting subgraph. If subgraph 200 is a newly added subgraph, subgraph number 402 of subgraph 200 can be set to 1 based on subgraph number 0, and subgraph number 402 is stored after the storage location of subgraph 100. Node D1 in subgraph 200 is the destination node of non-fixed edge 1022, node R1 is the destination node of non-fixed edge 1021, and node C1 is the destination node of non-fixed edge 1023. Nodes D1, R1, and C1 are key nodes, and non-fixed edges 1022, 1021, and 1023 are target non-fixed edges. The first information set 403 of the non-fixed edge 1021 , the first information set 404 of the non-fixed edge 1022 , and the first information set 405 of the non-fixed edge 1023 may be added respectively, and the first information set 403 , the first information set 404 , and the first information set 405 may be stored correspondingly after the subgraph number 402 .

[0081] In one embodiment, the first information in the first information set of each non-fixed edge indicates the subgraph number of the source subgraph connected by the non-fixed edge, and the second information indicates the index of the non-fixed edge in the graph data header. For example, the first information 0 in the first information set 403 of the non-fixed edge 1021 indicates that the source node P0 connected by the non-fixed edge 1021 is in the subgraph 100 with subgraph number 0, and the index 6 corresponds to Figure 3In the encoding matrix shown in FIG, row P and column R. In the process of reading the image data, first, according to the second information (i.e., index 6) in the first information set 403, Figure 3 The second connection information PR is determined from the encoding matrix shown or the connection information list shown in Table 2. Furthermore, based on the first information (i.e., subgraph number 0), the source node is determined to be P0, and based on subgraph number 1, the destination node is determined to be R1. Similarly, the subgraph number of each subgraph and the corresponding first information set can be stored.

[0082] Optionally, the method may further include:

[0083] When the weight of the fixed edge is obtained, a second information set of the fixed edge is stored; the second information set includes the weight of the fixed edge, and the second information set is stored corresponding to the subgraph number of the subgraph where the fixed edge is located.

[0084] In one embodiment, the electronic device may also obtain the weight of the fixed edge and store the weight of the fixed edge. Figure 1 As shown, the weight of a fixed edge can be the delay time between the pipeline stages corresponding to the two nodes connected by the fixed edge. For example, during the execution of instruction i0, if the delay time between the first time during the dispatch phase and the second time during the preparation phase is 1 clock cycle, the weight of fixed edge 101 can be set to 1. If the delay time between the second time during the preparation phase and the third time during the execution phase is 0 clock cycles, the weight of fixed edge 102 can be set to 0. Similarly, the weight of fixed edge 103 can be set to 20, the weight of fixed edge 104 can be set to 1, and the weight of each fixed edge in subgraph 200 can be set to 1.

[0085] like Figure 5 As shown, Figure 5 A schematic diagram of another storage of graph data in an embodiment of the present invention is shown. For subgraph 100, a second information set 406 of fixed edge 101, a second information set 407 of fixed edge 102, a second information set 408 of fixed edge 103, and a second information set 409 of fixed edge 104 can be stored. The information "1" included in the second information set 406 is the weight 1 of the fixed edge 101 to which the second information set 406 belongs. Similarly, when the weight of each fixed edge included in the newly added subgraph 200 is obtained, the second information set of each fixed edge can be stored. The second information set can also include other information of the fixed edge, which is not limited in this embodiment.

[0086] When storing the second information sets of multiple fixed edges in the subgraph, multiple second information sets can be stored in sequence according to the order of the multiple fixed edges. Figure 5As shown, second information set 406, second information set 407, second information set 408, and second information set 409 are sequentially stored in the storage area after subgraph number 0, corresponding to first fixed edge 101, second fixed edge 102, third fixed edge 103, and fourth fixed edge 104 in subgraph 100. In the process of obtaining the fixed edges in the subgraph, the weight of each fixed edge in subgraph 100 can be obtained from the storage area after subgraph number 0 based on the storage location.

[0087] Optionally, the second information set may further include the index of the corresponding fixed edge in the graph data header.

[0088] In one embodiment, the index of the fixed edge in the graph data header can also be added to the second information set of the fixed edge. In combination with the above example, an information can be added to the second information set 406, which is the index 2 of the fixed edge 101. After setting the index in the second information set, the first connection information of the fixed edge can be obtained from the graph data header according to the index in the second information set, and the reference node numbers of the source node and the destination node connected by the fixed edge can be determined. Further, the destination node and the source node connected by the fixed edge can be determined according to the subgraph number corresponding to the second information set. For example, if the second information set of a fixed edge includes index 2, the second connection information (DR) can be determined from the graph data header according to index 2, and further, according to the subgraph number 0 corresponding to the second information set, it can be determined that the source node connected by the fixed edge is the node D0 in the subgraph 100, and the destination node is the node R0 in the subgraph 100.

[0089] In an embodiment of the present invention, a second information set for fixed edges can be stored in the graph data. This second information set can include the weights of the fixed edges. Storing the weights of the fixed edges allows for better processing of the graph data. Storing the index of the fixed edge in the second information set also facilitates obtaining the first connection information for the fixed edge from the graph data header. The second information set can also store other information about the fixed edges, which is not limited in this embodiment.

[0090] Optionally, the method may further include:

[0091] When the weight of the target non-fixed edge is obtained, the weight of the target non-fixed edge is added to the first information set.

[0092] In one embodiment, the electronic device may also obtain the weight of the non-fixed edge. The process of obtaining the weight of the non-fixed edge is the same as that of obtaining the weight of the fixed edge. In the process of obtaining the non-fixed edge, if the electronic device obtains the weight of the non-fixed edge, it may add the weight of the non-fixed edge to the first information set of the non-fixed edge. Figure 5As shown, for the target non-fixed edge 1021, the third information 10 can be added to the corresponding first information set 403. The third information 10 is the weight of the target non-fixed edge 1021. Similarly, the weights of other non-fixed edges can be obtained and added to the corresponding first information set.

[0093] In an embodiment of the present invention, the weight of the non-fixed edge can be added to the first information set of the non-fixed edge to store more information about the non-fixed edge, thereby better processing the graph data. In practical applications, other relevant information about the non-fixed edge can also be added to the first information set.

[0094] like Figure 6 As shown, Figure 6 A hardware implementation schematic diagram of a graph data storage method in an embodiment of the present invention is shown. During the storage process of graph data, a storage area can be established based on the data graph header, the first area stores the subgraph number, the second area stores the second information set corresponding to the subgraph number, and the third area stores the first information set corresponding to the subgraph number. The subgraph number of each subgraph is stored in sequence from top to bottom in the first area; in the second area, it is divided into multiple columns in sequence according to the first connection information in the graph data header, the column header of each column stores the first connection information of the fixed edge, and each column stores the weight of the corresponding fixed edge; in the third area, it is divided into multiple groups in sequence according to the second connection information in the graph data header, the group header of each group stores the second connection information, and each group includes a valid column, a source subgraph (Source unit) column, and a weight (weight) column. Among them, the source subgraph column is used to store the subgraph number of the source subgraph where the source node connected by the non-fixed edge is located, the weight column is used to store the weight of the non-fixed edge, and the valid column is used to store the valid bit. When the valid bit is 1, it indicates that the group of data is valid data. For example, Figure 6In the figure, subgraph number 0 corresponds to subgraph 100. The second region corresponding to subgraph number 0 stores the weight of fixed edge 101, the weight of fixed edge 102, the weight of fixed edge 103, and the weight of fixed edge 104, in sequence. Since the nodes in subgraph 100 are not connected to non-fixed edges as key nodes, all valid bits in the third region corresponding to subgraph number 0 are 0. Subgraph number 1 corresponds to subgraph 200. In the (PR) group in the third region corresponding to subgraph number 1, the source subgraph bit is 0, indicating that the source node connected to the non-fixed edge is in subgraph 100, the weight bit is 10, indicating that the weight of the non-fixed edge is 10, and the valid bit is 1, indicating that the data in the weight bit and the source subgraph bit are valid. The group head of the (PR) group can determine that the reference node number of the source node of the non-fixed edge connection is P, and the reference node number of the destination node is R. Further, based on the data 0 in the source subgraph position, the source node can be determined to be P0, and based on the corresponding subgraph number 1, the destination node can be determined to be R1, thereby determining the non-fixed edge P0-R1, and the weight of the non-fixed edge P0-R1 is 10. The above is only an illustrative example. The hardware storage method of the graph data can be set according to the needs, and this example does not limit this.

[0095] Optionally, the method may further include:

[0096] When the attributes of the node are obtained, a third information set of the node is stored; the third information set is stored corresponding to the subgraph number of the subgraph to which it belongs, and the third information set includes the attributes of the node.

[0097] In one embodiment, the electronic device can obtain the attributes of the node and add a third information set of the node to the graph data. The attribute information can describe the characteristics of the object corresponding to the node. For example, in the above example, each node corresponds to a pipeline stage in the instruction, and the attributes of the node can describe the characteristics of the pipeline stage. The attributes of each stage can include one or more items. In combination with the above example, when the attributes of each node are also included in the subgraph, Figure 5 and Figure 4 The graph data shown here adds a third information set for each node, which includes one or more attributes of the node. The method for setting the third information set can refer to the first information set, with the reference node number and one or more corresponding attributes set in each third information set. Optionally, if the attributes of nodes at the same position in all subgraphs are the same, the attributes corresponding to all nodes for each reference node number can be added to the graph data header.

[0098] In an embodiment of the present invention, when a node's attributes are obtained, a third information set of the node can be added to the graph data, and the node's attributes can be stored in the third information set. During the graph data processing process, the node's attributes can be obtained from the third information set to process the graph data.

[0099] Combine Figure 4 and Figure 5 As shown, when storing graph data, the structural information of multiple subgraphs can be stored through the graph data header, and the same structural information can be stored for multiple subgraphs with the same structure. At the same time, the information set can be stored based on the subgraph number, and the information set includes the weight information of the fixed edges in each subgraph, as well as the weight information of the non-fixed edges and other difference information between multiple subgraphs, thereby avoiding storing a copy of structural information for each subgraph, reducing the data volume of the graph data, and thus reducing storage space. Moreover, in the process of storing graph data, after establishing the graph data header according to the starting subgraph, for each newly added subgraph after the starting subgraph, it is only necessary to increase the subgraph number of the subgraph and the corresponding information set. The storage process is relatively simple and does not require adjustment to the structure of the graph data.

[0100] In this embodiment, the graph structure of multiple subgraphs is stored in the graph data header to avoid storing fixed edges and node sets in each subgraph, so that the graph data can be compressed. The graph data storage method provided in this embodiment can be called a unit compression structure. After the graph data is stored, when the graph data is restored based on the unit compression structure, each subgraph in the graph data can be restored based on the graph data header and the information set. During the recovery process, the subgraph number can be obtained first, and then the multiple reference node numbers and subgraph numbers corresponding to the subgraph are obtained from the graph data header to restore the multiple node sets in the subgraph. For example, if it is necessary to restore subgraph 200, multiple reference node numbers D, R, E, P and C can be obtained from the graph data header first, and then the node set of subgraph 200, namely node D0, node R0, node E0, node P0 and node C0, can be restored based on subgraph number 1 and reference node numbers D, R, E, P and C. Next, the fixed edges in subgraph 100 can be determined based on the first connection information stored in the graph data header. For example, if the first information set includes the index of the fixed edge, the first connection information can be determined from the graph data header based on the index. The source node and destination node connected by each fixed edge can be determined based on subgraph number 1, thereby determining each fixed edge in subgraph 200. Simultaneously, the weight of each fixed edge in subgraph 200 can be determined from the second information set. For non-fixed edges in subgraph 200, multiple first information sets stored can be determined based on subgraph number 1. Then, the second connection information can be determined from the graph data header based on the index in the first information set. The source node connected by the non-fixed edge can be determined based on the source subgraph number in the first information set, and the destination node can be determined based on subgraph number 2. The non-fixed edges in subgraph 200 can be determined. Simultaneously, the weight of each non-fixed edge can be obtained from the first information set of each non-fixed edge. Thus, the node set and fixed edge set in subgraph 200, as well as the weights of each non-fixed edge connected by subgraph 200, and each fixed and non-fixed edge can be restored.

[0101] In summary, in an embodiment of the present invention, graph data is acquired, a graph data header is established and stored, connection information of non-fixed edges is added to the graph data header, a subgraph number that uniquely identifies a subgraph is set and stored, and when a key node is included in the subgraph, a first information set of the key node is stored accordingly. For equal-increment graph data, a graph data header is established for multiple subgraphs, the same information between multiple subgraphs is stored through the graph data header, and the difference information between each subgraph is stored through the information set. When adjusting the graph data, it is only necessary to adjust the corresponding information set according to the node, and there is no need to adjust the structure of the entire graph data, which is time-saving.

[0102] Further, combined Figure 4 and Figure 5As shown, during the graph data storage process, only the graph data header and the weights of the fixed edges within each subgraph corresponding to the subgraph, as well as the relevant information of the corresponding non-fixed edges, need to be stored. This can avoid storing the fixed edges and node sets within each subgraph, thereby reducing the amount of stored data and reducing the storage space required during the graph data storage process.

[0103] Reference Figure 7 , shows a schematic structural diagram of a graph data storage device according to an embodiment of the present invention. The device 700 may include:

[0104] Acquisition module 701 is used to acquire graph data; the graph data includes multiple subgraphs, each subgraph includes multiple nodes and fixed edges connecting the multiple nodes; the graph data also includes at least one non-fixed edge connecting nodes in different subgraphs; the multiple subgraphs have the same graph structure;

[0105] Establishing module 702, used to establish and store a graph data header, wherein the graph data header includes structural information of the graph structure;

[0106] An adding module 703 is used to add connection information of a non-fixed edge to the graph data header, where the connection information is used to describe the source node and destination node of the non-fixed edge;

[0107] Storage module 704 is used to set and store a subgraph number that uniquely identifies a subgraph, and when a key node is included in the subgraph, store a first information set of the key node accordingly; the key node is the destination node of the target non-fixed edge; the first information set includes the subgraph number of the subgraph where the source node of the target non-fixed edge is located, and the index of the connection information of the target non-fixed edge in the graph data header.

[0108] Optionally, the storage module 704 is further configured to add the weight of the target non-fixed edge to the first information set when the weight of the target non-fixed edge is acquired.

[0109] Optionally, the storage module 704 is also used to store a second information set of the fixed edge when the weight of the fixed edge is obtained; the second information set includes the weight of the fixed edge, and the second information set is stored corresponding to the subgraph number of the subgraph where the fixed edge is located.

[0110] Optionally, the establishing module 702 includes:

[0111] An acquisition unit is used to acquire multiple reference node numbers; each reference node number corresponds to a node at the same position in multiple subgraphs;

[0112] Establishing a unit for establishing a coding matrix; the row numbers and column numbers with the same values ​​in the coding matrix correspond to the same reference node number;

[0113] An adding unit is used to determine a matrix position corresponding to a fixed edge from the encoding matrix and add the index of the corresponding fixed edge in the matrix position; the row number of the matrix position is the reference node number corresponding to the source node of the fixed edge, and the column number of the matrix position is the reference node number corresponding to the destination node of the fixed edge.

[0114] Optionally, the second information set also includes the index of the corresponding fixed edge in the graph data header.

[0115] The storage module 704 is further configured to store a third information set of the node when the attributes of the node are acquired; the third information set is stored corresponding to the subgraph number of the subgraph where the node is located, and the third information set includes the attributes of the node.

[0116] An embodiment of the present invention further provides an electronic device including the image data storage device described above.

[0117] Figure 8 The electronic device 800 is a block diagram of an electronic device according to an embodiment of the present invention. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0118] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0119] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.

[0120] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0121] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0122] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0123] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0124] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0125] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect changes in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and temperature changes of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0126] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0127] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0128] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0129] A non-transitory computer-readable storage medium enables the electronic device to perform a graph data storage method when instructions in the storage medium are executed by a processor of the electronic device.

[0130] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0131] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, embodiments of the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0132] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0133] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0135] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0136] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0137] The above is a detailed introduction to a method and device for storing image data, an electronic device and a storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A graph data storage method, characterized in that: include: Obtaining graph data; the graph data includes a plurality of subgraphs, each of the subgraphs including a plurality of nodes and fixed edges connecting the plurality of nodes; the graph data also includes at least one non-fixed edge connecting nodes in different subgraphs; the plurality of subgraphs having the same graph structure; Establishing and storing a graph data header, wherein the graph data header includes structural information of the graph structure; the graph data header uses the same reference node number to represent nodes at the same position in different subgraphs, uses multiple reference node numbers to describe sets of nodes in multiple subgraphs, and uses connection relationships between multiple reference node numbers to describe sets of fixed edges in multiple subgraphs; Adding connection information of the non-fixed edge to the graph data header, where the connection information is used to describe the source node and destination node of the non-fixed edge; A subgraph number that uniquely identifies the subgraph is set and stored, and when a key node is included in the subgraph, a first information set of the key node is correspondingly stored; the key node is the destination node of the target non-fixed edge; the first information set includes the subgraph number of the subgraph where the source node of the target non-fixed edge is located, and the index of the connection information of the target non-fixed edge in the graph data header.

2. The method according to claim 1, characterized in that Also includes: When the weight of the target non-fixed edge is obtained, the weight of the target non-fixed edge is added to the first information set.

3. The method according to claim 1, characterized in that Also includes: When the weight of the fixed edge is obtained, a second information set of the fixed edge is stored; the second information set includes the weight of the fixed edge, and the second information set is stored corresponding to the subgraph number of the subgraph where the fixed edge is located.

4. The method according to claim 1, wherein The step of establishing and storing the graph data header includes: Establishing a coding matrix; wherein the row numbers and column numbers with the same values ​​in the coding matrix correspond to the same reference node number; Determine a matrix position corresponding to the fixed edge from the encoding matrix, and add an index corresponding to the fixed edge to the matrix position; the row number of the matrix position is the reference node number corresponding to the source node of the fixed edge, and the column number of the matrix position is the reference node number corresponding to the destination node of the fixed edge.

5. The method according to claim 3, characterized in that The second information set also includes the index of the corresponding fixed edge in the graph data header.

6. The method according to any one of claims 1 to 5, characterized in that Also includes: When the attributes of the node are obtained, a third information set of the node is stored; the third information set is stored corresponding to the subgraph number of the subgraph where the node is located, and the third information set includes the attributes of the node.

7. A graph data storage device, characterized in that: include: an acquisition module configured to acquire graph data; the graph data comprising a plurality of subgraphs, each of the subgraphs comprising a plurality of nodes and fixed edges connecting the plurality of nodes; the graph data further comprising at least one non-fixed edge connecting nodes in different subgraphs; the plurality of subgraphs having the same graph structure; An establishment module is configured to establish and store a graph data header, wherein the graph data header includes structural information of the graph structure; the graph data header uses the same reference node number to represent nodes at the same position in different subgraphs, uses multiple reference node numbers to describe sets of nodes in multiple subgraphs, and uses connection relationships between multiple reference node numbers to describe sets of fixed edges in multiple subgraphs; An adding module, configured to add connection information of the non-fixed edge to the graph data header, wherein the connection information is used to describe a source node and a destination node of the non-fixed edge; A storage module is used to set and store a subgraph number that uniquely identifies the subgraph, and when a key node is included in the subgraph, store a first information set of the key node accordingly; the key node is the destination node of the target non-fixed edge; the first information set includes the subgraph number of the subgraph where the source node of the target non-fixed edge is located, and the index of the connection information of the target non-fixed edge in the graph data header.

8. The device according to claim 7, characterized in that The storage module is further configured to add the weight of the target non-fixed edge to the first information set when the weight of the target non-fixed edge is acquired.

9. The device according to claim 7, characterized in that The storage module is further configured to store a second information set of the fixed edge when the weight of the fixed edge is obtained; the second information set includes the weight of the fixed edge, and the second information set is stored corresponding to the subgraph number of the subgraph where the fixed edge is located.

10. The device according to claim 7, characterized in that The establishment module includes: An establishing unit, configured to establish a coding matrix; wherein row numbers and column numbers with the same values ​​in the coding matrix correspond to the same reference node number; an adding unit, configured to determine a matrix position corresponding to the fixed edge from the encoding matrix, and add an index corresponding to the fixed edge in the matrix position; the row number of the matrix position is a reference node number corresponding to the source node of the fixed edge, and the column number of the matrix position is a reference node number corresponding to the destination node of the fixed edge.

11. The device according to claim 9, characterized in that The second information set also includes the index of the corresponding fixed edge in the graph data header.

12. The device according to any one of claims 7 to 11, characterized in that The storage module is further configured to store a third information set of the node when the attributes of the node are acquired; the third information set is stored corresponding to the subgraph number of the subgraph where the node is located, and the third information set includes the attributes of the node.

13. An electronic device, characterized in that: The invention comprises a graph data storage device as described in any one of claims 7 to 12.

Citation Information

Patent Citations

  • Graph data processing method and device, electronic equipment and storage medium

    CN112000848A

  • Sub-graph matching method, device and equipment and storage medium

    CN112667860A