Graph data storage method, device, equipment and storage medium

By generating and inserting node and edge index entries into direct and indirect storage groups or lists, latency jitter during graph data storage and access is resolved, enabling fast graph data storage and retrieval, especially improving the read speed of node adjacency relationships in external storage devices.

CN116910312BActive Publication Date: 2026-03-24SUZHOU AEROSPACE INFORMATION RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, the large difference in the number of adjacent edges between super nodes and other nodes leads to latency jitter in the storage and retrieval of graph data, especially in environments with limited memory where graph data cannot be stored and accessed effectively.

Method used

In response to the target graph storage request, multiple node index entries and edge index entries are generated. Based on the connection relationship, the edge index entries are inserted into the direct storage group or indirect storage list of the target node index entries. Discrete storage is performed using the direct storage group and indirect storage list to achieve parallel reading of node adjacency relationships.

Benefits of technology

It solves the latency jitter problem in graph data storage and access, and realizes fast storage and retrieval of target graphs, especially in external storage devices, improving the reading speed of node adjacency relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116910312B_ABST
    Figure CN116910312B_ABST
Patent Text Reader

Abstract

The present disclosure provides a graph data storage method, device, equipment and storage medium, which can be applied to the technical field of database. The method is applied to a target storage device, and includes: in response to receiving a target graph storage request, obtaining a plurality of node index items and a plurality of edge index items based on a target graph, wherein the target graph includes a plurality of nodes and a plurality of edges, and the node index item includes a direct storage group and an indirect storage list; for each edge in the plurality of edges, determining a target node connected with the edge based on the connection relationship between each node in the plurality of nodes in the target graph and the edge; and inserting the edge index item corresponding to the edge into the direct storage group or the indirect storage list of the target node index item corresponding to the target node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of database technology, and in particular to a graph data storage method, apparatus, device, medium, and program product. Background Technology

[0002] Graph data, also known as graph-structured data, can intuitively reflect entities and their relationships. In many fields, graphs modeled from real-world information belong to scale-free network graphs. Scale-free networks Figure 1 Generally, it follows a power-law distribution, meaning there exists a supernode with a much larger number of adjacent edges than other nodes.

[0003] In realizing the concept disclosed herein, the inventors discovered at least the following problems in the related technology: due to the significant difference in the number of adjacent edges between super nodes and other nodes, storing and retrieving super nodes takes longer than retrieving other nodes, resulting in latency jitter issues in both the storage and access of graph data. Summary of the Invention

[0004] In view of the above problems, this disclosure provides graph data storage methods, apparatus, devices, media and program products.

[0005] According to a first aspect of this disclosure, a graph data storage method is provided, comprising: in response to receiving a target graph storage request, obtaining a plurality of node index entries and a plurality of edge index entries based on the target graph, wherein the target graph includes a plurality of nodes and a plurality of edges, and the node index entries include a direct storage group and an indirect storage list; for each of the plurality of edges, determining a target node connected to the edge based on the connection relationship between the plurality of nodes in the target graph and the edge; and inserting the edge index entry corresponding to the edge into the direct storage group or the indirect storage list of the target node index entry corresponding to the target node.

[0006] According to embodiments of this disclosure, inserting the edge index entry corresponding to the edge into the direct storage group or indirect storage list of the target node index entry corresponding to the target node includes: determining the target node index entry corresponding to the target node based on the primary key of the target node; determining first storage capacity information of the direct storage group of the target node index entry, wherein the first storage capacity information represents the storage capacity information already occupied in the direct storage group; inserting the edge index entry into the direct storage group when the first storage capacity information is less than a storage threshold; and inserting the edge index entry into the indirect storage list when the first storage capacity information is greater than or equal to the storage threshold.

[0007] According to embodiments of this disclosure, the target node includes the starting node of the edge and the pointing node of the edge; the target node index includes the starting node index and the pointing node index; the direct storage group includes the direct outgoing edge group and the direct incoming edge group; the first storage capacity information of the direct storage group for determining the target node index includes: for the starting node, determining the first storage capacity information of the direct outgoing edge group of the starting node index, wherein the starting node index is an index corresponding to the starting node; for the pointing node, determining the first storage capacity information of the direct incoming edge group of the pointing node index, wherein the pointing node index is an index corresponding to the pointing node.

[0008] According to an embodiment of this disclosure, inserting the edge index item into the direct storage group when the first storage capacity information is less than the storage threshold includes: inserting the edge index item into the direct outgoing edge group of the starting node index item when the first storage capacity information of the direct outgoing edge group is less than the storage threshold; and inserting the edge index item into the direct incoming edge group of the pointing node index item when the first storage capacity information of the direct incoming edge group is less than the storage threshold.

[0009] According to embodiments of this disclosure, the indirect storage list includes an indirect outgoing edge group list; inserting the edge index item into the indirect storage list when the first storage capacity information is greater than or equal to the storage threshold includes: when the first storage capacity information of the direct outgoing edge group is greater than or equal to the storage threshold, determining a target indirect outgoing edge group based on the indirect outgoing edge group list, wherein the indirect outgoing edge group list stores address information of multiple indirect outgoing edge groups; determining second storage capacity information of the target indirect outgoing edge group based on the address information of the target indirect outgoing edge group; when the second storage capacity information is less than the storage threshold, determining to insert the edge index item into the indirect outgoing edge group, wherein the second storage capacity information represents the storage capacity information already occupied in the target indirect outgoing edge group; when the second storage capacity information is greater than or equal to the storage threshold, determining to create a new indirect outgoing edge group; and inserting the edge index item into the new indirect outgoing edge group.

[0010] According to embodiments of this disclosure, the indirect storage list includes an indirect incoming edge group list; inserting the edge index item into the indirect storage list when the first storage capacity information is greater than or equal to the storage threshold includes: when the first storage capacity information of the direct incoming edge group is greater than or equal to the storage threshold, determining a target indirect incoming edge group based on the indirect incoming edge group list, wherein the indirect incoming edge group list stores address information of multiple indirect incoming edge groups; determining second storage capacity information of the target indirect incoming edge group based on the address information of the target indirect incoming edge group, wherein the second storage capacity information represents the storage capacity information already occupied in the target indirect incoming edge group; when the second storage capacity information is less than the storage threshold, determining to insert the edge index item into the indirect incoming edge group; when the second storage capacity information is greater than or equal to the storage threshold, determining to create a new indirect incoming edge group; and inserting the edge index item into the new indirect incoming edge group.

[0011] According to embodiments of this disclosure, based on target metrics, multiple edge index items in the direct storage group or indirect storage list of the target node index items are sorted to obtain a sorting result; and based on the sorting result, the insertion position of each of the multiple edge index items in the direct storage group is updated.

