Graph partitioning method, device, computer equipment and storage medium

By determining candidate computing nodes for edge division based on edge vertices and storage status information of computing nodes in the graph computing system, the problem of increased cross-partition communication caused by unreasonable graph division in graph computing is solved, and computing efficiency and results are improved. rationality.

CN113688286BActive Publication Date: 2024-10-15SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110871059.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-30
Publication Date
2024-10-15
Estimated Expiration
2041-07-30

AI Technical Summary

Technical Problem

When existing graph computing systems process very large-scale graph data, unreasonable graph division leads to increased cross-partition communication and reduced computing efficiency.

Method used

By obtaining the target edge set, each edge is read in turn and candidate computing nodes are determined based on the edge vertices and the storage status information of the computing nodes, optimizing the division of edges and improving the rationality of the division results.

Benefits of technology

It reduces the communication overhead in the graph calculation process, improves the processing efficiency and the rationality of the division results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113688286B_ABST
    Figure CN113688286B_ABST
Patent Text Reader

Abstract

The present application relates to a graph partitioning method, device, computer equipment and storage medium, and relates to the field of graph computing technology, wherein the graph partitioning method is applied to a target computing node of a graph partitioning system, the graph partitioning system includes multiple computing nodes, the target computing node is any one of the multiple computing nodes, and the target computing node can obtain the storage status information of each computing node when partitioning the edge, and the storage status information is used to indicate each edge that the computing node has stored, and then the computing node with a higher degree of association with the edge is determined as the candidate computing node corresponding to the edge according to the storage status information of each computing node and the two vertices included in the edge, so that the candidate computing node can store the edge. In this way, when partitioning each edge read, it is determined based on the edges that the computing node has stored to which the read edge should be partitioned, thereby improving the rationality of the partitioning result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of graph computing technology, and in particular to a graph partitioning method, apparatus, computer device and storage medium. Background Art

[0002] A graph is an abstract data structure used to represent the relationship between objects. It is described using vertices and edges, where vertices are used to represent objects and edges are used to represent the relationship between objects. Graph computing is a computing method that uses graphs as data models to express and solve problems. In the current mainstream graph computing system, the entire graph usually needs to be loaded into memory during graph computing. However, with the development of the times, the scale of graphs is getting larger and larger, occupying more and more memory. However, the memory of a single computer device is limited. Therefore, a single computer device cannot process ultra-large-scale graph data, but needs to divide the ultra-large-scale graph data into multiple small graphs, and then different computer devices process each small graph separately.

[0003] In the prior art, a computer device generally reads each edge in a large-scale graph data one by one, and then randomly assigns each read edge to a certain computer device, based on the principle that the number of edges stored in each computer device is equal or approximately equal.

[0004] However, this graph partitioning method easily places multiple adjacent edges into different computer devices during the partitioning process, which increases the amount of cross-partition communication and ultimately reduces the computational efficiency of the graph calculation stage. Therefore, the partitioning result is unreasonable. Summary of the invention

[0005] Based on this, it is necessary to provide a graph partitioning method, apparatus, computer device and storage medium that can improve the rationality of the partitioning results in response to the above technical problems.

[0006] A graph partitioning method is applied to a target computing node of a graph partitioning system, wherein the graph partitioning system includes multiple computing nodes, and the target computing node is any one of the multiple computing nodes. The method includes:

[0007] Obtain a target edge set, where the target edge set is any one of multiple edge sets obtained after the original graph data set is initially partitioned, and the target edge set includes multiple edges;

[0008] Read each edge in the target edge set in sequence, and for each edge read, determine a candidate computing node corresponding to the edge from each computing node according to the vertices included in the edge and the storage status information of each computing node, so as to trigger the candidate computing node to store the edge, and update the storage status information of the candidate computing node;

[0009] The storage status information is used to indicate the edges that have been stored by the computing node.

[0010] In one embodiment, determining a candidate computing node corresponding to the edge from each computing node according to the vertices included in the edge and the storage status information of each computing node includes:

[0011] Determine vertex information corresponding to the vertices included in the edge according to the vertices included in the edge and the storage status information of each computing node, where the vertex information is used to indicate the distribution status of the vertices included in the edge in each computing node;

[0012] A candidate computing node corresponding to the edge is determined from each computing node according to vertex information corresponding to the vertices included in the edge.

[0013] In one embodiment, determining a candidate computing node corresponding to the edge from each computing node according to vertex information corresponding to the vertices included in the edge includes:

[0014] If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in different computing nodes respectively, the edge is cached in the local cache queue of the target computing node;

[0015] According to the edges stored in the local cache queue of each computing node, the candidate computing nodes corresponding to the edges stored in the local cache queue of the target computing node are determined.

[0016] In one embodiment, determining, based on the edges stored in the local cache queue of each computing node, candidate computing nodes corresponding to each edge stored in the local cache queue of the target computing node includes:

[0017] Read the target edge from the local cache queue, where the target edge is any one of the edges cached in the local cache queue;

[0018] Obtain information about edges that share vertices with the target edge from local cache queues of other computing nodes except the target computing node;

[0019] According to the vertices included in the target edge, the storage status information of each computing node, and the information of the edge sharing the same vertex with the target edge, a candidate computing node corresponding to the target edge is determined from each computing node.

[0020] In one embodiment, obtaining information of edges having the same vertices as the target edge from local cache queues of other computing nodes except the target computing node includes:

[0021] Generate a vertex request according to the two vertices included in the target edge, and send the vertex request to other computing nodes, where the vertex request is used to instruct other computing nodes to send information of edges that share vertices with the target edge in the local cache queues of other computing nodes to the target computing node;

[0022] Receive information about edges in local cache queues of other computing nodes that share vertices with the target edge and are sent by other computing nodes.

[0023] In one embodiment, determining a candidate computing node corresponding to the target edge from each computing node according to the vertices included in the target edge, the storage status information of each computing node, and the information of the edge having the same vertex as the target edge includes:

[0024] According to the vertices included in the target edge, the storage status information of each computing node, and the information of the edge that shares a vertex with the target edge, the number of edges that share a vertex with the first vertex of the target edge among the edges stored by each computing node is counted to obtain a first number; the number of edges that share a vertex with the second vertex of the target edge among the edges stored by each computing node is counted to obtain a second number;

[0025] Determine candidate computing nodes corresponding to the target edge from among the computing nodes according to the first number and the second number.

[0026] In one embodiment, determining a candidate computing node corresponding to the target edge from each computing node according to the first number and the second number includes:

[0027] Determine the computing nodes corresponding to the maximum number according to the first number and the second number;

[0028] The candidate computing node corresponding to the target edge is determined from the computing nodes corresponding to the maximum number based on a preset strategy.

[0029] In one embodiment, after reading each edge in the target edge set in sequence, the method further includes:

[0030] Detect whether any of the two vertices included in the edge is locked by other computing nodes except the target computing node;

[0031] If it is locked by other computing nodes, continue to check whether any of the two vertices included in the edge is locked by other computing nodes except the target computing node, until both vertices included in the edge are not locked by other computing nodes;

[0032] If it is not locked by other computing nodes, the two vertices included in the edge are marked as locked in the shared list maintained by the graph partitioning system, and the candidate computing node corresponding to the edge is determined from each computing node based on the vertices included in the edge and the storage status information of each computing node.

[0033] In one embodiment, determining a candidate computing node corresponding to the edge from each computing node according to vertex information corresponding to the vertices included in the edge includes:

[0034] If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in the same computing node at the same time, a candidate computing node corresponding to the edge is determined based on a preset strategy from the computing nodes where the two vertices included in the edge appear at the same time.

