Graph data structure representation, storage and query method and device based on hierarchical coding
A technology of hierarchical coding and graph data, applied in graph data query, query optimization, graph database, graph field, and can solve problems such as unsatisfactory efficiency
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0046] A hierarchical encoding method for nodes in an acyclic graph: This method aims to realize the dimensionality reduction representation of special structures in the graph through encoding. If a part of the graph database satisfies this definition, then this part can be regarded as an acyclic subgraph in the graph database. For an acyclic subgraph, the following coding method can be used to describe the relationship between nodes:
[0047] (1) In a directed acyclic subgraph, find all nodes without incoming edges (ie root nodes). Denote the set of these nodes as L1.
[0048] (2) Let the logarithmic value of the data size in L1 be base 2 v=log 2 size(L1), and round up v, so that The nodes in the collection are numbered sequentially using an m-bit binary encoding. For example: if L1 contains 1 node, then m=1, then the code of this node is "0". If L1 contains 3 nodes, then v=2, and the binary codes of the three nodes are: 00, 01, 10 respectively.
[0049] (3) Denote t...
Embodiment 2
[0056] In order to make full use of the hierarchical coding described in the content of the invention to speed up the query, the present invention proposes an improved method for storing graph data, which is described as follows:
[0057] (1) For an acyclic subgraph, calculate its "level code" for each node according to the method described in Summary 1 of the invention.
[0058] (2) Treat the level coding of each node as a special attribute of the node. This special attribute is different from user data and belongs to the metadata category of database management.
[0059] (3) Construct a table for the acyclic subgraph, the table includes two columns, the first column is the "level code" of each node in the table, and the second column is the id of each node in the table. Save the correspondence between the table and the acyclic subgraph for subsequent lookups.
[0060] (4) Sort the table according to the first column, and the sorting basis is: lexicographical ascending order....
Embodiment 3
[0064] In an acyclic subgraph, graph queries starting from a certain node can be divided into four types:
[0065] 1. All child nodes of a node;
[0066] 2. All parent nodes of a node;
[0067] 3. A child node of a node that does not exceed the specified number of hops;
[0068] 4. The parent node of a node that does not exceed the specified hop count.
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