[0012] According to an embodiment of this disclosure, when the third storage capacity information of the direct storage group is greater than or equal to the target threshold, based on the sorting result, a side index item to be updated is determined from the plurality of side index items, wherein the third storage capacity information represents the storage capacity information already occupied in the direct storage group after the insertion position of the plurality of side index items in the direct storage group has been updated based on the sorting result; the side index item to be updated is then inserted into the indirect storage list.

[0013] According to embodiments of this disclosure, the edge index item includes at least one of the following: the primary key of the edge, the primary key of the starting node, the primary key of the pointing node, the weight, and the attribute.

[0014] A second aspect of this disclosure provides a graph data storage apparatus, comprising: an index item generation module, configured to, in response to receiving a target graph storage request, obtain a plurality of node index items and a plurality of edge index items based on the target graph, wherein the target graph includes a plurality of nodes and a plurality of edges, and the node index items include a direct storage group and an indirect storage list; a target node determination module, configured to, for each of the plurality of edges, determine a target node connected to the edge based on the connection relationship between the plurality of nodes in the target graph and the edge; and an edge index item insertion module, configured to insert the edge index item corresponding to the edge into the direct storage group or the indirect storage list of the target node index item corresponding to the target node.

[0015] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the method described above.

[0016] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the methods described above.

[0017] The fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0018] According to the graph data storage method provided in this disclosure, multiple node index items and multiple edge index items are obtained based on a target graph, which includes multiple nodes and multiple edges. The node index items include a direct storage group and an indirect storage list. Based on the connection relationships between nodes and edges in the target graph, the target nodes connected to each edge can be determined, and the edge index items corresponding to each edge can be inserted into the direct storage group or indirect storage list of the target node index items corresponding to the target nodes. Since multiple node index items and multiple edge index items are generated based on the multiple nodes and edges included in the target graph, and the edge index items are inserted into the direct storage group or indirect storage list of the node index items based on the connection relationships between each node and each edge, the adjacency relationships of each node in the target graph are stored discretely. Therefore, this method at least partially solves the latency jitter problem existing in related technologies when storing or accessing target graphs, and achieves the technical effect of improving the reading speed of node adjacency relationships by enabling the reading of only a portion of the data in the target graph, such as reading only important data, and by enabling parallel reading of the node index items included in the direct storage group and the node storage list. Attached Figure Description

[0019] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0020] Figure 1 The illustrations depict application scenarios of graph data storage methods, apparatuses, devices, media, and program products according to embodiments of the present disclosure.

[0021] Figure 2 A flowchart illustrating a graph data storage method according to an embodiment of the present disclosure is shown schematically.

[0022] Figure 3a A schematic diagram of a node index item according to an embodiment of the present disclosure is shown;

[0023] Figure 3b A schematic diagram of an edge index item according to an embodiment of the present disclosure is shown;

[0024] Figure 4 This schematically illustrates a flowchart of inserting edge index entries into a direct storage group or an indirect storage list according to embodiments of the present disclosure;

[0025] Figure 5 A schematic diagram of a target drawing according to an embodiment of the present disclosure is shown;

[0026] Figure 6 This illustration schematically shows a diagram of inserting edge index entries into node index entries in a target graph according to an embodiment of the present disclosure;

[0027] Figure 7 This schematically illustrates a flowchart of reordering edge index items in node index items based on target metrics according to an embodiment of the present disclosure;

[0028] Figure 8 This illustration schematically shows a diagram of updating the insertion position of the edge index item in the node index item based on the target index according to an embodiment of the present disclosure;

[0029] Figure 9 A schematic block diagram of a graph data storage device according to an embodiment of the present disclosure is shown; and

[0030] Figure 10 A block diagram schematically illustrates an electronic device suitable for implementing a graph data storage method according to an embodiment of the present disclosure. Detailed Implementation

[0031] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0032] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0033] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0034] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).

[0035] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of data (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.

[0036] Graph data, also known as graph-structured data, can intuitively reflect entities and their relationships. In many fields, graphs modeled from real-world information are scale-free network graphs. Scale-free network graphs follow a power-law distribution, meaning that a few nodes in the graph have a degree much greater than other nodes. The degree of a node is usually referred to as the number of edges connected to that node. For example, social network graphs are typical scale-free network graphs, where a few accounts have a large number of followers, while most accounts have only a small number of followers. We call these nodes with a degree much greater than other nodes supernodes. The outgoing and incoming edges of a vertex are collectively called its adjacent edges; supernodes have far more adjacent edges than other vertices. Graph data can generally be stored using graph databases, which can efficiently store and process graph data.

[0037] During the research, it was found that due to the order of magnitude of the degree of the supernode itself and the huge difference between its degree and that of other nodes, the impact of the supernode on performance needs to be considered when storing the supernode. Furthermore, in some low-memory operating environments, there will be a problem that the memory is too small to read all the information included in the graph data.

[0038] Embodiments of this disclosure provide a graph data storage method. In response to receiving a target graph storage request, multiple node index entries and multiple edge index entries are obtained based on the target graph. The target graph includes multiple nodes and multiple edges, and the node index entries include a direct storage group and an indirect storage list. For each edge, a target node connected to the edge is determined based on the connection relationships between the multiple nodes in the target graph and the edge. The edge index entry corresponding to the edge is inserted into the direct storage group or indirect storage list of the target node index entry corresponding to the target node.

[0039] Figure 1 The illustration schematically depicts application scenarios of graph data storage methods, apparatuses, devices, media, and program products according to embodiments of the present disclosure.

[0040] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0041] Users can interact with server 105 via network 104 using at least one of the first terminal device 101, second terminal device 102, and third terminal device 103 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, second terminal device 102, and third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0042] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0043] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0044] It should be noted that the graph data storage method provided in this embodiment can generally be executed by server 105. Correspondingly, the graph data storage device provided in this embodiment can generally be located in server 105. The graph data storage method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the graph data storage device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.

[0045] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0046] The following will be based on Figure 1 The described scene, through Figures 2-8 The graph data storage method of the disclosed embodiments will be described in detail.

[0047] Figure 2 A flowchart illustrating a graph data storage method according to an embodiment of the present disclosure is shown schematically.

[0048] like Figure 2 As shown, the graph data storage method of this embodiment includes operations S210 to S230.

[0049] In operation S210, in response to receiving a target graph storage request, multiple node index items and multiple edge index items are obtained based on the target graph. The target graph includes multiple nodes and multiple edges, and the node index items include a direct storage group and an indirect storage list.

[0050] According to embodiments of this disclosure, upon receiving a target graph storage request, node index items and edge index items can be established based on the multiple nodes and multiple edges included in the target graph.