[0035] In one embodiment, determining a candidate computing node corresponding to the edge from each computing node according to vertex information corresponding to the vertices included in the edge includes:

[0036] If the vertex information corresponding to the vertices included in the edge indicates that one and only one of the two vertices included in the edge appears in the computing node, a candidate computing node corresponding to the edge is determined based on a preset strategy from the computing nodes where one of the two vertices included in the edge appears.

[0037] In one embodiment, determining a candidate computing node corresponding to the edge from each computing node according to vertex information corresponding to the vertices included in the edge includes:

[0038] If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge do not appear in each computing node, a candidate computing node corresponding to the edge is determined from each computing node based on a preset strategy.

[0039] In one of the embodiments, the preset strategy is to select the computing node with the smallest load.

[0040] A graph partitioning device is applied to a target computing node of a graph partitioning system, wherein the graph partitioning system includes a plurality of computing nodes, and the target computing node is any one of the plurality of computing nodes. The device includes:

[0041] An acquisition module, used for acquiring a target edge set, where the target edge set is any one of multiple edge sets obtained after the original graph data set is initially divided, and the target edge set includes multiple edges;

[0042] A partitioning module is used to read each edge in the target edge set in turn. For each edge read, a candidate computing node corresponding to the edge is determined from each computing node based on the vertices included in the edge and the storage status information of each computing node, so as to trigger the candidate computing node to store the edge and update the storage status information of the candidate computing node; wherein the storage status information is used to indicate each edge that the computing node has stored.

[0043] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the above embodiments when executing the computer program.

[0044] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in any one of the above embodiments.

[0045] The above-mentioned graph partitioning method, device, computer equipment and storage medium can improve the rationality of the partitioning results. Among them, the graph partitioning method first performs an initial partitioning on the original graph data set to obtain multiple edge sets, and then each computing node concurrently partitions the edges in different edge sets, which improves the partitioning efficiency compared to the single computing node partitioning method. When the target computing node partitions the edge, it can obtain the storage status information of each computing node, and the storage status information is used to indicate the edges that the computing node has stored, and then determine the candidate computing node corresponding to the edge based on the storage status information of each computing node and the two vertices included in the edge. In this way, when partitioning each read edge, it is based on the edges that the computing node has stored to determine which computing node the read edge should be partitioned to, that is, the read edge is partitioned based on the relationship between the read edge and other edges, thereby improving the rationality of the partitioning results. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of a system for partitioning a graph in one embodiment;

[0047] Figure 2 A schematic diagram of a flow chart of a method for dividing a figure in an embodiment;

[0048] Figure 3 is a schematic diagram of an original graph data set before initial division in one embodiment;

[0049] Figure 4 A schematic diagram of each computing node acquiring an edge set in one embodiment;

[0050] Figure 5 A schematic diagram of storage status information sharing of computing nodes in one embodiment;

[0051] Figure 6 A schematic diagram of a flow chart of a method for determining a candidate computing node corresponding to a read edge in one embodiment;

[0052] Figure 7 A schematic flow chart of a method for dividing edges stored in a local cache queue at a target computing node in one embodiment;

[0053] Figure 8 A schematic flow chart of a method for a target computing node to obtain information about an edge that shares a vertex with a target edge in one embodiment;

[0054] Fig. 9 A flowchart of a method for a target computing node to obtain information of edges having the same vertices as the target edge in the local cache queues of other computing nodes in one embodiment;

[0055] Fig.10A schematic flow chart of a method for dividing a figure in another embodiment;

[0056] Fig.11 Schematic diagrams comparing the time division of the graph using three methods are shown in FIG;

[0057] Fig.12 A schematic diagram showing the effect of a cache window size on a replication factor;

[0058] Fig.13 A schematic diagram showing the effect of another cache window size on the replication factor;

[0059] Fig.14 A schematic diagram showing the effect of the number of computing nodes on the replication factor;

[0060] Fig.15 A schematic diagram showing another effect of the number of computing nodes on the replication factor;

[0061] Fig.16 It is a structural block diagram of a device for dividing a figure in an embodiment;

[0062] Fig.17 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. The technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0064] Current mainstream graph computing systems usually need to load the entire graph into memory before computing the graph. However, with the development of the times, the scale of graphs is getting larger and larger, occupying more and more memory. However, the memory of a single computer device is limited. Therefore, a single computer device cannot process ultra-large-scale graph data. Instead, it is necessary to divide the ultra-large-scale graph data into multiple small graphs, and then different computer devices process each small graph separately, which is distributed graph computing.

[0065] In the process of graph computing in a distributed environment, different computer devices (i.e. different partitions) need to communicate with each other, i.e. cross-partition communication. Since there are super nodes in the graph, the number of edges owned by the so-called super nodes accounts for a significant proportion of the total number of edges in the entire graph. If the vertices that share edges with the super nodes are divided into computer devices (partitions) different from the super nodes, a large amount of communication resources will be consumed during the graph computing process, which will greatly increase the communication cost and ultimately make the entire graph computing time longer.

[0066] In order to reduce the communication overhead of the graph calculation process, when dividing the graph, the division is performed only based on the principle that the number of edges stored in each computer device (partition) is equal or approximately equal. This will lead to unreasonable division results, which will cause the subsequent graph calculation time to become longer and the efficiency to become lower.

[0067] Furthermore, since the entire graph cannot be stored in the memory of a single machine, the current graph partitioning method is generally a streaming graph partitioning method. The so-called streaming graph partitioning method is a method in which graph data enters the computer device in the form of edge streams for partitioning. This method can only read the information of one edge at a time. Therefore, the amount of information used for edge partitioning is relatively small, and local and global information is not fully utilized. This will lead to unreasonable partitioning results.

[0068] Based on this, the graph partitioning method provided in the embodiment of the present application proposes to perform partitioning on multiple computing nodes in parallel to improve the partitioning efficiency. At the same time, the storage status information of multiple computing nodes is shared, so that each computing node can obtain the maximum local and global information when partitioning the read edges, thereby improving the rationality of the partitioning results, reducing communication overhead for subsequent graph calculation processes, and improving processing efficiency.

[0069] Below, the implementation environment involved in the graph partitioning method provided in the embodiment of the present application will be briefly described.

[0070] like Figure 1 As shown, the implementation environment is a graph partitioning system, wherein the graph partitioning system includes multiple computing nodes. Figure 1 4 computing nodes are shown in the figure, namely P1, P2, P3 and P4, and each computing node performs the same task. The connection between P1, P2, P3 and P4 indicates that each computing node can communicate through the network. Each computing node can also share its own storage status information with other computing nodes.

[0071] Optionally, in the embodiment of the present application, the computing node may be a terminal or a server, wherein the server may be implemented as an independent server or a server cluster composed of multiple servers. The terminal is, for example, a desktop computer, a laptop computer, etc.

[0072] like Figure 2 As shown, a graph partitioning method is provided, which can be applied to Figure 1 The graph partitioning system shown includes multiple computing nodes. For the sake of convenience, the following is an example of applying the method to a target computing node of the graph partitioning system, wherein the target computing node is any one of the multiple computing nodes included in the graph partitioning system. The method includes the following steps:

[0073] Step 201: The target computing node obtains a target edge set.

[0074] The target edge set is any one of multiple edge sets obtained after the original graph data set is initially partitioned, and the target edge set includes multiple edges.

[0075] In the embodiment of the present application, a computing node is randomly selected from multiple computing nodes included in the graph partitioning system as the main computing node, wherein the randomly selected main computing node may be the target computing node in the embodiment of the present application.

