Graph data sampling method and device
By setting an update table in the dynamic graph to filter nodes with high degree, the problems of real-time sampling and community structure preservation in dynamic graphs are solved, achieving efficient graph data sampling and model training.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies lack effective graph data sampling schemes, especially for dynamic graphs, and cannot perform efficient sampling while ensuring real-time performance and preserving community structural characteristics.
By setting an update table to record the updated edge information of the graph data, nodes with higher degrees are filtered out and added to the sampling graph. The update table is used to filter out nodes with higher degrees and connect them, so as to achieve fast sampling of dynamic graphs and preserve community structure characteristics.
It enables fast sampling of dynamic graphs, reduces the size of the sampled graph, lowers memory overhead, and improves the training speed and performance of graph neural network models.
Smart Images

Figure CN2024134808_15052026_PF_FP_ABST
Abstract
Description
A method and device for sampling graph data
[0001] This application claims priority to Chinese Patent Application No. 202410272963.0, filed on March 11, 2024, entitled “A Method and Device for Sampling Image Data”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of data processing technology, and in particular to a graph data sampling method and device. Background Technology
[0003] Compared to traditional data, graph data (or simply graph data) is characterized by its large information content and the high complexity of corresponding graph algorithms. As graph data grows, limited storage space and computation time make it difficult to perform a complete analysis of the entire graph. Therefore, it is necessary to sample graph data and explore, analyze, and train on smaller sampled graphs.
[0004] Traditional graph data is primarily static, meaning the graph is already constructed and its structure is fixed. However, graphs in real-world scenarios are mostly dynamic, meaning their structure changes over time, with nodes and edges constantly being added. For example, graphs used in e-commerce and risk control are often dynamic. Most existing sampling schemes are designed for static graphs, lacking effective sampling solutions for dynamic graphs. Summary of the Invention
[0005] The embodiments of this application provide a graph data sampling method and device, which filters out nodes with higher degrees by updating the table settings and adds the nodes with higher degrees to the sampling graph, thereby achieving sampling of dynamic graphs while preserving the community structure characteristics of graph data.
[0006] In a first aspect, this application provides a graph data sampling method, comprising: acquiring update edge information in the graph data, the update edge information indicating newly added connection edges in the graph data, and a first update node and a second update node connected by the newly added connection edges; determining that the update edge information does not meet preset conditions, the preset conditions including that both the first update node and the second update node are in the sampled graph, and there is no connection edge between the first update node and the second update node, the sampled graph being obtained based on sampling the graph data; updating an update table based on the update edge information, the update table recording multiple update information entries, each update information entry indicating the number of times the recorded update node has been updated; when the number of update node information entries recorded in the update table reaches a preset number, the update table pops up target update information, the update node in the target update information having the maximum number of updates; and updating the sampled graph based on the target update information.
[0007] The graph data sampling method provided in this application sets up an update table. The update nodes corresponding to the update edges that are continuously updated over time are first stored in the update table, and the update number of each update node is recorded in the update table. When the number of update nodes recorded in the update table reaches a preset number (e.g., the number when the update table is full), the update node with the most update times in the update table is popped out and added to the sampling graph as the target update node. In this way, by setting up the update table, nodes with higher degrees are selected and added to the sampling graph, so as to sample dynamic graphs while preserving the community structure characteristics of graph data.
[0008] In one possible implementation, each update entry in the update table includes an update node, an update count, and neighboring nodes. The update node indicates the recorded update node information, the update count indicates the number of times the update node has been updated, and the neighboring nodes indicate the most recently added neighboring nodes of the update node.
[0009] For example, the update table includes a node field, an update count field, and a neighbor node field. Each update entry includes the values for the node field, update count field, and neighbor node field. The node field value can be the node ID of the updated node, the update count field value can be the number of times the updated node appears in the update table (or the number of times it has been added to the update table), and the neighbor node field value can be the ID of the most recently added neighbor node. For instance, given an updated edge (node u, node v), where node u and node v are the two nodes connected by the newly added edge in the graph data, both nodes u and v are called updated nodes. If both nodes u and v meet preset conditions, then both nodes u and v are recorded in the update table. The update information for node u would be: node field value is node u, update count field value is n (where n depends on the number of times node u is recorded), and neighbor node field value is node v. The update information for node v would be: node field value is node v, update count field value is m (where m depends on the number of times node v is recorded), and neighbor node field value is node u. In this way, the update table can clearly show how many times each update node is recorded in the update table. The higher the number of times an update node is recorded in the update table, the higher the degree of this node and the closer it is connected to other nodes. This makes it easier to filter out nodes with higher degrees and closer connections to other nodes in the subsequent screening.
[0010] In another possible implementation, a specific implementation of updating the update table based on updated data is as follows: it is determined that the first update node and / or the second update node do not exist in the sampled graph, and the update table does not contain update information corresponding to the first update node and / or the second update node; the first update information and / or the second update information are added to the update table, wherein the update node in the first update information is the first update node, the update count is 1, and the neighbor node is the second update node, and the update node in the second update information is the second update node, the update count is 1, and the neighbor node is the first update node.
[0011] In another possible implementation, a specific implementation of updating the update table based on updated data is as follows: determining that the first update node does not exist in the sampling graph, and that update information corresponding to the first update node exists in the update table; performing an update operation on the update information corresponding to the first update node, such that the update count in the update information corresponding to the first update node is incremented by one, and the neighboring node is updated to the second update node; and / or determining that the second update node does not exist in the sampling graph, and that update information corresponding to the second update node exists in the update table; performing an update operation on the update information corresponding to the second update node, such that the update count in the update information corresponding to the second update node is incremented by one, and the neighboring node is updated to the first update node.
[0012] In another possible implementation, a specific approach to updating the update table based on updated data is as follows: if it is determined that both the first and second update nodes exist in the sampled graph, then no update operation is performed on the update table. In other words, if both the first and second update nodes exist in the sampled graph, then the update of the update table is skipped.
[0013] In another possible implementation, a specific implementation of updating the sampling graph based on the target update information is as follows: add the target update node and the target neighbor node to the sampling graph, where the target update node is the update node in the target update information and the target neighbor node is the neighbor node in the target update information; add a connecting edge between the target update node and the target neighbor node.
[0014] The update table is used to filter out the update node that updates most frequently, or the node with the highest degree, and this node is used as the target update node. Then, the most recent neighbor node of the target update node is used as the target neighbor node. The target update node and the target neighbor node are added to the sampling graph and connected. This allows for fast sampling of the dynamic graph without traversing the entire dynamic graph, while preserving the community structure characteristics of the dynamic graph.
[0015] In another possible implementation, updating the sampling graph based on the target update information can be specifically achieved by: determining that the number of nodes to be added to the sampling graph is N, where N is a positive integer; deleting N nodes from the sampling graph, where the degree of each of the N nodes is less than the degree of any other node in the sampling graph. By deleting nodes with lower degrees, the number of nodes in the sampling graph is prevented from "exploding" due to unlimited addition of nodes, ensuring that the scale of the sampled graph data is controllable. Furthermore, the sampling process further retains nodes with closer connections, facilitating subsequent use of the sampling graph, such as training a graph neural network model, which is more conducive to training a graph neural network model with better performance.
[0016] In another possible implementation, the graph data sampling method provided in this application further includes: determining that the updated edge information meets preset conditions; and determining whether to add a connecting edge between the first updated node and the second updated node based on the degree of the first updated node, the degree of the second updated node, and the degree of each node in the sampled graph.
[0017] By updating the degree of the node and the degree of the node in the sample graph, it is determined whether two updated nodes are connected. In other words, two updated nodes will only be connected when their degrees reach a certain condition (e.g., both updated nodes have high degrees), thus preventing the sample graph from becoming a fully connected graph structure, where every node is connected.
[0018] For example, if the two updating nodes are node u and node v, both nodes u and v exist in the sampled graph but are not connected. Both nodes u and v have low degrees, meaning that nodes u and v have little interaction with other nodes. In this case, the edge information of this update will be discarded, and nodes u and v will not be connected.
[0019] In another possible implementation, a specific method for determining whether to add a connection edge between the first update node and the second update node based on the degree of the first update node, the degree of the second update node, and the degree of each node in the sampled graph is as follows: Calculate the geometric mean of the degree of the first update node and the degree of the second update node to obtain the target geometric mean; calculate the average degree of the nodes in the sampled graph based on the degree of each node; determine the connection probability based on the ratio of the target geometric mean to the average degree of the nodes; determine whether the connection probability is greater than a preset threshold. If it is, add a connection edge between the first update node and the second update node; otherwise, do not add a connection edge between the first update node and the second update node.
[0020] By using the ratio of the geometric mean of the degrees of two updated nodes to the average degree of nodes in the current sampled graph, two updated nodes are connected with a certain probability. That is, the higher the degree of the two updated nodes is compared to the average degree of nodes in the current sampled graph, the greater the probability of connecting the two updated nodes. This enables the connection of nodes with closer relationships to other nodes, further preserving the community structure characteristics of the dynamic graph.
[0021] Secondly, this application provides a graph data sampling device, including an acquisition module, a determination module, a first update module, a pop-up module, and a second update module. The acquisition module acquires update edge information from the graph data, indicating newly added connecting edges in the graph data, and the first and second update nodes connected by the newly added connecting edges. The determination module determines that the update edge information does not meet preset conditions, including that both the first and second update nodes are in the sampled graph, and there is no connecting edge between the first and second update nodes. The sampled graph is obtained based on graph data sampling. The first update module updates an update table based on the update edge information. The update table records multiple update information entries, each including an update node, an update count, and neighboring nodes. The update count indicates the number of times the update node has been updated, and the neighboring nodes indicate the most recently added neighboring nodes of the update node. The pop-up module pops up target update information when the number of update node information entries recorded in the update table reaches a preset number. The update node in the target update information has the highest update count. The second update module updates the sampled graph based on the target update information.
[0022] In one possible implementation, each update message includes an update node, an update count, and neighboring nodes, wherein the update node indicates the recorded update node information, the update count indicates the number of times the update node has been updated, and the neighboring nodes indicate the most recently added neighboring nodes of the update node.
[0023] In another possible implementation, the first update module is specifically used to: determine that the first update node and / or the second update node do not exist in the sampled graph, and that there is no update information corresponding to the first update node and / or the second update node in the update table; add the first update information and / or the second update information to the update table, wherein the update node in the first update information is the first update node, the update count is 1, and the neighbor node is the second update node, and the update node in the second update information is the second update node, the update count is 1, and the neighbor node is the first update node.
[0024] In another possible implementation, the first update module is further configured to: determine that the first update node does not exist in the sampling graph, and that update information corresponding to the first update node exists in the update table; perform an update operation on the update information corresponding to the first update node, such that the update count in the update information corresponding to the first update node is incremented by one, and the neighboring node is updated to the second update node; and / or, determine that the second update node does not exist in the sampling graph, and that update information corresponding to the second update node exists in the update table; perform an update operation on the update information corresponding to the second update node, such that the update count in the update information corresponding to the second update node is incremented by one, and the neighboring node is updated to the first update node.
[0025] In another possible implementation, the first update module is also used to: if it is determined that the first update node and the second update node exist in the sampled graph, then no update operation is performed on the update table.
[0026] In another possible implementation, the second sampling module is specifically used to: add the target update node and the target neighbor node to the sampling graph, where the target update node is the update node in the target update information and the target neighbor node is the neighbor node in the target update information; and add a connection edge between the target update node and the target neighbor node.
[0027] In another possible implementation, the second sampling module is also used to: determine that the number of nodes to be added to the sampling graph is N, where N is a positive integer; and delete N nodes from the sampling graph, wherein the degree of each of the N nodes is less than the degree of the other nodes in the sampling graph.
[0028] In another possible implementation, the graph data sampling device provided in this application further includes a third update module, which is used to determine whether the updated edge information meets preset conditions; and to determine whether to add a connecting edge between the first update node and the second update node based on the degree of the first update node, the degree of the second update node and the degree of each node in the sampled graph.
[0029] In another possible implementation, a specific method for determining whether to add a connection edge between the first and second update nodes based on the degree of the first update node, the degree of the second update node, and the degrees of each node in the sampled graph is as follows: Calculate the geometric mean of the degrees of the first and second update nodes to obtain the target geometric mean; calculate the average degree of the nodes in the sampled graph based on the degrees of each node; determine the connection probability based on the ratio of the target geometric mean to the average degree of the nodes; determine whether the connection probability is greater than a preset threshold. If it is, add a connection edge between the first and second update nodes; otherwise, do not add a connection edge between the first and second update nodes.
[0030] Thirdly, embodiments of this application provide a computing device, including a memory and a processor, wherein the memory stores instructions that, when executed by the processor, cause the method described in the first aspect to be implemented.
[0031] Fourthly, embodiments of this application provide a computing device cluster, including at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs the operation steps of the method as described in the first aspect.
[0032] Fifthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the method described in the first aspect to be implemented.
[0033] In a sixth aspect, embodiments of this application also provide a computer program or computer program product, the computer program or computer program product including instructions that, when executed, cause a computer to perform the method described in the first aspect.
[0034] In a seventh aspect, embodiments of this application also provide a chip including at least one processor and a communication interface, wherein the processor is used to execute the method described in the first aspect. Attached Figure Description
[0035] Figure 1 shows a schematic diagram of the structure of a dynamic graph at a certain moment;
[0036] Figure 2 shows a schematic diagram of the sampled graph obtained from the dynamic graph shown in Figure 1;
[0037] Figure 3 shows a schematic diagram of a graph data sampling system applying the graph data sampling method provided in the embodiments of this application;
[0038] Figure 4 is a flowchart illustrating a graph data sampling method provided in an embodiment of this application;
[0039] Figure 5 is a flowchart illustrating a specific implementation of the graph data sampling method provided in this application embodiment;
[0040] Figure 6 is a schematic diagram of a graph data sampling device provided in an embodiment of this application;
[0041] Figure 7 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0042] Figure 8 is a schematic diagram of a computing device cluster provided in an embodiment of this application;
[0043] Figure 9 is a schematic diagram of an application scenario of a computing device cluster provided in Figure 8. Detailed Implementation
[0044] The term "and / or" used in this article describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.
[0045] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first update node" and "second update node," etc., are used to distinguish different update nodes, not to describe a specific order of update nodes.
[0046] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0047] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple nodes means two or more nodes, multiple connecting edges means two or more connecting edges, etc.
[0048] Most graph sampling methods focus on sampling from static graphs. Examples include random graph sampling and feature-driven sampling. Random graph sampling emphasizes the randomness of node or edge selection; common methods include breadth-first (BF) sampling, depth-first (DF) sampling, snowball (SB) sampling, and forest fire (FF) sampling, all classic examples of random sampling. Feature-driven sampling methods, on the other hand, are based on graph topology, community structure, dynamic network relationships, and semantic relationships, selectively sampling to maximize feature preservation. Common examples include spectral vertex (SV) sampling and sampling based on graph partition (SGP).
[0049] However, random graph sampling methods mainly adopt various random selection methods, which will result in different subgraphs when sampling the dynamic graph at different times. This makes it impossible to realize the evolution of the dynamic graph and update the subgraph (i.e., the sampled graph).
[0050] Feature-driven sampling methods require traversing the entire network for each sampling, which is too time-consuming and inefficient for dynamic graphs whose structures change over time.
[0051] In other words, random graph sampling methods in the relevant sampling schemes cannot be applied to dynamic graph sampling, while feature-driven sampling methods can be applied to dynamic graph sampling, but because each sampling requires traversing the entire network, the time required for each sampling is too long and the efficiency is too low.
[0052] In summary, the relevant sampling methods cannot meet the real-time requirements of dynamic graph sampling (where real-time can be understood as the sampling process taking less than a certain threshold) for dynamic graphs whose structure changes over time and which are constantly being added with nodes and edges.
[0053] Therefore, this application provides a graph data sampling method. By setting an update table, the update nodes corresponding to the update edges of the graph data that are continuously updated over time are first stored in the update table. The sampled graph is then updated with the node information recorded in the update table. This method enables sampling of the dynamic graph without traversing the entire dynamic graph, using only the updated data of the dynamic graph. This greatly increases the real-time performance of dynamic graph sampling, while retaining nodes that are closely related to other nodes, preserving the community structure characteristics of the dynamic graph, and facilitating exploration, analysis, and training on the sampled graph.
[0054] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and embodiments.
[0055] Graph data is a data structure that represents entities and the relationships between them. It can be used to represent data in many application scenarios, such as e-commerce, social networks, financial risk control, and data recommendation. In graph data, nodes represent entities, and edges (including directed and undirected edges) represent the relationships between entities.
[0056] For example, in an e-commerce scenario, historical interaction records from an e-commerce platform can be used to generate graph data, with users and products as nodes. When a user interacts with a product through actions such as purchasing, adding to favorites, or clicking, the user's node and the product's node are connected by edges. Similarly, if a user interacts with other products, the user's node and the other product's node are connected by edges; if the product is also purchased, added to favorites, or clicked by other users, the product's node is connected to the other users' nodes.
[0057] For example, in video recommendation scenarios, graph data is generated by recording users' historical interactions while browsing videos. Both the user and the video's node are treated as nodes. When a user interacts with a video through actions such as clicking, browsing, or commenting, the user's node and the video's node are connected by edges. Correspondingly, the video will also be viewed by other users, so the video's node will also have multiple edges connecting it to other users' nodes.
[0058] Taking e-commerce as an example, as time goes on, new transactions occur on the e-commerce platform, and new nodes and connecting edges are constantly added to the graph data (at this time, the graph data is called dynamic graph data), and the scale of the graph data will continue to expand.
[0059] Figure 1 shows a schematic diagram of the structure of a dynamic graph at a certain moment.
[0060] The graph data sampling method and apparatus provided in this application can be applied to the sampling of graph data, especially dynamic graphs. By setting an update table, newly added connection edges in the dynamic graph are first added to the update table. The update table is used to filter nodes with higher degrees, and nodes that are more closely related to other nodes are sampled. While reducing the size of the graph data, the community structure characteristics of the graph data are preserved, which facilitates better utilization of the graph data. For example, the sampled graph data has a significantly reduced data volume, reducing memory overhead. The sampled graph data is also more conducive to the training of graph neural network models, accelerating the training speed of graph neural network models.
[0061] Figure 2 shows a schematic diagram of the sampled graph obtained from the dynamic graph shown in Figure 1.
[0062] It should be noted that Figures 1 and 2 are merely possible structural examples of graph data and should not be construed as limiting the structure and scale of specific graph data. In real-world applications, graph data can be quite large, for example, with a large number of nodes and edges. Furthermore, nodes and edges can have various types and rich features. For example, in scenarios such as e-commerce shopping, data recommendation, security control, and social networks, the number of edges in graph data can reach billions or even tens of billions, and the number of nodes can reach hundreds of millions or even billions, with rich features on both nodes and edges. In sampled graphs, the number of edges can reach millions or even tens of millions, and the number of nodes can reach hundreds of thousands or even tens of millions. Therefore, the specific scale of graph data and sampled graphs needs to be determined based on the actual application scenario.
[0063] Figure 3 shows a schematic diagram of a graph data sampling system applying the graph data sampling method provided in the embodiments of this application. As shown in Figure 3, the graph data sampling system provided in this application includes at least a graph sampling system 200 and a storage system 300. The graph sampling system 200 is used to sample the dynamic graph by acquiring newly added edge data, and the storage system 300 is used to store the sampled graph data.
[0064] As shown in Figure 3, this embodiment does not directly update the sampled graph using the newly added edge data of the dynamic graph. Instead, it first adds the newly added edge data of the dynamic graph to the update table, uses the update table to filter out edge data that meets the requirements (e.g., the two nodes connected by the newly added edge have high degrees), and then uses the update data recorded in the update table to update the sampled graph. This eliminates the need to traverse the entire structure of the dynamic graph data, thus achieving sampling of the dynamic graph. This greatly increases the real-time performance of dynamic graph sampling. Furthermore, by filtering out nodes with high degrees through the update table, the community structure characteristics of the dynamic graph are preserved, which is beneficial for subsequent use of the sampled graph. For example, the sampled graph greatly reduces the size of the graph data. The sampled graph can be used for training graph neural network models, which can accelerate the training speed of graph neural networks. At the same time, the sampled graph preserves the community structure characteristics of the dynamic graph, which can improve the performance of the trained graph neural network model.
[0065] Storage system 300 may include one or more storage components, each of which may be an independent storage device or part of other devices. In some embodiments, storage system 300 may include random access memory (RAM), read-only memory (ROM), mass storage, removable memory, volatile read-write memory, etc., or any combination thereof. For example, mass storage may include hard disks, optical disks, solid-state drives, etc. In some embodiments, storage system 300 may be implemented on a cloud platform. By way of example only, the cloud platform may include private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, internal cloud, multi-tiered cloud, etc., or any combination thereof.
[0066] Figure 4 is a flowchart illustrating a graph data sampling method provided in an embodiment of this application. This method can be executed by any device, equipment, platform, or cluster of devices with computing capabilities. This application embodiment does not specifically limit the specific computing device executing the method; a suitable computing device can be selected as needed. For example, it can be executed on a terminal device (e.g., a smartphone, personal computer, or tablet computer), or on both a terminal device and a cloud device (e.g., a cloud-side server), that is, using an end-to-cloud collaborative architecture. It can also be completed on a cloud device. For ease of description, the form of the executing entity will not be distinguished in the following text; all will be described as a graph data sampling system. As shown in Figure 4, the graph data sampling method provided in this application embodiment includes steps S401 to S406.
[0067] In step S401, the updated edge information in the graph data is obtained.
[0068] As a dynamic graph grows, it continuously adds nodes and edges. The graph data sampling system acquires the updated edge information of the dynamic graph in real time or at regular intervals (e.g., every 5 minutes). The updated edge information indicates the newly added edges in the dynamic graph and the two updated nodes connected by these newly added edges. For example, if a new edge is added to the dynamic graph, called edge 1, which connects nodes u and v, then the updated edge information would be edge 1(node u, node v), indicating that edge 1 has been added to the dynamic graph and connects nodes u and v.
[0069] In some other examples, graph data sampling systems acquire update edge information by receiving update edge information that arrives in real time or in batches (e.g., update edges sent at fixed time periods).
[0070] Taking e-commerce shopping as an example, as time progresses, new transactions occur continuously on the e-commerce platform. As a result, new connection edges and nodes are added to the graph data. For example, if user A purchases product 1, which has not been purchased before, a node a1 representing product 1 is added to the graph data. A connection edge 2 is added between user A's node a and node a1. In other words, the updated edge of the graph data is connection edge 2 (node a, node a1). The updated edge data is sent to the graph data sampling system so that the graph data sampling system can obtain the updated edge information of the graph data.
[0071] In step S402, it is determined that the updated edge information does not meet the preset conditions.
[0072] For the obtained update edge information, the graph data sampling system first determines whether the update edge information meets the preset conditions. The preset conditions are that the two update nodes (e.g., node u and node v) connected by the update edge are both in the sampled graph, and there is no connecting edge between the two update nodes. In other words, the two update nodes already exist in the sampled graph, but there is no connection between the two update nodes.
[0073] A sampled graph can be understood as graph data that has been sampled from graph data, or graph data obtained by sampling the dynamic graph from the previous time step.
[0074] If the graph data sampling system determines that the updated edge information meets preset conditions, it then determines whether to connect two updated nodes according to a preset algorithm. Optionally, the preset algorithm can be based on the degree of the two updated nodes and the degree of each node in the sampled graph to determine whether to add a connecting edge between the two updated nodes. That is, it determines whether two updated nodes are connected by using the degree of the updated nodes and the degree of each node in the sampled graph. In other words, only when the degree of the two updated nodes reaches a certain condition (e.g., both updated nodes have high degrees) will the two updated nodes be connected, thus preventing the sampled graph from becoming a fully connected graph structure, where every node is connected.
[0075] The preset algorithm can be as follows: calculate the geometric mean of the degrees of the two updated nodes to obtain the target geometric mean; calculate the average degree of the nodes in the sampled graph based on the degree of each node in the sampled graph; determine the connection probability based on the ratio of the target geometric mean to the average degree of the nodes; determine whether the connection probability is greater than a preset threshold. If it is, add a connection edge between the two updated nodes; otherwise, do not add a connection edge between the two updated nodes.
[0076] Taking the updated edge information as connection edge 1 (node u, node v) as an example, both node u and node v already exist in the sampled graph, but node u and node v are not connected. The degree of node u is 8, the degree of node v is 2, the average degree of nodes in the sampled graph is 3, and the calculated geometric mean of node u and node v is 4. Therefore, the ratio of the target geometric mean to the average degree of nodes is 4 / 3, and the connection probability of node u and node v is 0.8. Since 0.8 is greater than the preset threshold of 0.5, node u and node v are connected, and the sampled graph is updated.
[0077] By using the ratio of the geometric mean of the degrees of two updated nodes to the average degree of nodes in the current sampled graph, two updated nodes are connected with a certain probability. That is, the higher the degree of the two updated nodes is compared to the average degree of nodes in the current sampled graph, the greater the probability of connecting the two updated nodes. This enables the connection of nodes with closer relationships to other nodes, further preserving the community structure characteristics of the dynamic graph.
[0078] It is understood that the above-mentioned preset algorithm is only one achievable example provided by the embodiments of this application, and other algorithms may also be used. For example, calculate the arithmetic mean of the degrees of two update nodes to obtain the target arithmetic mean; calculate the average degree of the nodes in the sampled graph based on the degree of each node in the sampled graph; determine the connection probability based on the ratio of the target arithmetic mean to the average degree of the nodes; determine whether the connection probability is greater than a preset threshold, and if so, add a connection edge between the two update nodes; otherwise, do not add a connection edge between the two update nodes. Another example is to calculate the sum of the degrees of two update nodes to obtain the target degree; calculate the average degree of the nodes in the sampled graph based on the degree of each node in the sampled graph; determine the connection probability based on the ratio of the target degree to the average degree of the nodes; determine whether the connection probability is greater than a preset threshold, and if so, add a connection edge between the two update nodes; otherwise, do not add a connection edge between the two update nodes.
[0079] If the graph data sampling system determines that the updated edge information does not meet the preset conditions, then step S303 is executed.
[0080] In step S403, the update table is updated based on the updated edge information.
[0081] Update the update nodes corresponding to update edges that do not meet the preset conditions to the update table. The update table records multiple update data entries. Each update entry indicates the number of times the recorded update node has been updated. This can also be referred to as the number of times the update node has been added to the update table or the number of times the update node has appeared in the update table.
[0082] The following describes the specific scheme for updating the edge information and updating the update table.
[0083] The update table includes an update node field, an update count field, and a neighbor node field. The update node field indicates the recorded update node information, the update count field indicates the number of times the update node has been updated, and the neighbor node field indicates the most recently added neighbor node of the update node.
[0084] An example of updating a table is shown below:
[0085] In dynamic graph data, nodes and connecting edges are identified. Node identifiers are used to distinguish different nodes, and connecting edge identifiers are used to distinguish different connecting edges. Optionally, the identifier can be an identity document (ID).
[0086] The "Update Node" column should contain the ID of the updated node, the "Update Count" column should contain the number of times the updated node appears in the update table, and the "Neighbor Node" column should contain the node ID of the most recently added neighbor node of the updated node.
[0087] The two update nodes corresponding to the obtained update edge are added to the update table. Since the update edge connects to two update nodes, one update edge data may generate two update messages in the update table.
[0088] Taking the updating of edge information as an example of connecting edge 1 (node u, node v), we will explain how updating edge information updates the update table.
[0089] For node u, first determine whether node u is already in the sampling graph. If so, skip it (i.e., node u is not updated in the update table). Otherwise, update node u in the update table.
[0090] There are two cases for updating node u to the update table. The first case is that node u has already been recorded in the update table. In this case, the update count of node u is incremented by 1, and the neighboring node is updated to node u.
[0091] For example, before node u updates the update table, the update table is as shown in Update Table 1:
[0092] Update Table 1
[0093] As shown in Update Table 1, if node u already exists in the update table, then the update operation for node u is as follows: increment the update count of node u by 1, i.e., 5 + 1 = 6, and update the neighbor node from node a to node u.
[0094] After node u performs the update operation on the update table, the update table is as shown in Update Table 2:
[0095] Update Table 2
[0096] The second scenario is that node u is not recorded in the update table. In this case, node u is recorded in a blank row of the update table, the update count of node u is set to 1, and the neighbor node is recorded as node v.
[0097] For example, before node u updates the update table, the update table is as shown in Update Table 3:
[0098] Update Table 3
[0099] As shown in Update Table 1, if node u does not exist in the update table, then the update operation of node u on the update table is as follows: record node u in a blank row of the update table, set the update count of node u to 1, and record the neighbor node as node v.
[0100] After node u performs the update operation on the update table, the update table is shown in Update Table 4:
[0101] Update Table 4
[0102] The update of the update table by node v is similar to that of node u, and will not be elaborated here for the sake of simplicity.
[0103] In step S404, when the number of update node information entries recorded in the update table reaches a preset number, the update table pops up the target update information, and the update node in the target update information has the maximum number of updates.
[0104] When the number of update information entries recorded in the update table reaches the preset number, the update information with the highest update frequency among the update information recorded in the current update table will be displayed. This update information includes the update node and neighbor nodes.
[0105] It's easy to understand that the pop-up message means to output the update information and then delete it.
[0106] The preset number of records can be set as needed, for example, the preset number of records can be 1000 records. The preset number of records can also be the total number of update information records that the update table can record, that is, the capacity of the update table. For example, if the update table can record a total of 2000 update information records, then the preset number of records is 2000. That is, when the number of update information records in the update table reaches the upper limit, the update information with the highest update frequency among the update information records in the update table will be output, and the update information with the highest update frequency will be deleted.
[0107] In another example, when new update information is added to the update table, it can be determined whether the update table has reached a preset number of records; if so, the target update information can be displayed.
[0108] For example, if the update node u is not recorded in the update table, and the update information recorded in the update table has reached its limit (e.g., the update table has recorded 2000 update information), and there are no blank rows to record new update information, then the update node with the highest update count in the update table will be output, and the update information corresponding to that update node will be deleted. The update node u will then be updated to a blank row in the update table.
[0109] In this way, the most frequently updated node, or the node with the highest degree, is selected by updating the table and used as the target update node. Then, the most recent neighbor node of the target update node is used as the target neighbor node. The target update node and the target neighbor node are added to the sampling graph and connected. This allows for fast sampling of the dynamic graph without traversing the entire dynamic graph, while preserving the community structure characteristics of the dynamic graph.
[0110] As will be readily understood by those skilled in the art, based on the tightness of the connections between different nodes in graph data, a graph structure can be regarded as composed of different "clusters," where the connections between nodes within a "cluster" are tighter, while the connections between nodes between different "clusters" are relatively sparse. Such "clusters" are referred to as the community structure feature in a graph structure.
[0111] In step S405, the sampling map is updated based on the target update information.
[0112] In step S404, the update node with the highest update frequency and its neighboring nodes are selected from the update table, and the sampled graph is updated using the update node and its neighboring nodes.
[0113] For example, if the update node popped up in the update table is node u and the neighbor node is node v, first determine whether node v exists in the sampling graph. If it does, add node u to the sampling graph and connect node u and node v. If not, add both node u and node v to the sampling graph and connect node u and node v.
[0114] In another example, to keep the size of the sampled graph within a certain range, updating the sampled graph also includes deleting the same number of nodes as the number of new nodes added. Keeping the number of nodes in the sampled graph constant, optionally, the nodes deleted are those with the lowest degree in the sampled graph; that is, the degree of the deleted nodes is less than the degree of any other node in the sampled graph.
[0115] By removing nodes with low degrees, we avoid the problem of an unlimited increase in nodes in the sampling graph, which could cause an "explosion" in the number of nodes in the sampling graph. This ensures that the scale of the sampled graph data is controllable. At the same time, we further filter and retain nodes with tighter connections, which is more convenient for subsequent use in the sampling graph, such as using the sampling graph to train graph neural network models, and is more conducive to training graph neural network models with better performance.
[0116] In step S406, a storage request for the sampled image is sent to the storage system.
[0117] After updating the sampled image through the above steps, the image sampling system sends a storage request to the storage system, requesting the storage system to store the updated sampled image. The storage system responds to the storage request and stores the updated sampled image.
[0118] The following section uses the newly added connecting edge 1 (node u, node v) in the dynamic graph as an example to introduce the specific graph data sampling and processing process.
[0119] Figure 5 is a flowchart illustrating a specific implementation of the graph data sampling method provided in this application embodiment. This method can be executed by any computing-capable device, equipment, platform, or cluster of devices. This application embodiment does not specifically limit the specific computing device executing the method; a suitable computing device can be selected as needed. For example, it can be executed on a terminal device (e.g., a smartphone, personal computer, or tablet), or on both a terminal device and a cloud device (e.g., a cloud-side server), i.e., using an end-to-cloud collaborative architecture. It can also be completed on a cloud device. For ease of description, the form of the executing entity will not be distinguished in the following text; all will be described as a graph data sampling system.
[0120] In this embodiment of the application, an update table is first set up. The update table includes an update node field, an update count field, and a neighbor node field. The update node field indicates the recorded update node information, the update count field indicates the number of times the update node has been updated, and the neighbor node field indicates the most recently added neighbor node of the update node.
[0121] The graph data sampling system, in its actual operation, includes the following steps as shown in Figure 5:
[0122] Step S1: For any newly added edge edge = (u, v) in the dynamic graph, determine whether nodes u and v are both in the sampled graph and whether there is no edge connection between u and v. If yes, jump to step S2; otherwise, jump to step S3.
[0123] Step S2: Calculate the ratio of the geometric mean of the degrees of u and v to the average degree of all nodes in the sampled graph. Set a probability function that is proportional to the ratio. The higher the ratio, the higher the probability of connecting the two points in the sampled graph. For example, if the calculated probability is greater than a preset threshold (e.g., 0.5), then nodes u and v are connected; otherwise, they are not connected.
[0124] Step S3, for any newly added edge edge = (u, v) in the dynamic graph:
[0125] u is already in the sampling diagram: skip;
[0126] u has already been recorded in the update table: increment its occurrence count by 1, and update its neighbor nodes to v;
[0127] node u is not recorded in the sampling graph: add node u to the update table, set its occurrence count to 1, and set its neighboring nodes to v; if the update table is full, pop up the information of the node with the highest occurrence count, and use this information to update the sampling graph.
[0128] Step S4: Process node v in the same way as in step S3.
[0129] Step S5: If the update table is full, and if more nodes need to be added to the update table, the node that appears most frequently in the buffer needs to be popped to update the sampling map.
[0130] Step S6: Add the popped node and its last adjacent node to the sampling graph, and connect the two nodes.
[0131] Step S7: Delete the same number of nodes as the number of newly added nodes in the sampling graph, keeping the number of nodes in the sampling graph unchanged; the deletion criterion is to select the node with the lowest degree in the sampling graph.
[0132] The graph data sampling method provided in this application, by setting an update table, first stores the update nodes corresponding to the update edges of the dynamic graph that are continuously updated over time into the update table, and records the number of times each update node is updated in the update table. When the number of update nodes recorded in the update table reaches a preset number (e.g., the number when the update table is full), the update node with the most update times in the update table is popped out and added to the sampling graph as the target update node. In this way, by setting the update table, nodes with higher degrees are filtered out and added to the sampling graph, so as to sample the dynamic graph while preserving the community structure characteristics of the graph data, and to achieve fast sampling of the dynamic graph without traversing the entire dynamic graph, thus improving the real-time performance of dynamic graph sampling.
[0133] This application also provides a graph data sampling device, as shown in Figure 6, comprising:
[0134] The acquisition module is used to acquire update edge information in graph data, wherein the update edge information indicates newly added connection edges in the graph data, and the first and second update nodes connected to the newly added connection edges;
[0135] The determination module is used to determine that the updated edge information does not meet the preset conditions. The preset conditions include that both the first updated node and the second updated node are in the sampled graph, and there is no connecting edge between the first updated node and the second updated node. The sampled graph is obtained based on sampling the graph data.
[0136] The first update module is used to update the update table based on the update edge information. The update table records multiple update information entries. Each update information entry includes an update node, an update count, and the neighbor node. The update count indicates the number of times the update node has been updated, and the neighbor node indicates the most recently added neighbor node of the update node.
[0137] A pop-up module is used to pop up target update information when the number of update node information records in the update table reaches a preset number, wherein the update node in the target update information has the maximum number of updates.
[0138] The second update module is used to update the sampling map based on the target update information.
[0139] The acquisition module, determination module, first update module, pop-up module, and second update module can all be implemented in software or hardware. For example, the implementation of the acquisition module will be described below. Similarly, the implementation of the determination module, first update module, pop-up module, and second update module can refer to the implementation of the acquisition module.
[0140] As an example of a software functional unit, a module can include code running on a computing instance. A computing instance can include at least one of a physical host (computing device), a virtual machine, or a container. Furthermore, the aforementioned computing instance can be one or more. For example, a module can include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code can be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code can be distributed within the same availability zone (AZ) or in different AZs, each AZ comprising one or more geographically proximate data centers. Typically, a region can include multiple AZs.
[0141] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0142] As an example of a hardware functional unit, an acquisition module may include at least one computing device, such as a server. Alternatively, the acquisition module may be implemented using a central processing unit (CPU), an application-specific integrated circuit (ASIC), or a programmable logic device (PLD). The aforementioned PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a neural network processing unit (NPU), a system-on-chip (SoC), an offload card, an accelerator card, or any combination thereof.
[0143] The acquisition module includes multiple computing devices that can be distributed within the same region or in different regions. Similarly, the acquisition module can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the acquisition module can be distributed within the same Virtual Private Cloud (VPC) or multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offloading cards, and accelerator cards.
[0144] It should be noted that, in other embodiments, the acquisition module can be used to execute any step in the graph data sampling method, the determination module can be used to execute any step in the graph data sampling method, the first update module can be used to execute any step in the graph data sampling method, the pop-up module can be used to execute any step in the graph data sampling method, and the second update module can be used to execute any step in the graph data sampling method. The steps implemented by the acquisition module, determination module, first update module, pop-up module, and second update module can be specified as needed. By implementing different steps in the graph data sampling method through the acquisition module, determination module, first update module, pop-up module, and second update module, all functions of the graph data sampling device can be realized.
[0145] This application also provides a computing device 100. As shown in FIG7, the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other via the bus 102. The computing device 100 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 100.
[0146] Bus 102 can be a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a Unified Bus (Ubus or UB), a Compute Express Link (CXL), a Cache Coherent Interconnect for Accelerators (CCIX), etc. The Unified Bus is also known as the Lingqu Bus. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one line is used in Figure 7, but this does not imply that there is only one bus or one type of bus. Bus 104 can include pathways for transmitting information between various components of the computing device 100 (e.g., memory 106, processor 104, communication interface 108).
[0147] The processor 104 may include any one or more of the following computing devices: central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP) or digital signal processor (DSP), ASIC, FPGA, CPLD, NPU, SoC, offload card, accelerator card, etc.
[0148] Memory 106 may include volatile memory, such as random access memory (RAM). Processor 104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD). Furthermore, memory 106 may also be implemented using storage class memory (SCM), phase change memory (PCM), or other types of storage media.
[0149] It is worth noting that the same type of storage medium can be configured in the same computing device to realize the function of memory 106, or two or more types of storage media can be configured to realize the function of memory 106. This application does not limit this.
[0150] The memory 106 stores executable program code, which the processor 104 executes to implement the functions of the aforementioned acquisition module, determination module, first update module, pop-up module, and second update module, thereby realizing the graph data sampling method. In other words, the memory 106 stores instructions for executing the graph data sampling method.
[0151] The communication interface 103 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 100 and other devices or communication networks.
[0152] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0153] As shown in Figure 8, the computing device cluster includes at least one computing device 100. The memory 106 of one or more computing devices 100 in the computing device cluster may store the same instructions for executing the graph data sampling method.
[0154] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the graph data sampling method. In other words, a combination of one or more computing devices 100 can jointly execute the instructions for executing the graph data sampling method.
[0155] It should be noted that the memory 106 in different computing devices 100 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the graph data sampling device. That is, the instructions stored in the memory 106 of different computing devices 100 can implement the functions of one or more modules among the acquisition module, determination module, first update module, pop-up module, and second update module.
[0156] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 9 illustrates one possible implementation. As shown in Figure 9, two computing devices 100A and 100B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 106 in computing device 100A stores instructions for executing the functions of an acquisition module and a determination module. Simultaneously, the memory 106 in computing device 100B stores instructions for executing the functions of a first update module, a pop-up module, and a second update module.
[0157] The connection method between the computing device clusters shown in Figure 9 can be considered in this application, which requires updating the update table and updating the sampled graph. Therefore, the functions implemented by the first update module, the pop-up module and the second update module are to be executed by the computing device 100B.
[0158] It should be understood that the functions of computing device 100A shown in Figure 9 can also be performed by multiple computing devices 100. Similarly, the functions of computing device 100B can also be performed by multiple computing devices 100.
[0159] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform a graph data sampling method.
[0160] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to perform a graph data sampling method.
[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A graph data sampling method, characterized in that, include: Obtain update edge information from graph data, wherein the update edge information indicates newly added connection edges in the graph data, and the first and second update nodes connected to the newly added connection edges; The updated edge information is determined not to meet the preset conditions. The preset conditions include that both the first updated node and the second updated node are in the sampled graph, and there is no connecting edge between the first updated node and the second updated node. The sampled graph is obtained by sampling the graph data. The update table is updated based on the updated edge information. The update table records multiple update information entries, and each update information entry indicates the number of times the recorded update node has been updated. When the number of update node information entries recorded in the update table reaches a preset number, the update table pops up target update information, and the update node in the target update information has the maximum number of updates. The sampling map is updated based on the target update information.
2. The method according to claim 1, characterized in that, Each update message includes an update node, an update count, and neighboring nodes. The update node indicates the recorded update node information, the update count indicates the number of times the update node has been updated, and the neighboring nodes indicate the most recently added neighboring nodes of the update node.
3. The method according to claim 2, characterized in that, The update table update based on the updated data includes: It is determined that the first update node and / or the second update node do not exist in the sampling graph, and the update table does not contain update information corresponding to the first update node and / or the second update node; Add first update information and / or second update information to the update table. In the first update information, the update node is the first update node, the update count is 1, and the neighbor node is the second update node. In the second update information, the update node is the second update node, the update count is 1, and the neighbor node is the first update node.
4. The method according to claim 2 or 3, characterized in that, The update table update based on the updated data includes: It is determined that the first update node does not exist in the sampling graph, and the update table contains update information corresponding to the first update node; An update operation is performed on the update information corresponding to the first update node, so that the update count in the update information corresponding to the first update node is incremented by one, and the neighbor node is updated to the second update node; And / or, determine that the second update node does not exist in the sampling graph, and that update information corresponding to the second update node exists in the update table; An update operation is performed on the update information corresponding to the second update node, so that the update count in the update information corresponding to the second update node is incremented by one, and the neighbor node is updated to the first update node.
5. The method according to any one of claims 1-4, characterized in that, The update table update based on the updated data includes: If it is determined that the first update node and the second update node exist in the sampling graph, then no update operation is performed on the update table.
6. The method according to any one of claims 2-5, characterized in that, The step of updating the sampling map based on the target update information includes: Add the target update node and the target neighbor node to the sampling graph, wherein the target update node is the update node in the target update information, and the target neighbor node is the neighbor node in the target update information; Add a connection edge between the target update node and the target neighbor node.
7. The method according to any one of claims 1-6, characterized in that, The step of updating the sampling map based on the target update information includes: The number of nodes added to the sampling graph is determined to be N, where N is a positive integer; Delete N nodes in the sampling graph, where the degree of each of the N nodes is less than the degree of any other node in the sampling graph.
8. The method according to any one of claims 1-7, characterized in that, Also includes: It is determined that the updated edge information satisfies the preset condition; Based on the degree of the first updated node, the degree of the second updated node, and the degree of each node in the sampled graph, it is determined whether to add a connection edge between the first updated node and the second updated node.
9. The method according to claim 8, characterized in that, The step of determining whether to add a connection edge between the first update node and the second update node based on the degree of the first update node, the degree of the second update node, and the degree of each node in the sampled graph includes: Calculate the geometric mean of the degree of the first updated node and the degree of the second updated node to obtain the target geometric mean; Based on the degree of each node in the sampled graph, the average degree of the nodes in the sampled graph is calculated. The connection probability is determined based on the ratio of the target geometric mean to the node average degree. If the connection probability is greater than a preset threshold, a connection edge is added between the first update node and the second update node; otherwise, no connection edge is added between the first update node and the second update node.
10. A graph data sampling device, characterized in that, include: The acquisition module is used to acquire update edge information in graph data, wherein the update edge information indicates newly added connection edges in the graph data, and the first and second update nodes connected to the newly added connection edges; The determination module is used to determine that the updated edge information does not meet the preset conditions. The preset conditions include that both the first updated node and the second updated node are in the sampled graph, and there is no connecting edge between the first updated node and the second updated node. The sampled graph is obtained based on sampling the graph data. The first update module is used to update the update table based on the update edge information. The update table records multiple update information entries. Each update information entry includes an update node, an update count, and the neighbor node. The update count indicates the number of times the update node has been updated, and the neighbor node indicates the most recently added neighbor node of the update node. A pop-up module is used to pop up target update information when the number of update node information records in the update table reaches a preset number, wherein the update node in the target update information has the maximum number of updates. The second update module is used to update the sampling map based on the target update information.
11. The apparatus according to claim 10, characterized in that, Each update message includes an update node, an update count, and neighboring nodes. The update node indicates the recorded update node information, the update count indicates the number of times the update node has been updated, and the neighboring nodes indicate the most recently added neighboring nodes of the update node.
12. The apparatus according to claim 11, characterized in that, The first update module is specifically used for: It is determined that the first update node and / or the second update node do not exist in the sampling graph, and the update table does not contain update information corresponding to the first update node and / or the second update node; Add first update information and / or second update information to the update table. In the first update information, the update node is the first update node, the update count is 1, and the neighbor node is the second update node. In the second update information, the update node is the second update node, the update count is 1, and the neighbor node is the first update node.
13. The apparatus according to claim 11 or 12, characterized in that, The first update module is also used for: It is determined that the first update node does not exist in the sampling graph, and the update table contains update information corresponding to the first update node; An update operation is performed on the update information corresponding to the first update node, so that the update count in the update information corresponding to the first update node is incremented by one, and the neighbor node is updated to the second update node; And / or, determine that the second update node does not exist in the sampling graph, and that update information corresponding to the second update node exists in the update table; An update operation is performed on the update information corresponding to the second update node, so that the update count in the update information corresponding to the second update node is incremented by one, and the neighbor node is updated to the first update node.
14. The apparatus according to any one of claims 10-13, characterized in that, The first update module is also used for: If it is determined that the first update node and the second update node exist in the sampling graph, then no update operation is performed on the update table.
15. The apparatus according to any one of claims 11-14, characterized in that, The second sampling module is specifically used for: Add the target update node and the target neighbor node to the sampling graph, wherein the target update node is the update node in the target update information, and the target neighbor node is the neighbor node in the target update information; Add a connection edge between the target update node and the target neighbor node.
16. The apparatus according to any one of claims 10-15, characterized in that, The second sampling module is also used for: The number of nodes added to the sampling graph is determined to be N, where N is a positive integer; Delete N nodes in the sampling graph, where the degree of each of the N nodes is less than the degree of any other node in the sampling graph.
17. The apparatus according to any one of claims 10-16, characterized in that, Also includes: The third update module is used to determine whether the updated edge information satisfies the preset conditions; Based on the degree of the first updated node, the degree of the second updated node, and the degree of each node in the sampled graph, it is determined whether to add a connection edge between the first updated node and the second updated node.
18. The apparatus according to claim 17, characterized in that, The step of determining whether to add a connection edge between the first update node and the second update node based on the degree of the first update node, the degree of the second update node, and the degree of each node in the sampled graph includes: Calculate the geometric mean of the degree of the first updated node and the degree of the second updated node to obtain the target geometric mean; Based on the degree of each node in the sampled graph, the average degree of the nodes in the sampled graph is calculated. The connection probability is determined based on the ratio of the target geometric mean to the node average degree. If the connection probability is greater than a preset threshold, a connection edge is added between the first update node and the second update node; otherwise, no connection edge is added between the first update node and the second update node.
19. A computing device, the computing device comprising at least one computing device, each computing device including a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the operational steps of the method as described in any one of claims 1 to 9.
20. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the operational steps of the method as described in any one of claims 1 to 9.
21. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the operation steps of the method as described in any one of claims 1 to 9.
22. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a cluster of computing devices, perform the operational steps of the method as described in any one of claims 1 to 9.