[0051] According to embodiments of this disclosure, node index items may include a node's primary key, node label, node attributes, direct storage group, and indirect storage list, etc. Other requirements may be added to the node index items, or the aforementioned items may be deleted, depending on actual needs. The direct storage group may include direct outgoing edge groups and direct incoming edge groups. The indirect storage list may include a list of indirect outgoing edge groups and a list of indirect incoming edge groups.

[0052] According to embodiments of this disclosure, the edge index entries stored in the direct storage group are edge index entries directly stored within the node index entries.

[0053] According to embodiments of this disclosure, the indirect outgoing edge group list can store logical address information or primary keys, or other data that can be indexed to each indirect outgoing edge group. Similarly, the indirect incoming edge group list can store logical address information or primary keys, or other data that can be indexed to each indirect incoming edge group.

[0054] According to embodiments of this disclosure, the storage group used to store the outgoing edges of a node is called its outgoing edge group, and the storage group used to store the incoming edges is called its incoming edge group.

[0055] According to the embodiments of this disclosure, the data information included in the edge index item is not limited. For example, the edge index item may include the primary key of the edge, the primary key of the starting node, and the primary key of the pointing node. In addition, it may also have information such as weight and attributes. Similarly, other data information may be added to the edge index item or the above items may be deleted according to actual needs.

[0056] According to embodiments of this disclosure, a storage threshold can be set for storing edge index items in direct outgoing edge groups, direct incoming edge groups, indirect outgoing edge groups, and indirect incoming edge groups. The storage threshold can be the number of stored edge index items or other quantities, such as storage resource utilization. The number of stored edge index items in different storage groups of each node can be the same or different. The number of stored edge index items in the same type of storage group of index items of different nodes can be the same or different.

[0057] According to embodiments of this disclosure, the storage format for node index items and edge index items is not limited. For example, a hash table or other table or text storage formats can be used to store node index items. When using a hash table to store node index items, the node's primary key serves as the key of the hash table, and the node index item serves as the value of the hash table. In this case, both the direct storage group and the indirect storage list in the node index item are empty.

[0058] Figure 3a A schematic diagram of a node index item according to an embodiment of the present disclosure is shown.

[0059] like Figure 3a The diagram illustrates a storage method for node index entries. Each node index entry includes a node primary key, direct outgoing edge groups, direct incoming edge groups, a list of indirect outgoing edge groups, a list of indirect incoming edge groups, a label, and attributes. The direct outgoing edge groups and direct incoming edge groups each store multiple edge index entries. The lists of indirect outgoing edge groups and indirect incoming edge groups each store the logical address information of multiple indirect outgoing edge groups and indirect incoming edge groups, such as the indirect outgoing edge group corresponding to logical address 1 in the indirect outgoing edge group list, which includes multiple edge index entries.

[0060] Figure 3b A schematic diagram of a side index item according to an embodiment of the present disclosure is shown.

[0061] like Figure 3b As shown, this illustrates a storage method for edge index entries, which includes the edge's primary key, label, starting node primary key, pointing node primary key, weight, and the edge's attribute information.

[0062] According to embodiments of this disclosure, node index entries and edge index entries are established based on multiple nodes and edges included in the target graph. Each node index entry and each edge index entry includes multiple data entries, laying the foundation for discrete storage of node adjacency relationships. Simultaneously, the structure of the direct storage group and indirect storage list based on the node index entries enables discrete storage of node adjacency relationships in blocks. Based on the logical addresses of a direct storage group included in a node index entry and multiple indirect outgoing edge groups and indirect incoming edge groups stored in the indirect storage list, the node adjacency relationships are stored as a direct block and multiple indirect blocks. During access, the direct block and multiple indirect blocks can be read in parallel, accelerating the reading speed of the target graph. Furthermore, the discrete storage method also speeds up the storage of the target graph.

[0063] In operation S220, for each of the multiple edges, the target node connected to the edge is determined based on the connection relationship between the multiple nodes in the target graph and the edge.

[0064] According to embodiments of this disclosure, for each edge, the target node connected to each edge can be determined based on the connection relationship between nodes and edges in the target graph. For example, edge e1 includes connections to two nodes, and these two nodes can be considered as target nodes.

[0065] According to embodiments of this disclosure, the target node may include a starting node and a pointing node.

[0066] According to embodiments of this disclosure, the association between nodes and edges in the target graph can be stored in an edge index entry. For example, the starting node connected to the edge corresponding to the edge index entry and the primary key of the pointing node can be stored in the edge index entry, so that when determining the target node connected to the edge, it can be directly determined from the multiple nodes included in the target graph.

[0067] According to embodiments of this disclosure, the starting node and the pointing node of the edge can also be located directly from the target graph to find the target node connected to the edge.

[0068] According to embodiments of this disclosure, the target node of each edge is determined by the connection relationship between each node and each edge in the target graph and by the primary key of the starting node and the primary key of the target node in the edge index item. This allows for the rapid determination of the adjacent edges of each node, thereby accelerating the storage speed of the target graph.

[0069] In operation S230, the edge index entry corresponding to the edge is inserted into the direct storage group or indirect storage list of the target node index entry corresponding to the target node.

[0070] According to embodiments of this disclosure, based on the storage capacity information of the direct storage group, the edge index item can be stored in the direct storage or indirect storage list of the target node index item. If there is still storage space in the direct storage group, the edge index item can be stored in the direct storage group. If there is no storage space for the edge index item, the edge index item can be stored in the indirect storage list.

[0071] According to embodiments of this disclosure, the graph data storage method of this disclosure can be used in internal storage devices, such as computer memory, or in external storage devices. When used in external storage devices, it has the following advantages compared to internal storage devices: Since the analysis and storage of large-scale graphs rely on large-capacity storage, the device cost of external storage devices is lower than that of internal storage devices; using external storage devices can reduce the requirements for computer memory when performing analysis, calculation, and storage operations on the target graph; and it can store the adjacent edges of the same node in groups, which better meets the characteristic that the sequential read and write speed of external storage devices is much higher than the random read and write speed, enabling faster storage of the adjacent edge relationships of each node included in the target graph, and avoiding the problem that the existence of super nodes in the target graph will cause significant differences in the size of each storage group, and that aligning the storage groups through padding and other techniques will lead to a large amount of waste and overall performance degradation.

[0072] According to the graph data storage method provided in this disclosure, multiple node index items and multiple edge index items are obtained based on a target graph, which includes multiple nodes and multiple edges. The node index items include a direct storage group and an indirect storage list. Based on the connection relationships between nodes and edges in the target graph, the target nodes connected to each edge can be determined, and the edge index items corresponding to each edge can be inserted into the direct storage group or indirect storage list of the target node index items corresponding to the target nodes. Since multiple node index items and multiple edge index items are generated based on the multiple nodes and edges included in the target graph, and the edge index items are inserted into the direct storage group or indirect storage list of the node index items based on the connection relationships between each node and each edge, the adjacency relationships of each node in the target graph are stored discretely. Therefore, this method at least partially solves the latency jitter problem existing in related technologies when storing or accessing target graphs, and achieves the technical effect of improving the reading speed of node adjacency relationships by enabling the reading of only a portion of the data in the target graph, such as reading only important data, and by enabling parallel reading of the node index items included in the direct storage group and the node storage list.