[0076] The main computing node is mainly used to perform initial partitioning of the original graph data set. The main computing node can equally partition the entire data set into k blocks of data, where k represents the number of multiple computing nodes included in the graph partitioning system. After the main computing node divides the original graph data set into k blocks, it obtains k edge sets and transmits the edge sets to each computing node (including the main computing node itself) included in the graph partitioning system through the communication network.

[0077] In this way, each computing node is assigned to an edge set. For example, if the total number of edges included in the original graph dataset is E, then the number of edges included in each edge set can be When it cannot be divided evenly, the extra edges are randomly assigned to each computing node.

[0078] like Figure 3 As shown, Figure 3 This is a schematic diagram of the original graph dataset before initial partitioning. Figure 3 The graph partitioning system shown in includes four computing nodes, namely P1, P2, P3 and P4, where P1 is the main computing node, and P1 performs initial partitioning on the original graph data set. Figure 4 A schematic diagram of the edge set is obtained for each computing node.

[0079] In step 202, the target computing node reads each edge in the target edge set in turn. For each edge read, the candidate computing node corresponding to the edge is determined from each computing node based on the vertices included in the edge and the storage status information of each computing node, so as to trigger the candidate computing node to store the edge and update the storage status information of the candidate computing node.

[0080] The target computing node sequentially reads each edge in the target edge set, that is, the edges included in the target edge set sequentially enter the target computing node in the form of edge flows.

[0081] The target computing node processes each edge read according to the graph partitioning method provided in the embodiment of the present application. When each computing node included in the graph partitioning system has completed processing the edges in the edge set assigned to it, the entire graph partitioning process is completed.

[0082] The following describes the process by which the target compute node processes each edge it reads:

[0083] First, after the target computing node reads the edge, it can obtain two vertices included in the edge. The two vertices have vertex identifiers, and the vertex identifiers are used to distinguish between the vertices.

[0084] Secondly, the target computing node can obtain the storage status information of each computing node (including the target computing node) included in the graph partitioning system. The storage status information is used to indicate each edge that the computing node has stored. The edge is composed of vertices, so it can also be understood that the storage status information is the vertex storage status information.

[0085] Optionally, in an embodiment of the present application, the target computing node may share its storage status information with other computing nodes. Correspondingly, other computing nodes may also share their storage status information with the target computing node, and the target computing node obtains the storage status information of other computing nodes based on the sharing of other computing nodes.

[0086] Optionally, in an embodiment of the present application, the graph partitioning system maintains a shared list, and each computing node can update data in the shared list and can also read data from the shared list. Figure 5 As shown, Figure 5 Four computing nodes P1, P2, P3 and P4 are shown in the figure, wherein computing nodes P1, P2, P3 and P4 can write their own storage status information A(P1), A(P2), A(P3) and A(P4) into the shared list, thereby forming the union of the storage status information of multiple computing nodes A(P1)∪A(P2)∪A(P3)∪A(P4) in the shared list. Among them, each computing node can also read the storage status information of other computing nodes from the shared list. Based on this, the target computing node can obtain the storage status information of each computing node included in the graph partitioning system from the shared list.

[0087] Finally, the target computing node determines the candidate computing node corresponding to the edge from among the computing nodes according to the vertices included in the edge and the storage status information of each computing node.

[0088] Among them, the target computing node can determine the computing node with a higher correlation with the edge based on the vertices included in the edge and the storage status information of each computing node (including the storage status information of the target computing node itself), and determine the computing node with a higher correlation as the candidate computing node corresponding to the edge.

[0089] The degree of association between each computing node and the edge is represented by the number of edges stored in each computing node that share vertices with the edge. The larger the number, the higher the degree of association, and the smaller the number, the lower the degree of association.

[0090] Among them, the method for determining the association between each computing node and the edge can be: the target computing node can count the number of edges that share vertices with the edge and are already stored in each computing node, and then the target computing node can determine the association between each computing node and the edge based on the number of edges that share vertices with the edge and are already stored in each computing node.

[0091] Optionally, the partitioning algorithm provided in the embodiment of the present application mainly determines the candidate computing nodes corresponding to the edges based on the vertex information of each current computing node, and evaluates and scores each computing node based on the vertex information, so as to select a more suitable partition (i.e., candidate computing node). When the partitioning algorithm scores, it is necessary to count the vertex information of the edges that have been divided and stored in each computing node, so the more edges that have been divided and stored in each computing node, the greater the gain to the partitioning algorithm.

[0092] In practical applications, the candidate computing node corresponding to the edge may be the target computing node itself, or may be other computing nodes except the target computing node.

[0093] If the candidate computing node corresponding to the edge is the target computing node itself, the target computing node stores the edge. Since the storage state information of the target computing node changes after storing the edge, the target computing node also needs to update its own storage state information.

[0094] If the candidate computing node corresponding to the edge is a computing node other than the target computing node, the target computing node can send the edge to the candidate computing node. After receiving the edge, the candidate computing node stores it and updates the storage status information of the candidate computing node.

[0095] Optionally, the target computing node and the candidate computing nodes update their respective storage status information in a shared list maintained by the graph partitioning system.

[0096] The graph partitioning method provided in the embodiment of the present application first performs an initial partitioning on the original graph data set to obtain multiple edge sets, and then each computing node concurrently partitions the edges in different edge sets, which improves the partitioning efficiency compared to the single computing node partitioning method. When the target computing node partitions the edge, it can obtain the storage status information of each computing node, and the storage status information is used to indicate the edges that the computing node has stored. Then, based on the storage status information of each computing node and the two vertices included in the edge, the computing node with a higher degree of association with the edge is determined as the candidate computing node corresponding to the edge, so that the candidate computing node can store the edge. In this way, when partitioning each edge that is read, it is determined based on the edges that the computing node has stored to which computing node the read edge should be partitioned, that is, the read edge is partitioned based on the relationship between the read edge and other edges, thereby improving the rationality of the partitioning result.

[0097] In one embodiment of the present application, Figure 6 As shown, the process of the target computing node determining the candidate computing node corresponding to the read edge from each computing node includes the following:

[0098] Step 601: The target computing node determines vertex information corresponding to the vertices included in the edge according to the vertices included in the edge and the storage status information of each computing node.

[0099] The vertex information is used to indicate the distribution status of the vertices included in the edge in each computing node.

[0100] Optionally, the vertex information corresponding to the vertices included in the edge may include the following: whether the vertices included in the edge exist in each computing node and the number of the vertices included in the edge in each computing node.

[0101] For example, the graph partitioning system includes four computing nodes, namely P1, P2, P3 and P4, wherein the target computing node is any one of the four computing nodes, for example, the target computing node is P2. The edge read by the target computing node P2 is edge A, and edge A includes two vertices A1 and A2. Then the vertex information corresponding to the vertices included in edge A can be: the number of edges including vertex A1 and the number of edges including vertex A2 in the edges already stored in computing node P1, the number of edges including vertex A1 and the number of edges including vertex A2 in the edges already stored in computing node P2, the number of edges including vertex A1 and the number of edges including vertex A2 in the edges already stored in computing node P3, and the number of edges including vertex A1 and the number of edges including vertex A2 in the edges already stored in computing node P4.

[0102] The number may be 0, where 0 indicates that the vertex included in the edge does not exist in the calculation node.

[0103] Step 602: The target computing node determines a candidate computing node corresponding to the edge from among the computing nodes according to vertex information corresponding to the vertices included in the edge.

[0104] In the embodiment of the present application, the process of the target computing node determining the candidate computing node corresponding to the edge according to the vertex information corresponding to the vertex included in the edge is as follows:

[0105] S1, if the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in the same computing node at the same time, the target computing node determines the candidate computing node corresponding to the edge from the computing nodes where the two vertices included in the edge appear at the same time based on a preset strategy.

[0106] For example, the graph partitioning system includes four computing nodes, namely P1, P2, P3 and P4, wherein the target computing node is any one of the four computing nodes, for example, the target computing node is P2. The edge read by the target computing node P2 is edge A, and edge A includes two vertices A1 and A2.

[0107] A1 and A2 exist simultaneously in computing node P1, A1 and A2 also exist simultaneously in target computing node P2, and A1 and A2 also exist simultaneously in computing node P3. In this case, computing nodes P1, P2, and P3 are computing nodes where two vertices included in the edge appear simultaneously. Then, the candidate computing nodes corresponding to the edge are determined from computing nodes P1, P2, and P3 based on the preset strategy.

[0108] Optionally, the preset strategy is to select the computing node with the smallest load, that is, to select the computing node with the smallest load from computing nodes P1, P2, and P3 as the candidate computing node corresponding to the edge.

[0109] The load of each computing node is determined according to the number of edges stored in each computing node. Therefore, the target computing node can determine the load of each computing node through the storage status information of each computing node.

[0110] Optionally, the preset strategy is to count the number of edges that share vertices with the edge in each computing node, and select the computing node corresponding to the maximum number as the candidate computing node corresponding to the edge. If there are multiple computing nodes corresponding to the maximum number, the one with the smallest load is selected, or one is randomly selected as the candidate computing node corresponding to the edge.

[0111] S2, if the vertex information corresponding to the vertices included in the edge indicates that one and only one of the two vertices included in the edge appears in the computing node, the target computing node determines the candidate computing node corresponding to the edge from the computing nodes where one of the two vertices included in the edge appears based on a preset strategy.

[0112] Continuing with the above example, the target computing node is P2, and the edge read by the target computing node P2 is edge A, which includes two vertices A1 and A2. Vertex A1 appears in the target computing node P2 and computing nodes P3 and P4, and vertex A2 does not appear in any computing node. In this case, the target computing node P2 and computing nodes P3 and P4 are computing nodes where one of the two vertices included in the edge appears. The target computing node determines the candidate computing node corresponding to the edge from computing nodes P2, P3, and P4 based on the preset strategy.

[0113] Optionally, the preset strategy is: select the computing node with the smallest load.

[0114] Optionally, the preset strategy is: count the number of edges in each computing node that share vertices with the edge, and select the computing node corresponding to the maximum number as the candidate computing node corresponding to the edge.

[0115] S3: If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge do not appear in each computing node, determine a candidate computing node corresponding to the edge from each computing node based on a preset strategy.

[0116] Continuing with the above example, the target computing node is P2, and the edge read by the target computing node P2 is edge A. Edge A includes two vertices A1 and A2. Neither the target computing node P2 nor the computing nodes P1, P3, and P4 store vertex A1 or vertex A2. Then the target computing node P2 determines the candidate computing node corresponding to the edge from P1, P2, P3, and P4 based on the preset strategy.

[0117] Optionally, the preset strategy is: select the computing node with the smallest load.

[0118] Optionally, the preset strategy is: count the number of edges in each computing node that share vertices with the edge, and select the computing node corresponding to the maximum number as the candidate computing node corresponding to the edge.

[0119] It should be noted that the embodiments of the present application can also combine the solutions disclosed in S1, S2, and S3 above to divide the edges.

[0120] S4, if the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in different computing nodes respectively, the edge is cached in the local cache queue of the target computing node. According to the edges stored in the local cache queue of each computing node, the candidate computing nodes corresponding to each edge stored in the local cache queue of the target computing node are determined.

[0121] Continuing with the above example, the target computing node is P2, and the edge read by the target computing node P2 is edge A. Edge A includes two vertices A1 and A2, where vertex A1 appears in the target computing node P2 and computing node P3, and vertex A2 appears in computing node P1 and computing node P4, that is, the two vertices appear in different computing nodes. In this case, the target computing node P2 cannot determine which computing node to divide edge A into, that is, it cannot determine the candidate computing node corresponding to edge A. In this case, the target computing node P2 can cache edge A in the local cache queue of the target computing node.

[0122] The local cache queue of the target computing node is described below.

[0123] In an embodiment of the present application, the target computing node can set a cache window based on its own memory capacity. The cache window stores data in the form of a cache queue. After the target computing node initializes the cache queue, the cache queue can be used to store the edges of the candidate computing nodes that the target computing node cannot determine temporarily.

[0124] Next, the process of the target computing node caching the edge into the local cache queue of the target computing node is described.

[0125] The target computing node determines whether the local cache queue is full. If not, the target computing node caches the edge in the local storage queue.

[0126] If it is full, the target computing node stops processing the edges in the target edge set and reads the frontmost edge from the local cache queue. Then, based on the edges stored in the local cache queue of each computing node, the candidate computing node corresponding to the frontmost edge is determined. After the frontmost edge is divided, the edges for which the candidate computing nodes cannot be determined are stored in the cache queue. Then, the target computing node can continue to process the edges in the target edge set.

[0127] When the edge division in the target edge set is completed, the target computing node can determine the candidate computing nodes corresponding to each edge stored in the local cache queue of the target computing node according to the edges stored in the local cache queue of each computing node. For details, see the following description.

[0128] The embodiment of the present application determines the vertex information corresponding to the vertices included in the edge according to the vertices included in the edge and the storage status information of each computing node, and then determines the candidate computing nodes corresponding to the edge from each computing node based on the vertex information corresponding to the vertices included in the edge, that is, divides the edge into candidate computing nodes for storage. This division method divides the read edges based on the distribution status of the vertices included in the edge in each computing node, obtains the storage status information of each computing node under distributed conditions, and determines the candidate computing nodes corresponding to the edge based on the storage status information of each computing node, which not only optimizes the performance of the graph division result, but also greatly reduces the time of graph division.

[0129] It should be noted that each computing node is provided with a local cache window, and the size of the local cache window of each computing node is based on the memory settings of each computing node itself. Since each computing node can obtain the edge data stored in the cache queue in the cache window of other computing nodes, for the entire graph partitioning system, it is equivalent to caching the edges with the capacity corresponding to the sum of the cache windows of multiple computing nodes. The larger the capacity of the cache window, the more information can be obtained when processing the edges in the cache window. Therefore, it is convenient for each computing node to obtain more global information, thereby improving the rationality of edge partitioning. If the capacity of the cache window is small, the number of edges stored in the cache window will be small, that is, the amount of information in the cache window is limited, resulting in poor edge partitioning performance.

[0130] Optionally, the partitioning algorithm provided in the embodiment of the present application, when determining the candidate computing nodes corresponding to the edges, not only relies on the vertex information of each current computing node, but also relies on the vertex information of the edges cached in the cache window. Specifically, each computing node is scored according to the vertex information of the edges that have been divided and stored by each computing node and the vertex information of the edges in the cache window, so as to select a more suitable candidate computing node. Among them, in each computing node, the more edges cached in the cache window, the more vertex information it caches, and the greater the gain to the partitioning algorithm.

[0131] Based on this, the capacity of the cache window will also have an impact on the determination of candidate computing nodes. This is mainly because, as the cache window capacity increases, when each edge in the cache window is divided, the division algorithm can obtain more vertex information of other edges from the cache window. At the same time, based on the vertex and edge status of each existing computing node, compared with the solution without a cache window or a small cache window capacity, the distributed cache window solution based on a larger capacity can avoid the division algorithm from falling into a local optimal situation during division, thereby improving the division quality.