[0073] Figure 4 The flowchart illustrating the insertion of edge index entries into a direct storage group or an indirect storage list according to an embodiment of the present disclosure is shown schematically.

[0074] like Figure 4 As shown, inserting edge index items into the direct storage group or the indirect storage list in this embodiment includes operations S231 to S234.

[0075] In operation S231, the target node index item corresponding to the target node is determined based on the primary key of the target node.

[0076] In operation S232, the first storage capacity information of the direct storage group of the target node index item is determined, wherein the first storage capacity information represents the storage capacity information already occupied in the direct storage group.

[0077] In operation S233, if the first storage capacity information is less than the storage threshold, the edge index item is inserted into the direct storage group.

[0078] In operation S234, if the first storage capacity information is greater than or equal to the storage threshold, the edge index item is inserted into the indirect storage list.

[0079] According to embodiments of this disclosure, based on the primary key of the target node, the target index entry corresponding to the target node can be determined, and the first storage capacity information of the direct storage group in the target index entry can be determined. If the first storage capacity information indicates that the direct storage group is full, the logical address of the last indirect indirect edge group or indirect out edge group can be found by accessing the logical addresses of the multiple indirect inbound edge groups or multiple indirect outbound edge groups included in the indirect storage list, and accessed. If the indirect inbound edge group or indirect outbound edge group is not full, the edge index entry is inserted into the indirect inbound edge group or indirect outbound edge group.

[0080] According to embodiments of this disclosure, by determining the target node index item corresponding to the target node and determining the first storage capacity information of the direct storage group in the first target node index item, and based on whether the first storage capacity information is greater than the storage threshold, it can be determined whether to insert the edge index item into the direct storage group or the indirect storage list. The setting of the storage threshold can make the number of edge index items stored in each node index item or the storage amount occupied the same. When the direct storage group is full, the edge index item can be inserted into the indirect storage list. Thus, edge index items other than the storage threshold can be predetermined during storage. The process of inserting edge index items into the indirect storage list is synchronized with the process of inserting edge index items into the direct storage group, making the storage process of the target graph faster. Furthermore, when reading each node, based on the discrete storage method, the edge index items in the direct storage group or the indirect storage list can be read in parallel, thereby speeding up the reading speed of the node and better avoiding the latency jitter problem of storing or reading the target graph.

[0081] According to embodiments of this disclosure, the target node includes the starting node of the edge and the pointing node of the edge; the target node index includes the starting node index and the pointing node index; the direct storage group includes the direct outgoing edge group and the direct incoming edge group; determining the first storage capacity information of the direct storage group of the target node index may include the following operations.

[0082] For the starting node, determine the first storage capacity information of the direct outgoing edge group of the starting node index item, where the starting node index item is the index item corresponding to the starting node; for the pointing node, determine the first storage capacity information of the direct incoming edge group of the pointing node index item, where the pointing node index item is the index item corresponding to the pointing node.

[0083] According to embodiments of this disclosure, the target node of an edge may include the starting node of the edge and the node to which the edge points. For the starting node, the edge can be equivalent to an outgoing edge of the starting node, and during storage, the edge index entry corresponding to the edge can be stored in the direct outgoing edge group of the starting node index entry corresponding to the starting node. For the pointing node, the edge can be equivalent to an incoming edge of the pointing node, and during storage, the edge index entry corresponding to the edge can be stored in the direct incoming edge group of the pointing node index entry corresponding to the pointing node.

[0084] According to embodiments of this disclosure, the storage capacity information of the direct storage group can be determined before storing the edge index item. If there is storage space in the direct storage group, the edge can be inserted. This can avoid the problem of insufficient storage space when storing the node index item, which may cause errors or incorrect storage, thereby speeding up the storage rate of the node index item, i.e., speeding up the storage rate of the node adjacency relationship.

[0085] According to embodiments of this disclosure, inserting a side index item into the direct storage group when the first storage capacity information is less than a storage threshold may include the following operations.

[0086] If the first storage capacity information of the direct outgoing edge group is less than the storage threshold, the edge index entry is inserted into the direct outgoing edge group of the starting node index entry; if the first storage capacity information of the direct incoming edge group is less than the storage threshold, the edge index entry is inserted into the direct incoming edge group of the pointing node index entry.

[0087] According to embodiments of this disclosure, for a starting node, if it is determined that there is still storage space available for the direct outgoing edge group of the starting node's index item, the edge index item is inserted into the direct outgoing edge group of the starting node's index item. For a pointing node, if it is determined that there is still storage space available for the direct incoming edge group of the pointing node's index item, the edge index item is inserted into the direct incoming edge group of the pointing node's index item.

[0088] According to embodiments of this disclosure, the indirect storage list includes an indirect outgoing edge group list; when the first storage capacity information is greater than or equal to the storage threshold, inserting the edge index item into the indirect storage list may include the following operations.

[0089] If the first storage capacity information of the direct outgoing edge group is greater than or equal to the storage threshold, a target indirect outgoing edge group is determined based on the indirect outgoing edge group list, wherein the indirect outgoing edge group list stores the address information of multiple indirect outgoing edge groups; based on the address information of the target indirect outgoing edge group, a second storage capacity information of the target indirect outgoing edge group is determined, wherein the second storage capacity information represents the storage capacity already occupied in the target indirect outgoing edge group; if the second storage capacity information is less than the storage threshold, it is determined to insert the edge index item into the indirect outgoing edge group; if the second storage capacity information is greater than or equal to the storage threshold, it is determined to create a new indirect outgoing edge group; and the edge index item is inserted into the new indirect outgoing edge group.

[0090] According to embodiments of this disclosure, the indirect storage list includes an indirect outgoing edge group list, which stores address information or primary keys and other information that can be indexed to the indirect outgoing edge groups.

[0091] According to embodiments of this disclosure, the corresponding indirect outgoing edge group can be found based on the address information of each indirect outgoing edge group stored in the indirect outgoing edge group list. When the first storage capacity information of the direct outgoing edge group is greater than or equal to the storage threshold, i.e., when the direct outgoing edge group is full, a target indirect outgoing edge group can be determined from multiple indirect outgoing edge groups. The target indirect outgoing edge group is an indirect outgoing edge group that still has storage space. The target indirect outgoing edge group can be the indirect outgoing edge group with the shortest creation time, or it can be the indirect outgoing edge group whose address information is arranged last in the indirect outgoing edge group list, or it can be any indirect outgoing edge group that still has storage space among multiple indirect outgoing edge groups.

[0092] According to the embodiments of this disclosure, the second storage capacity information of the target indirect outgoing edge group can be determined. If the second storage capacity information of the target indirect outgoing edge group does not reach the storage threshold, i.e., the target indirect outgoing edge group is not full, the edge index item can be inserted into the target indirect outgoing edge group. If the second storage capacity information of the target indirect outgoing edge group reaches the storage threshold, i.e., the target indirect outgoing edge group is full, a new indirect outgoing edge group can be created to store the edge index item.

[0093] According to embodiments of this disclosure, the indirect storage list includes an indirect inbound edge group list; when the first storage capacity information is greater than or equal to the storage threshold, inserting the edge index item into the indirect storage list may include the following operations.

[0094] If the first storage capacity information of the direct incoming edge group is greater than or equal to the storage threshold, a target indirect incoming edge group is determined based on the indirect incoming edge group list, wherein the indirect incoming edge group list stores the address information of multiple indirect incoming edge groups; based on the address information of the target indirect incoming edge group, a second storage capacity information of the target indirect incoming edge group is determined, wherein the second storage capacity information represents the storage capacity already occupied in the target indirect incoming edge group; if the second storage capacity information is less than the storage threshold, it is determined to insert the edge index item into the indirect incoming edge group; if the second storage capacity information is greater than or equal to the storage threshold, it is determined to create a new indirect incoming edge group; and the edge index item is inserted into the new indirect incoming edge group.

[0095] According to embodiments of this disclosure, the indirect storage list includes an indirect incoming edge group list, which stores address information or primary keys and other information that can be indexed to the indirect incoming edge group for each of the multiple indirect incoming edge groups.

[0096] According to embodiments of this disclosure, the corresponding indirect incoming edge group can be found based on the address information of each indirect incoming edge group stored in the indirect incoming edge group list. When the first storage capacity information of the direct incoming edge group is greater than or equal to the storage threshold, i.e., when the direct incoming edge group is full, a target indirect incoming edge group can be determined from multiple indirect incoming edge groups. The target indirect incoming edge group is an indirect incoming edge group that still has storage space. The target indirect incoming edge group can be the indirect incoming edge group with the shortest creation time, or the indirect incoming edge group whose address information is last in the indirect incoming edge group list, or any indirect incoming edge group that still has storage space among multiple indirect incoming edge groups.

[0097] According to the embodiments of this disclosure, the second storage capacity information of the target indirect inbound edge group can be determined. If the second storage capacity information of the target indirect inbound edge group does not reach the storage threshold, i.e., the target indirect inbound edge group is not full, the edge index item can be inserted into the target indirect inbound edge group. If the second storage capacity information of the target indirect inbound edge group reaches the storage threshold, i.e., the target indirect inbound edge group is full, a new indirect inbound edge group can be created to store the edge index item.

[0098] Figure 5 A schematic diagram of a target figure according to an embodiment of the present disclosure is shown.

[0099] like Figure 5The target graph shown includes nodes v1, v2, and v3, and edges e1, e2, e3, and e4. Node v1 is the starting node of edge e1, and edge e1 is an outgoing edge of node v1. Node v2 is the pointing node of edge e2, edge e1 is an incoming edge of node v2, v2 is the starting node of edge e2, and edge e2 is an outgoing edge of node v2. Node v3 is the pointing node of edge e2, and edge e2 is an incoming edge of node v3. Node v3 is the starting node of edges e2 and e3, and edges e2 and e3 are outgoing edges of node v3. Node v2 is the pointing node of edges e2 and e3, and edges e2 and e3 are incoming edges of node v2.

[0100] According to embodiments of this disclosure, the number of nodes and edge data included in the target graph are not limited. Figure 5 The number of nodes and edges in the target graph shown is illustrative.

[0101] Figure 6 The illustration shows a schematic diagram of inserting edge index entries in a target graph into node index entries according to an embodiment of the present disclosure.

[0102] like Figure 6 As shown, with Figure 5 Taking the target graph shown as an example, node index entries corresponding to nodes v1, v2, and v3, and edge index entries corresponding to edges e1, e2, e3, and e4 are created in sequence. The edge index entries corresponding to edges e1, e2, e3, and e4 are then inserted into the corresponding target node index entries.

[0103] As shown in 601, when inserting the edge index entry corresponding to edge e1, the starting node of e1 is determined to be v1, and the pointing node is v2. It is then determined whether the direct outgoing edge group of the node index entry corresponding to node v1 is full. If the direct outgoing edge group is not full, the edge index entry corresponding to e1 is inserted into the direct outgoing edge group of the node index entry corresponding to node v1. Next, it is determined whether the direct incoming edge group of the node index entry corresponding to node v2 is full. If the direct incoming edge group is not full, the edge index entry corresponding to e1 is inserted into the direct incoming edge group of the node index entry corresponding to node v2.

[0104] As shown in 602, when inserting the edge index entry corresponding to edge e2, the starting node of e2 is determined to be v2, and the pointing node is v3. It is then determined whether the direct outgoing edge group of the node index entry corresponding to node v2 is full. If the direct outgoing edge group is not full, the edge index entry corresponding to e2 is inserted into the direct outgoing edge group of the node index entry corresponding to node v2. Next, it is determined whether the direct incoming edge group of the node index entry corresponding to node v3 is full. If the direct incoming edge group is not full, the edge index entry corresponding to e2 is inserted into the direct incoming edge group of the node index entry corresponding to node v3.

[0105] As shown in 603, when inserting the edge index entry corresponding to edge e3, the starting node of e3 is determined to be v3, and the pointing node is v2. It is then determined whether the direct outgoing edge group of the node index entry corresponding to node v3 is full. If the direct outgoing edge group is not full, the edge index entry corresponding to e3 is inserted into the direct outgoing edge group of the node index entry corresponding to node v3. Next, it is determined whether the direct incoming edge group of the node index entry corresponding to node v2 is full. If the direct incoming edge group is not full, the edge index entry corresponding to e3 is inserted into the direct incoming edge group of the node index entry corresponding to node v2.

[0106] As shown in 604, when inserting the edge index entry corresponding to edge e4, the starting node of e4 is determined to be v3, and the pointing node is v2. It is then determined whether the direct outgoing edge group of the node index entry corresponding to node v3 is full. If the direct outgoing edge group is not full, the edge index entry corresponding to e4 is inserted into the direct outgoing edge group of the node index entry corresponding to node v3. Next, it is determined whether the direct incoming edge group of the node index entry corresponding to node v2 is full. If the direct incoming edge group is full, the edge index entry corresponding to e4 is inserted into the indirect incoming edge group of the node index entry corresponding to node v2.