[0132] Below, as Figure 7 As shown, the process of dividing the edges stored in the local cache queue of the target computing node is explained.

[0133] Step 701: The target computing node reads the target edge from the local cache queue.

[0134] In the embodiment of the present application, after the edge division in the target edge set is completed, the target computing node will divide the edges stored in the local cache queue regardless of whether the local cache queue is full.

[0135] The target edge is any one of the edges cached in the local cache queue. Optionally, the target edge may be the frontmost edge in the local cache queue.

[0136] Step 702: The target computing node obtains information about edges that share vertices with the target edge from local cache queues of other computing nodes except the target computing node.

[0137] In an optional implementation, the target computing node may share the edges cached in the local cache queue with other computing nodes, and accordingly, the target computing node may also obtain information about the edges in the local cache queues of other computing nodes shared by other computing nodes.

[0138] The target computing node may obtain information about the edge that shares a vertex with the target edge from the local cache queues of other computing nodes, wherein the information about the edge that shares a vertex with the target edge includes two vertices included in the edge that shares a vertex with the target edge.

[0139] In an optional implementation, Figure 8 As shown, the process of the target computing node obtaining the information of the edge having the same vertex as the target edge includes the following steps:

[0140] Step 801: The target computing node generates a vertex request according to two vertices included in the target edge, and sends the vertex request to other computing nodes.

[0141] The vertex request is used to instruct other computing nodes to send information about edges that share vertices with the target edge in the local cache queues of other computing nodes to the target computing node.

[0142] Step 802 : The target computing node receives information of edges having the same vertices as the target edge in the local cache queues of other computing nodes, which are sent by other computing nodes.

[0143] In an embodiment of the present application, the vertex request carries two vertices included in the target edge, for example, the target edge is e(u, v), and the target computing node requests information related to vertices u and v from other computing nodes by sending a vertex request. After receiving the vertex request, other computing nodes can extract edges that share vertices with vertices u and v in their respective local cache queues, that is, edges adjacent to vertex u and edges adjacent to vertex v, and send edges that share vertices with the target edge to the target computing node. In this way, the target computing node can receive information about edges that share vertices with the target edge in the local cache queues of other computing nodes sent by other computing nodes.

[0144] like Fig. 9 As shown, Fig. 9 In the example, the target computing node is P1, and the target edge is e(u,v). The target computing node P1 sends vertex requests to computing nodes P2, P3, and P4, respectively, which are represented by arrows 1, 2, and 3. The vertex request is used to instruct computing nodes P2, P3, and P4 to extract the edges that share the same vertex with vertex u or vertex v from their respective local cache queues. Computing nodes P2, P3, and P4 send the edges that share the same vertex with vertex u or vertex v to the target computing node P1, respectively. 1', 2', and 3' represent the feedback information from partitioned computing nodes P2, P3, and P4 to the target computing node P1, respectively. If there is no edge that shares the same vertex with vertex u or vertex v in the local cache queues of computing nodes P2, P3, and P4, null is returned.

[0145] Step 703 : The target computing node determines a candidate computing node corresponding to the target edge from among the computing nodes according to the vertices included in the target edge, the storage status information of each computing node, and the information of the edge sharing the same vertex with the target edge.

[0146] In an optional implementation, the target computing node counts the number of edges that share vertices with the first vertex of the target edge among the edges stored by each computing node based on the vertices included in the target edge, storage status information of each computing node, and information of edges that share vertices with the target edge to obtain a first number; counts the number of edges that share vertices with the second vertex of the target edge among the edges stored by each computing node to obtain a second number; and determines, from each computing node, a candidate computing node corresponding to the target edge based on the first number and the second number.

[0147] The process of the target computing node counting the number of edges in the edges stored by each computing node that share a vertex with the first vertex of the target edge to obtain a first number; and counting the number of edges in the edges stored by each computing node that share a vertex with the second vertex of the target edge to obtain a second number may include:

[0148] For example, if the target edge is e(u,v), the target computing node can traverse the storage status information of each computing node and the information of the edges with the same vertex as the target edge in the local cache queue of each computing node, find the adjacent node of vertex v, and record one adjacent node as 1 point to obtain the first quantity. Find the adjacent node of vertex u, and record one adjacent node as 1 point to obtain the second quantity.

[0149] Among them, the process of the target computing node determining the candidate computing nodes corresponding to the target edge from each computing node according to the first number and the second number includes: determining the computing nodes corresponding to the maximum number according to the first number and the second number; determining the candidate computing nodes corresponding to the target edge from the computing nodes corresponding to the maximum number based on a preset strategy.

[0150] Optionally, the preset strategy is: select the computing node with the smallest load. That is, after traversing all computing nodes, find the computing node with the highest score. If the number of computing nodes with the highest score is greater than 1, select the computing node with the lowest load from the computing nodes with the highest score as the candidate computing node corresponding to the target edge. If the number of selected computing nodes is still greater than 1, then randomly select one from the computing nodes with the highest score and the lowest load as the candidate computing node corresponding to the target edge e(u,v).

[0151] In another optional implementation, the target computing node can determine the vertex information of the vertices included in the target edge based on the vertices included in the target edge, the storage state information of each computing node, and the information of the edge that shares the same vertex with the target edge, wherein the vertex information of the vertices included in the target edge represents the distribution state of the vertices included in the target edge in each computing node. Then, the target computing node can determine the candidate computing node corresponding to the target edge from each computing node based on the vertex information of the vertices included in the target edge.

[0152] Among them, if the vertex information corresponding to the vertices included in the target edge indicates that the two vertices included in the target edge appear in the same computing node at the same time, the target computing node determines the candidate computing node corresponding to the target edge from the computing nodes where the two vertices included in the target edge appear at the same time based on a preset strategy.

[0153] If the vertex information corresponding to the vertices included in the target edge indicates that one and only one of the two vertices included in the target edge appears in the computing node, the target computing node determines the candidate computing node corresponding to the target edge from the computing nodes where one of the two vertices included in the target edge appears based on a preset strategy.

[0154] If the vertex information corresponding to the vertices included in the target edge indicates that the two vertices included in the target edge do not appear in each computing node, a candidate computing node corresponding to the target edge is determined from each computing node based on a preset strategy.

[0155] If the vertex information corresponding to the vertices included in the target edge indicates that the two vertices included in the edge appear in different computing nodes respectively, then the number of edges in each computing node that share vertices with the target edge is counted, and the computing node with the smallest load among the computing nodes with the largest number is selected as the candidate computing node corresponding to the target edge.

[0156] It should be noted that although the process of determining the candidate computing node corresponding to the target edge is similar to the process in S1, S2 and S3 in the above embodiments, the technical concept in the embodiments of the present application is that when it is temporarily impossible to determine which computing node to divide the edge to, it is cached in the local cache queue. As more and more edges are divided and stored by each computing node, each computing node can obtain more vertex information. On this basis, there is more global information to rely on when dividing the edges in the local cache queue, which is more conducive to the division algorithm making better division decisions.

[0157] In an embodiment of the present application, the target computing node can determine the edges that share vertices with the target edge in each computing node, whether they have been divided or not, based on the storage status information of each computing node and the information of the edges that share vertices with the target edge. In other words, the global distribution information of the two vertices included in the target edge is obtained, and the candidate computing node corresponding to the target edge is determined from each computing node based on the global distribution information, so that the division result of the target edge is more reasonable.

[0158] In practical applications, since the graph partitioning system includes multiple computing nodes that perform concurrent partitioning, it is possible that two or more computing nodes read edges with common vertices at the same time. Multiple computing nodes independently partition the edges with common vertices, which will cause each computing node to ignore the information of the edges with common vertices that other computing nodes are currently processing. In this way, when the edges are partitioned, the global information obtained is reduced, which will lead to unreasonable partitioning results. In order to avoid multiple computing nodes partitioning the edges with common vertices at the same time, such as Fig.10 As shown, an embodiment of the present application provides another graph partitioning method, which includes:

[0159] Step 1001: The target computing node obtains a target edge set.

[0160] The target edge set is any one of multiple edge sets obtained after the original graph data set is initially partitioned, and the target edge set includes multiple edges.

[0161] Step 1002: The target computing node sequentially reads each edge in the target edge set. For each edge read, the target computing node detects whether any one of two vertices included in the edge is locked by other computing nodes except the target computing node.

[0162] In the embodiment of the present application, when multiple computing nodes perform edge division in parallel, two vertices included in the edge currently being divided can be locked, and the locking state of the two vertices included in the edge currently being divided can be shared with each computing node included in the graph division system. In this way, when the target computing node divides the read edge, it can determine whether the two vertices included in the edge read by the target computing node are locked by other computing nodes by reading the vertices that have been locked by other computing nodes.

[0163] Optionally, in an embodiment of the present application, a shared list maintained by the graph partitioning system includes a lock table, which is used for each computing node to temporarily store two vertices included in the edge currently being partitioned. It can be understood that the computing node writes the two vertices included in the edge currently being partitioned into the lock table, which means that the two vertices are in a locked state. After the computing node completes the partitioning of the edge or stores the edge in a local cache queue, the computing node can remove the two vertices included in the edge from the lock table, that is, unlock the two vertices included in the edge.

[0164] The target computing node can traverse the vertices written in the lock table to determine whether the two vertices included in the edge currently read are on the lock table. If they are, it means that the two vertices included in the edge currently read by the target computing node are locked by other computing nodes except the target computing node. If not, it means that the two vertices included in the edge currently read by the target computing node are not locked by other computing nodes.

[0165] Step 1003: If locked by other computing nodes, the target computing node continues to detect whether any of the two vertices included in the edge is locked by other computing nodes except the target computing node, until both vertices included in the edge are not locked by other computing nodes.

[0166] For example, the two vertices u and v included in the edge e(u,v) have been written into the lock table. If the target computing node currently reads the edge e(u,h), since vertex u is locked, the two vertices included in the edge read by the target computing node are locked by other computing nodes. In this case, the target computing node cannot immediately divide the edge e(u,h), but needs to continuously check whether the two vertices u and h included in the currently read edge e(u,h) are locked by other computing nodes until both vertices included in the edge e(u,h) are not locked by other computing nodes.

[0167] In an embodiment of the present application, if the two vertices included in the edge currently read by the target computing node are locked by other computing nodes, it means that the target computing node cannot temporarily split the edge e(u,h), but needs to wait until both vertex u and vertex h are in an unlocked state before it can split the edge e(u,h).

[0168] Step 1004, if it is not locked by other computing nodes, the target computing node marks the two vertices included in the edge in the shared list maintained by the graph partitioning system as being in a locked state, and determines the candidate computing node corresponding to the edge from each computing node based on the vertices included in the edge and the storage status information of each computing node.

[0169] For example, the two vertices u and v included in the edge e(u,v) have been written into the lock table. If the target computing node currently reads the edge e(m,n), vertices m and n are not in the lock table. Therefore, neither of the two vertices included in the edge currently read by the target computing node is locked by other computing nodes. In this case, the target computing node can write vertices m and n into the lock table to mark the two vertices as being in a locked state. Then, the target computing node can determine the candidate computing node corresponding to the edge e(m,n) from each computing node based on the vertices included in the edge and the storage status information of each computing node.

[0170] Continuing with the example above, when vertex u changes from a locked state to an unlocked state, in this case, the target computing node can determine that the two vertices u and h included in edge e(u,h) are not locked by other computing nodes, and then the target computing node writes vertices u and h into the lock table to lock them, marking the two vertices included in edge e(u,h) in the shared list maintained by the graph partitioning system as being in a locked state. Then the edge e(u,h) is partitioned.

[0171] In an embodiment of the present application, after the target computing node completes the division of the read edge or stores the edge in the local cache queue, the edge can be removed from the lock table, which means that the two vertices included in the edge are no longer locked.

[0172] In the embodiment of the present application, by establishing a lock mechanism, the target computing node locks the two vertices included in the edge currently read. At this time, if the edge read by other computing nodes contains any one of the two vertices, the other computing nodes are in a suspended waiting state. When the target computing node completes the division of the currently read edge or stores it in the local storage queue, the two vertices included in the currently read edge are released. When other computing nodes find that the two vertices are in an unlocked state, they can continue to process the previously unfinished process. In this way, when dividing the edge, as much information as possible about the edge can be obtained, so that the edge can be divided more accurately and reasonably.

[0173] The superiority of the graph partitioning method provided in this application is verified by comparison below. The graph partitioning method is evaluated mainly from three indicators: graph partitioning time, graph partitioning performance and load balancing. The following is a comparative explanation from these three aspects respectively.

[0174] As shown in Table 1, Table 1 shows multiple sources of original graph data sets and the number of vertices and edges contained in their original graph data sets.

[0175] Table 1

[0176] Original graph dataset source Number of vertices Number of edges DBLP 317,080 1,049,866 com-Orkut 3,072,441 117,185,083 com-Livejournal 3,997,962 34,681,189 web-Google 875,713 5,105,039

[0177] Among them, DBLP is an integrated database system (English: DataBase systems and LogicProgramming, abbreviated as DBLP), com-Orkut is a social service network launched by Google, com-Livejournal is a comprehensive dating website, and web-Google is Google's web network. The vertices represent users, and the edges represent the associations between users.

[0178] The graph partitioning method provided in the embodiment of the present application is evaluated from the perspective of graph partitioning time.

[0179] The four original graph data sets shown in Table 1 are divided by the graph partitioning method provided in the embodiment of the present application and two existing stream graph partitioning methods, wherein the existing stream graph partitioning methods are Oblivious and HDRF (English: High Degree Replicate First, Chinese: High Degree Replicate First), and the results are as follows: Fig.11 shown. Fig.11 The following is a comparison diagram of the time division using three methods (for simplicity, Fig.11 In the text, "this solution" refers to the graph partitioning method provided in the embodiment of the present application). Fig.11 It can be seen that the time required for the graph partitioning method provided in the embodiment of the present application can be greatly reduced.

[0180] The graph partitioning method provided in the embodiment of the present application is evaluated from the perspective of load balancing.

[0181] The load balancing index calculation formula can be expressed as follows:

[0182] Where MAX(P i ) represents the computing node P i The number of edges stored, E represents the total number of edges, and P represents the number of computing nodes included in the graph partitioning system, as shown in Table 2, which shows the load balancing index of the graph partitioning method provided by Oblivious, HDRF and the embodiments of the present application.

[0183] Table 2

[0184] DBLP web-google com-livejournal com-orkut Oblivious ≤1‰ ≤1‰ ≤1‰ ≤1‰ HDRF ≤1‰ ≤1‰ ≤1‰ ≤1‰ This program ≤1‰ ≤1‰ ≤1‰ ≤1%

[0185] The graph partitioning method provided in the embodiment of the present application is evaluated from the perspective of graph partitioning performance.

[0186] The performance of graph partitioning is specifically represented by the size of the replication factor. The smaller the replication factor, the higher the quality of the graph partitioning, and vice versa. The performance of graph partitioning can be measured from two dimensions: the number of partitions and the size of the windows.