[0107] According to embodiments of this disclosure, the edge index entries of the target graph are stored in blocks consisting of direct blocks and multiple indirect blocks. Direct blocks may include direct incoming edge groups and direct outgoing edge groups, while indirect blocks may include indirect incoming edge groups and indirect outgoing edge groups. When a direct block is full, edge index entries can be inserted into an indirect block. The addresses of indirect blocks are maintained in the direct blocks. Accessing a direct block requires only one read operation, while accessing an indirect block requires two read operations. Following a power-law distribution, the adjacency relationships of most nodes can be fully stored in direct blocks, while a portion of the adjacency relationships of a few supernodes needs to be stored in indirect blocks.

[0108] According to embodiments of this disclosure, by storing edge index entries in blocks of direct and indirect blocks, the adjacency relationships of target graph nodes are stored discretely. When reading, both direct and indirect blocks can be read simultaneously, thus avoiding the impact of poor supernode performance and eliminating latency jitter issues when reading supernodes, thereby improving the traversal speed of graph data for the target graph.

[0109] Figure 7 The flowchart illustrating the reordering of edge index entries in node index entries based on target metrics according to an embodiment of the present disclosure is shown.

[0110] like Figure 7 As shown, reordering the edge index items in the node index items based on the target index includes operations S701 to S702.

[0111] In operation S701, based on the target index, multiple edge index items in the direct storage group or indirect storage list of the target node index item are sorted to obtain the sorting result.

[0112] In operation S702, based on the sorting results, the insertion positions of multiple edge index items in the direct storage group are updated.

[0113] According to embodiments of this disclosure, the target metric may include different business metrics in different business scenarios. For example, when the target graph is a social network graph, if you want to obtain information about nodes with a large number of followers, you can use the degree of the node as the target metric.

[0114] According to embodiments of this disclosure, edge index items included in the direct incoming edge group of the direct storage group and the indirect incoming edge group of the indirect storage list of the target node index item can be sorted based on a target index. The insertion position of each edge index item can be updated based on the sorting result. For example, if the target index is the degree of a node, the degree of the node connected to each edge can be determined, and the edge index items can be sorted based on this degree. Based on the sorting result, the edge index items corresponding to edges with higher degrees can be inserted into the direct incoming edge group.

[0115] According to embodiments of this disclosure, the method for updating the insertion position of edge index items in the direct outgoing edge group and the indirect outgoing edge group is the same as that in the direct incoming edge group and the indirect incoming edge group. Based on the target index, the edge index items included in the direct outgoing edge group of the direct storage group of the target node index item and the indirect outgoing edge group of the indirect storage list can be sorted, and the insertion position of each edge index item can be updated based on the sorting result.

[0116] According to embodiments of this disclosure, updating the insertion position of edge index items based on target metrics can speed up access to graph data, prioritize important edge index items for limited access, and still allow high-value adjacent edges to be traversed even when the number of adjacent edges accessed for each node is limited.

[0117] According to embodiments of this disclosure, when the third storage capacity information of the direct storage group is greater than or equal to the target threshold, the edge index item to be updated is determined from multiple edge index items based on the sorting result, wherein the third storage capacity information represents the storage capacity information already occupied in the direct storage group after the insertion positions of multiple edge index items in the direct storage group are updated based on the sorting result; the edge index item to be updated is inserted into the indirect storage list.

[0118] According to an embodiment of the present disclosure, when it is determined that the direct storage group is full, it is possible to determine the edge index entries to be updated that have not been stored in the direct storage group, and insert the edge index entries to be updated into the direct storage list. For example, when it is determined that the direct out-edge group is full, based on the sorting result, it is possible to determine the index entries to be updated that have not been stored among the multiple index entries, and insert the index entries to be updated into the indirect out-edge group. Similarly, when it is determined that the direct in-edge group is full, based on the sorting result, it is possible to determine the index entries to be updated that have not been stored among the multiple index entries, and insert the index entries to be updated into the indirect in-edge group.

[0119] According to an embodiment of the present disclosure, the target threshold and the storage threshold may be the same or different, and can be set according to specific circumstances.

[0120] According to an embodiment of the present disclosure, by re-sorting the edge index entries in the target node index entries according to the target metric, storing the high-value or high-access-frequency edge index entries in the direct storage group, and storing the low-access-frequency or less important edge index entries in the indirect in-edge group or the node out-edge group of the indirect storage list, it is possible to preferentially traverse the important adjacency relationships of the nodes. In some scenarios, it is even possible to only traverse the edge index entries in the direct storage group, achieving an improvement in the access speed of the target graph. And it can improve the adjacency edge traversal performance of the super node when there are restrictions on traversing the edge index entries. At the same time, if the indirect blocks with low access frequency are stored in low-cost external storage devices, the storage cost can also be significantly reduced.

[0121] Figure 8 Schematically shows a schematic diagram of updating the insertion positions of the edge index entries in the node index entries based on the target metric according to an embodiment of the present disclosure.

[0122] As Figure 8 shown, when the target metric is the node degree of the corresponding node of the edge index entry, it is possible to update the insertion positions of the edge index entries included in each node index entry in 604 as shown in Figure 6 shown. By calculating that the degrees of v1, v2, and v3 are 1, 4, and 3 respectively, the sorting result of each edge index entry based on the corresponding relationship can be e1 < e2 < e3 < e4. Therefore, the insertion position of the edge index entry of the node index entry corresponding to v1 remains unchanged. The insertion position of the direct out-edge group of the node index entry corresponding to v2 remains unchanged. Based on the sorting result, update the insertion positions of the edge index entries corresponding to e3 and e4 in the direct in-edge group to the direct in-edge group. When the direct in-edge group is full, update the edge index entry corresponding to e1 to the indirect in-edge group. The insertion position of the edge index entry of the node index entry corresponding to v3 remains unchanged.

[0123] Based on the above-described graph data storage method, this disclosure also provides a graph data storage device. The following will be combined with... Figure 9 The device is described in detail.

[0124] Figure 9 A schematic block diagram of a graph data storage device according to an embodiment of the present disclosure is shown.

[0125] like Figure 9 As shown, the graph data storage device 900 of this embodiment includes an index item generation module 910, a target node determination module 920, and an edge index item insertion module 930.

[0126] The index item generation module 910 is configured to, in response to receiving a target graph storage request, obtain multiple node index items and multiple edge index items based on the target graph. The target graph includes multiple nodes and multiple edges, and the node index items include a direct storage group and an indirect storage list. In one embodiment, the index item generation module 910 can be used to perform the operation S210 described above, which will not be repeated here.