[0187] First, compare the partitioning performance with the window size.

[0188] In the embodiment of the present application, each computing node can set a cache window based on its own memory capacity. The cache window stores data in the form of a cache queue. The size of different cache windows will have different effects on the replication factor, where the calculation expression of the replication factor is:

[0189] like Fig.12 As shown, it shows the influence of the size of different cache windows of each computing node on the replication factor when the original graph data set DBLP in Table 1 is partitioned using the graph partitioning method provided in an embodiment of the present application and two existing flow graph partitioning methods. Fig.13 The figure shows the influence of the sizes of different cache windows of each computing node on the replication factor when the original graph data set com-Livejournal in Table 1 is partitioned using the graph partitioning method provided in an embodiment of the present application and two existing flow graph partitioning methods.

[0190] Among them, Fig.12 and Fig.13As shown, as the window size increases, the replication factor shows a continuous decreasing trend. On the original graph dataset DBLP, when the window size is equal to 15% of the total number of edges, this scheme can reduce 16.7% of the replicas generated compared to the Oblivious method; this scheme can reduce 12.5% ​​of the replicas generated compared to the HDRF method. On the original graph dataset com-Livejournal, this scheme can reduce about 20% of the replicas generated compared to the Oblivious method; this scheme can reduce 15.7% of the replicas generated compared to the HDRF method. Reducing the generation of replicas is equivalent to reducing the communication overhead in the graph calculation stage. According to Fig.12 and Fig.13 It can be seen that compared with the two existing flow graph partitioning methods, this scheme can significantly reduce the replication factor, thereby reducing the communication overhead introduced by data synchronization in the graph calculation stage, and speeding up the graph calculation iteration.

[0191] Second, the partitioning performance is compared with the number of computing nodes included in the graph partitioning system.

[0192] like Fig.14 As shown, it shows the influence of the number of computing nodes included in the graph partitioning system on the replication factor when the original graph data set DBLP in Table 1 is partitioned using the graph partitioning method provided in an embodiment of the present application and two existing flow graph partitioning methods. Fig.15 The figure shows the influence of the number of computing nodes included in the graph partitioning system on the replication factor when the original graph data set com-Livejournal in Table 1 is partitioned using the graph partitioning method provided in an embodiment of the present application and two existing stream graph partitioning methods.

[0193] according to Fig.14 and Fig.15 As shown in the figure, in a distributed scenario, increasing the number of computing nodes included in the graph partitioning system will increase the complexity of graph partitioning and affect the performance of the graph partitioning algorithm. Therefore, the running results of all algorithms, that is, the replication factor, are on an upward trend. On the original graph dataset DBLP, as the number of computing nodes increases, the Oblivious and HDRF flow graph partitioning methods significantly increase the replication factor index, while this scheme significantly reduces the replication factor index compared to the Oblivious and HDRF methods, by 19.8% and 15.2% respectively. On the original graph dataset com-Livejournal, this scheme still significantly reduces the replication factor index compared to the Oblivious and HDRF methods, by 17% and 10.5% respectively.

[0194] In summary, this scheme significantly improves performance and reduces time and communication overhead compared to competing schemes in terms of replication factor and partitioning time, two key indicators for measuring the performance of flow graph partitioning.

[0195] It should be understood that although Figure 2-10 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-10 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0196] In one embodiment, Fig.16 As shown, a graph partitioning device 1600 is provided, which is applied to a target computing node of a graph partitioning system. The graph partitioning system includes multiple computing nodes, and the target computing node is any one of the multiple computing nodes, including: an acquisition module 1601 and a partitioning module 1602, wherein:

[0197] An acquisition module 1601 is used to acquire a target edge set, where the target edge set is any one of multiple edge sets obtained after the original graph data set is initially divided, and the target edge set includes multiple edges;

[0198] Partitioning module 1602 is used to read each edge in the target edge set in turn. For each edge read, based on the vertices included in the edge and the storage status information of each computing node, a candidate computing node corresponding to the edge is determined from each computing node to trigger the candidate computing node to store the edge and update the storage status information of the candidate computing node; wherein the storage status information is used to indicate the edges that the computing node has stored.

[0199] In one embodiment, the partitioning module 1602 is specifically configured to:

[0200] Determine vertex information corresponding to the vertices included in the edge according to the vertices included in the edge and the storage status information of each computing node, where the vertex information is used to indicate the distribution status of the vertices included in the edge in each computing node;

[0201] A candidate computing node corresponding to the edge is determined from each computing node according to vertex information corresponding to the vertices included in the edge.

[0202] In one embodiment, the partitioning module 1602 is specifically configured to:

[0203] If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in different computing nodes respectively, the edge is cached in the local cache queue of the target computing node;

[0204] According to the edges stored in the local cache queue of each computing node, the candidate computing nodes corresponding to the edges stored in the local cache queue of the target computing node are determined.

[0205] In one of the embodiments, the partitioning module 1602 is specifically used to: read a target edge from the local cache queue, where the target edge is any one of the edges cached in the local cache queue;

[0206] Obtain information about edges that share vertices with the target edge from local cache queues of other computing nodes except the target computing node;

[0207] According to the vertices included in the target edge, the storage status information of each computing node, and the information of the edge sharing the same vertex with the target edge, a candidate computing node corresponding to the target edge is determined from each computing node.

[0208] In one embodiment, the partitioning module 1602 is specifically used to: generate a vertex request according to two vertices included in the target edge, and send the vertex request to other computing nodes, where the vertex request is used to instruct the other computing nodes to send information of edges that share vertices with the target edge in the local cache queues of the other computing nodes to the target computing node;

[0209] Receive information about edges in local cache queues of other computing nodes that share vertices with the target edge and are sent by other computing nodes.

[0210] In one embodiment, the partitioning module 1602 is specifically used to: count the number of edges that share a vertex with a first vertex of the target edge among the edges stored by each computing node according to the vertices included in the target edge, the storage status information of each computing node, and the information of the edges that share a vertex with the target edge, to obtain a first number; count the number of edges that share a vertex with a second vertex of the target edge among the edges stored by each computing node, to obtain a second number;

[0211] Determine candidate computing nodes corresponding to the target edge from among the computing nodes according to the first number and the second number.

[0212] In one embodiment, the partitioning module 1602 is specifically used to: determine the computing nodes corresponding to the maximum number according to the first number and the second number;

[0213] The candidate computing node corresponding to the target edge is determined from the computing nodes corresponding to the maximum number based on a preset strategy.

[0214] In one of the embodiments, the partitioning module 1602 is specifically used to: detect whether any one of the two vertices included in the edge is locked by other computing nodes except the target computing node;

[0215] If it is locked by other computing nodes, continue to check whether any of the two vertices included in the edge is locked by other computing nodes except the target computing node, until both vertices included in the edge are not locked by other computing nodes;

[0216] If it is not locked by other computing nodes, the two vertices included in the edge are marked as locked in the shared list maintained by the graph partitioning system, and the candidate computing node corresponding to the edge is determined from each computing node based on the vertices included in the edge and the storage status information of each computing node.

[0217] In one embodiment, the partitioning module 1602 is specifically used to: if the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in the same computing node at the same time, then determine the candidate computing node corresponding to the edge based on a preset strategy from the computing nodes where the two vertices included in the edge appear at the same time.

[0218] In one embodiment, the partitioning module 1602 is specifically used to: if the vertex information corresponding to the vertices included in the edge indicates that one and only one of the two vertices included in the edge appears in the computing node, then determine the candidate computing node corresponding to the edge based on a preset strategy from the computing nodes where one of the two vertices included in the edge appears.

[0219] In one embodiment, the partitioning module 1602 is specifically used to: if the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge do not appear in each computing node, determine the candidate computing node corresponding to the edge from each computing node based on a preset strategy.

[0220] In one of the embodiments, the preset strategy is to select the computing node with the smallest load.

[0221] For the specific definition of the graph partitioning device, please refer to the definition of the graph partitioning method above, which will not be repeated here. Each module in the above-mentioned graph partitioning device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0222] In one embodiment, a computer device is provided, the internal structure diagram of which can be as follows: Fig.17As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store edges. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a graph partitioning method is implemented.

[0223] Those skilled in the art will understand that Fig.17 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0224] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0225] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0226] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0227] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0228] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A graph partitioning method, characterized in that: Applied in a target computing node of a graph partitioning system, the graph partitioning system includes a plurality of computing nodes, the target computing node is any one of the plurality of computing nodes, the method includes: Obtain a target edge set, where the target edge set is any one of a plurality of edge sets obtained after initial partitioning of the original graph data set, and the target edge set includes a plurality of edges; Read each edge in the target edge set in sequence, and for each edge read, detect whether any one of the two vertices included in the edge is locked by other computing nodes except the target computing node; if locked by the other computing node, continue to detect whether any one of the two vertices included in the edge is locked by other computing nodes except the target computing node, until both vertices included in the edge are not locked by the other computing nodes; if not locked by the other computing nodes, mark the two vertices included in the edge as being in a locked state in the shared list maintained by the graph partitioning system, and obtain storage status information of each computing node included in the graph partitioning system from the shared list; determine a candidate computing node corresponding to the edge from each computing node according to the vertices included in the edge and the storage status information of each computing node, so as to trigger the candidate computing node to store the edge, and update the storage status information of the candidate computing node in the shared list maintained by the graph partitioning system; The storage status information is used to indicate the edges that have been stored by the computing node.

2. The method according to claim 1, characterized in that The determining, from each of the computing nodes, a candidate computing node corresponding to the edge according to the vertices included in the edge and the storage status information of each of the computing nodes, comprises: Determine, according to the vertices included in the edge and the storage status information of each of the computing nodes, vertex information corresponding to the vertices included in the edge, wherein the vertex information is used to indicate the distribution status of the vertices included in the edge in each of the computing nodes; A candidate computing node corresponding to the edge is determined from each of the computing nodes according to vertex information corresponding to the vertices included in the edge.

3. The method according to claim 2, characterized in that The determining, from each of the computing nodes, a candidate computing node corresponding to the edge according to vertex information corresponding to the vertices included in the edge, comprises: If the vertex information corresponding to the vertices included in the edge indicates that two vertices included in the edge appear in different computing nodes respectively, the edge is cached in the local cache queue of the target computing node; According to the edges stored in the local cache queue of each computing node, a candidate computing node corresponding to each edge stored in the local cache queue of the target computing node is determined.

4. The method according to claim 3, characterized in that The step of determining, according to the edges stored in the local cache queue of each computing node, candidate computing nodes corresponding to each edge stored in the local cache queue of the target computing node comprises: Reading a target edge from the local cache queue, the target edge being any one of the edges cached in the local cache queue; Acquire information of edges having the same vertices as the target edge from local cache queues of other computing nodes except the target computing node; According to the vertices included in the target edge, the storage status information of each of the computing nodes, and the information of the edge sharing the same vertex with the target edge, a candidate computing node corresponding to the target edge is determined from each of the computing nodes.

5. The method according to claim 4, characterized in that The acquiring information of edges having common vertices with the target edge from local cache queues of other computing nodes except the target computing node includes: Generate a vertex request according to the two vertices included in the target edge, and send the vertex request to the other computing node, wherein the vertex request is used to instruct the other computing node to send information of the edge that shares the same vertex with the target edge in the local cache queue of the other computing node to the target computing node; Receive information of edges in the local cache queue of the other computing node that share a vertex with the target edge and that are sent by the other computing node.

6. The method according to claim 4, characterized in that The determining, from each of the computing nodes, a candidate computing node corresponding to the target edge according to the vertices included in the target edge, the storage state information of each of the computing nodes, and the information of the edge having the same vertex as the target edge, comprises: According to the vertices included in the target edge, the storage status information of each of the computing nodes, and the information of the edge that shares a vertex with the target edge, the number of edges that share a vertex with the first vertex of the target edge among the edges stored by each of the computing nodes is counted to obtain a first number; the number of edges that share a vertex with the second vertex of the target edge among the edges stored by each of the computing nodes is counted to obtain a second number; Determine a candidate computing node corresponding to the target edge from each of the computing nodes according to the first number and the second number.

7. The method according to claim 6, characterized in that The determining, from each of the computing nodes, a candidate computing node corresponding to the target edge according to the first number and the second number includes: Determine a maximum number of computing nodes corresponding to the first number and the second number; Determine a candidate computing node corresponding to the target edge from the computing nodes corresponding to the maximum number based on a preset strategy.

8. The method according to claim 2, characterized in that: The determining, from each of the computing nodes, a candidate computing node corresponding to the edge according to vertex information corresponding to the vertices included in the edge, comprises: If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge appear in the same computing node at the same time, then the candidate computing node corresponding to the edge is determined based on a preset strategy from the computing nodes where the two vertices included in the edge appear at the same time.

9. The method according to claim 2, characterized in that: The determining, from each of the computing nodes, a candidate computing node corresponding to the edge according to vertex information corresponding to the vertices included in the edge, comprises: If the vertex information corresponding to the vertices included in the edge indicates that one and only one of the two vertices included in the edge appears in the computing node, the candidate computing node corresponding to the edge is determined based on a preset strategy from the computing nodes where one of the two vertices included in the edge appears.

10. The method according to claim 2, characterized in that The determining, from each of the computing nodes according to vertex information corresponding to the vertices included in the edge, a candidate computing node corresponding to the edge comprises: If the vertex information corresponding to the vertices included in the edge indicates that the two vertices included in the edge do not appear in each of the computing nodes, a candidate computing node corresponding to the edge is determined from each of the computing nodes based on a preset strategy.

11. The method according to any one of claims 7 to 10, characterized in that: The preset strategy is to select the computing node with the smallest load.

12. A graph partitioning device, characterized in that: Applied in a target computing node of a graph partitioning system, the graph partitioning system includes a plurality of computing nodes, the target computing node is any one of the plurality of computing nodes, the device includes: An acquisition module, configured to acquire a target edge set, wherein the target edge set is any one of a plurality of edge sets obtained after initial partitioning of the original graph data set, and the target edge set includes a plurality of edges; A partitioning module is used to read each edge in the target edge set in sequence, and for each edge read, detect whether any one of the two vertices included in the edge is locked by other computing nodes except the target computing node; if locked by the other computing node, continue to detect whether any one of the two vertices included in the edge is locked by other computing nodes except the target computing node, until both vertices included in the edge are not locked by the other computing nodes; if not locked by the other computing nodes, mark the two vertices included in the edge as being in a locked state in a shared list maintained by the graph partitioning system, and obtain storage status information of each computing node included in the graph partitioning system from the shared list; determine a candidate computing node corresponding to the edge from each computing node according to the vertices included in the edge and the storage status information of each computing node, so as to trigger the candidate computing node to store the edge, and update the storage status information of the candidate computing node in the shared list maintained by the graph partitioning system; wherein the storage status information is used to indicate each edge that the computing node has stored.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.