[0127] The target node determination module 920 is used to determine the target node connected to each of the multiple edges based on the connection relationships between each of the multiple nodes in the target graph and the edge. In one embodiment, the target node determination module 920 can be used to perform the operation S220 described above, which will not be repeated here.

[0128] The edge index item insertion module 930 is used to insert the edge index item corresponding to the edge into the direct storage group or indirect storage list of the target node index item corresponding to the target node. In one embodiment, the edge index item insertion module 930 can be used to perform the operation S230 described above, which will not be repeated here.

[0129] According to embodiments of this disclosure, the edge index item insertion module 930 may include: a target node index item determination submodule, a first storage capacity information determination submodule, a first storage submodule, and a second storage submodule.

[0130] The target node index item determination submodule is used to determine the target node index item corresponding to the target node based on the primary key of the target node.

[0131] The first storage capacity information determination submodule is used to determine the first storage capacity information of the direct storage group of the target node index item, wherein the first storage capacity information represents the storage capacity information already occupied in the direct storage group.

[0132] The first storage submodule is used to insert the edge index item into the direct storage group when the first storage capacity information is less than the storage threshold.

[0133] The second storage submodule is used to insert the edge index item into the indirect storage list when the first storage capacity information is greater than or equal to the storage threshold.

[0134] According to embodiments of this disclosure, the target node includes the starting node of the edge and the pointing node of the edge; the target node index includes the starting node index and the pointing node index; the direct storage group includes the direct outgoing edge group and the direct incoming edge group; the first storage capacity information determination submodule may include: the starting node storage capacity information determination unit and the pointing node storage capacity information determination unit.

[0135] The starting node storage capacity information determination unit is used to determine the first storage capacity information of the direct outgoing edge group of the starting node index item for the starting node, wherein the starting node index item is the index item corresponding to the starting node.

[0136] The node storage capacity information determination unit is used to determine the first storage capacity information of the direct incoming edge group of the node index item for the node, wherein the node index item is the index item corresponding to the node.

[0137] According to embodiments of this disclosure, the first storage submodule may include: a starting node first storage unit and a pointing node first storage unit.

[0138] The first storage unit of the starting node is used to insert the edge index item into the direct outgoing edge group of the starting node index item when the first storage capacity information of the direct outgoing edge group is less than the storage threshold.

[0139] The pointer to the first storage unit of the node is used to insert the edge index item into the direct incoming edge group of the pointer to the node index item when the first storage capacity information of the direct incoming edge group is less than the storage threshold.

[0140] According to embodiments of this disclosure, the indirect storage list includes an indirect outgoing edge group list; the second storage submodule includes: a target indirect outgoing edge group determination unit, an indirect outgoing edge group storage capacity determination unit, a first edge index item insertion unit, an indirect outgoing edge group creation unit, and a second edge index item insertion unit.

[0141] The target indirect outgoing edge group determination unit is used to determine the target indirect outgoing edge group based on the indirect outgoing edge group list when the first storage capacity information of the direct outgoing edge group is greater than or equal to the storage threshold. The indirect outgoing edge group list stores the address information of multiple indirect outgoing edge groups.

[0142] The indirect outgoing edge group storage capacity determination unit is used to determine the second storage capacity information of the target indirect outgoing edge group based on the address information of the target indirect outgoing edge group, wherein the second storage capacity information represents the storage capacity information already occupied in the target indirect outgoing edge group.

[0143] The first edge index insertion unit is used to determine whether to insert the edge index into the indirect outgoing edge group when the second storage capacity information is less than the storage threshold.

[0144] The indirect outgoing edge group creation unit is used to determine the creation of a new indirect outgoing edge group when the second storage capacity information is greater than or equal to the storage threshold.

[0145] The second edge index insertion unit is used to insert the edge index into the new indirect outgoing edge group.

[0146] According to embodiments of this disclosure, the indirect storage list includes an indirect incoming edge group list; the second storage submodule may include: a target indirect incoming edge group determination unit, an indirect incoming edge group storage capacity determination unit, a third edge index item insertion unit, an indirect incoming edge group creation unit, and a fourth edge index item insertion unit.

[0147] The target indirect incoming edge group determination unit is used to determine the target indirect incoming edge group based on the indirect incoming edge group list when the first storage capacity information of the direct incoming edge group is greater than or equal to the storage threshold. The indirect incoming edge group list stores the address information of multiple indirect incoming edge groups.

[0148] The indirect inbound edge group storage capacity determination unit is used to determine the second storage capacity information of the target indirect inbound edge group based on the address information of the target indirect inbound edge group, wherein the second storage capacity information represents the storage capacity information already occupied in the target indirect inbound edge group.

[0149] The third edge index insertion unit is used to determine whether to insert the edge index into the indirect incoming edge group when the second storage capacity information is less than the storage threshold.

[0150] The indirect incoming edge group creation unit is used to determine the creation of a new indirect incoming edge group when the second storage capacity information is greater than or equal to the storage threshold.

[0151] The fourth edge index item insertion unit is used to insert the edge index item into the new indirect incoming edge group.

[0152] According to embodiments of this disclosure, the graph data storage device 900 may further include an edge index item sorting module and an edge index item updating module.

[0153] The edge index item sorting module is used to sort multiple edge index items in the direct storage group or indirect storage list of the target node index item based on the target index, and obtain the sorting result.

[0154] The edge index update module is used to update the insertion position of multiple edge index items in the direct storage group based on the sorting result.

[0155] According to embodiments of this disclosure, the graph data storage device 900 may further include a module for determining edge index items to be updated and a module for inserting edge index items to be updated.

[0156] The module for determining edge index items to be updated is used to determine the edge index items to be updated from multiple edge index items based on the sorting results when the third storage capacity information of the direct storage group is greater than or equal to the target threshold. The third storage capacity information represents the storage capacity information already occupied in the direct storage group after the insertion positions of multiple edge index items in the direct storage group have been updated based on the sorting results.

[0157] The module for inserting edge index items to be updated is used to insert edge index items to be updated into the indirect storage list.

[0158] According to embodiments of this disclosure, any multiple modules of the index item generation module 910, target node determination module 920, and edge index item insertion module 930 can be implemented in one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the index item generation module 910, target node determination module 920, and edge index item insertion module 930 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), programmable logic array (PLA), system-on-a-chip, system-on-a-substrate, system-on-package, application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, and firmware, or in any suitable combination of any of these three implementation methods. Alternatively, the index item generation module 910, target node determination module 920, and edge index item insertion module 930... At least one of them can be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.

[0159] Figure 10 A block diagram schematically illustrates an electronic device suitable for implementing a graph data storage method according to an embodiment of the present disclosure.

[0160] like Figure 10As shown, an electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage portion 1008 into a random access memory (RAM) 1003. The processor 1001 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1001 may also include onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0161] RAM 1003 stores various programs and data required for the operation of electronic device 1000. Processor 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. Processor 1001 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 1002 and / or RAM 1003. It should be noted that programs may also be stored in one or more memories other than ROM 1002 and RAM 1003. Processor 1001 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in one or more memories.

[0162] According to embodiments of this disclosure, the electronic device 1000 may further include an input / output (I / O) interface 1005, which is also connected to a bus 1004. The electronic device 1000 may also include one or more of the following components connected to the input / output (I / O) interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output (I / O) interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1010 as needed so that computer programs read from it can be installed into the storage section 1008 as needed.

[0163] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0164] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 1002 and / or RAM 1003 and / or one or more memories other than ROM 1002 and RAM 1003 described above.

[0165] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code enables the computer system to implement the graph data storage method provided in the embodiments of this disclosure.

[0166] When the computer program is executed by the processor 1001, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0167] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 1009, and / or installed from a removable medium 1011. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0168] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by processor 1001, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0169] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0170] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0171] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0172] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A graph data storage method, comprising: In response to receiving a target graph storage request, based on the target graph, multiple node index items and multiple edge index items are obtained, wherein the target graph includes multiple nodes and multiple edges, and the node index items include a direct storage group and an indirect storage list; For each of the plurality of edges, a target node connected to the edge is determined based on the connection relationship between each of the plurality of nodes in the target graph and the edge; When it is determined that the first storage capacity information of the direct storage group is less than the storage threshold, the edge index entry corresponding to the edge is inserted into the direct storage group of the target node index entry corresponding to the target node. Alternatively, when it is determined that the first storage capacity information of the direct storage group is greater than or equal to the storage threshold, the edge index entry is inserted into the indirect out edge group or the indirect in edge group based on the address information of the indirect out edge group or the indirect in edge group stored in the indirect storage list. The first storage capacity information represents the storage capacity information already occupied in the direct storage group.

2. The method according to claim 1, wherein the target node index item is determined through the following steps: Based on the primary key of the target node, determine the target node index item corresponding to the target node.

3. The method according to claim 2, wherein the target node includes the starting node of the edge and the pointing node of the edge; the target node index includes the starting node index and the pointing node index; the direct storage group includes the direct outgoing edge group and the direct incoming edge group; The determination of the first storage capacity information of the direct storage group for the target node index entry includes: For the starting node, determine the first storage capacity information of the direct outgoing edge group of the starting node index item, wherein the starting node index item is the index item corresponding to the starting node; For the pointed node, determine the first storage capacity information of the direct incoming edge group of the pointed node index item, wherein the pointed node index item is the index item corresponding to the pointed node.

4. The method according to claim 3, wherein, The step of inserting the side index item into the direct storage group when the first storage capacity information is less than the storage threshold includes: If the first storage capacity information of the direct outgoing edge group is less than the storage threshold, the edge index item is inserted into the direct outgoing edge group of the starting node index item; If the first storage capacity information of the direct incoming edge group is less than the storage threshold, the edge index entry is inserted into the direct incoming edge group of the pointer node index entry.

5. The method according to claim 3, wherein, The indirect storage list includes an indirect outgoing edge group list; The step of inserting the side index item into the indirect storage list when the first storage capacity information is greater than or equal to the storage threshold includes: If the first storage capacity information of the direct outgoing edge group is greater than or equal to the storage threshold, a target indirect outgoing edge group is determined based on the indirect outgoing edge group list, wherein the indirect outgoing edge group list stores the address information of each of the multiple indirect outgoing edge groups. Based on the address information of the target indirect outgoing edge group, the second storage capacity information of the target indirect outgoing edge group is determined, wherein the second storage capacity information represents the storage capacity information already occupied in the target indirect outgoing edge group; If the second storage capacity information is less than the storage threshold, it is determined that the edge index item will be inserted into the indirect outgoing edge group; If the second storage capacity information is greater than or equal to the storage threshold, determine to create a new indirect outgoing edge group; Insert the edge index entry into the new indirect outgoing edge group.

6. The method according to claim 3, wherein, The indirect storage list includes an indirect inbound edge group list; The step of inserting the side index item into the indirect storage list when the first storage capacity information is greater than or equal to the storage threshold includes: If the first storage capacity information of the direct incoming edge group is greater than or equal to the storage threshold, a target indirect incoming edge group is determined based on the indirect incoming edge group list, wherein the indirect incoming edge group list stores the address information of each of the multiple indirect incoming edge groups. Based on the address information of the target indirect incoming edge group, the second storage capacity information of the target indirect incoming edge group is determined, wherein the second storage capacity information represents the storage capacity information already occupied in the target indirect incoming edge group; If the second storage capacity information is less than the storage threshold, it is determined that the edge index item will be inserted into the indirect inbound edge group; If the second storage capacity information is greater than or equal to the storage threshold, determine to create a new indirect inbound edge group; Insert the edge index entry into the new indirect incoming edge group.

7. The method according to claim 1, further comprising: Based on the target index, sort the multiple edge index items in the direct storage group or indirect storage list of the target node index item to obtain the sorting result; as well as Based on the sorting result, update the insertion position of each of the multiple edge index items in the direct storage group.

8. The method according to claim 7, further comprising: If the third storage capacity information of the direct storage group is greater than or equal to the target threshold, the edge index item to be updated is determined from the plurality of edge index items based on the sorting result. The third storage capacity information represents the storage capacity information already occupied in the direct storage group after the insertion position of the plurality of edge index items in the direct storage group is updated based on the sorting result. Insert the edge index item to be updated into the indirect storage list.

9. The method according to claim 1, wherein, The edge index item includes at least one of the following: the edge's primary key, the starting node's primary key, the pointing node's primary key, weight, and attribute.

10. A graph data storage device, comprising: An index item generation module is used to respond to a received target graph storage request and, based on the target graph, obtain multiple node index items and multiple edge index items, wherein the target graph includes multiple nodes and multiple edges, and the node index items include a direct storage group and an indirect storage list; The target node determination module is used to determine the target node connected to the edge for each of the plurality of edges, based on the connection relationship between each of the plurality of nodes in the target graph and the edge. The edge index insertion module is used to insert the edge index corresponding to the edge into the direct storage group of the target node index corresponding to the target node when the first storage capacity information of the direct storage group is determined to be less than the storage threshold, or to insert the edge index into the indirect out edge group or the indirect in edge group based on the address information of the indirect out edge group or the indirect in edge group stored in the indirect storage list when the first storage capacity information of the direct storage group is determined to be greater than or equal to the storage threshold. The first storage capacity information represents the storage capacity information already occupied in the direct storage group.

Citation Information

Patent Citations

  • A complex relationship data storage and retrieval method based on a graph structure

    CN109726305A

  • Graph data storage method, system and device

    CN114077680A