A task execution method, device, storage medium and electronic device

By determining the state of the starting vertex and the target vertex of the edge to be changed in the directed graph, and only the affected vertex state is updated, the redundant calculation problem when the directed graph structure changes is solved, and the computing efficiency and resource utilization are improved.

CN116339952BActive Publication Date: 2025-08-05ZHEJIANG LAB +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310328140.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2025-08-05
Estimated Expiration
2043-03-27

AI Technical Summary

Technical Problem

In the prior art, when the directed graph structure changes, the state value of each vertex needs to be recalculated, resulting in redundant calculations and discarded many vertex states that are still valid in the changed directed graph.

Method used

By obtaining the state of the starting vertex and the target vertex of the edge to be changed in the original directed graph, determine the changed state, and only the affected vertices are state updated. The unaffected vertices remain in the original state, reducing redundant calculations.

Benefits of technology

Reduces redundant calculation of vertex state after directed graph adjustment, improves computing efficiency, and reduces the consumption of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339952B_ABST
    Figure CN116339952B_ABST
Patent Text Reader

Abstract

This specification discloses a task execution method, apparatus, storage medium, and electronic device. The embodiments of this specification determine the changed state of the target vertex after the original directed graph is adjusted by the edge to be changed based on at least one of the states of the starting vertex of the edge to be changed involved in the original directed graph and the state of the neighboring vertices connected to the incoming edge of the target vertex affected by the edge to be changed, and execute the target task based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed. In this method, after the directed graph is adjusted, there is no need to recalculate the states of all vertices in the adjusted directed graph. Instead, based on the states of at least some of the vertices in the original directed graph, only the states of the vertices affected by the inserted or deleted edges are recalculated, and the states of the unaffected vertices do not need to be recalculated, thereby reducing redundant calculations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of dynamic graph processing technology, and in particular to a task execution method, device, storage medium, and electronic device. Background Art

[0002] With the advent of the big data era, graphs, as a data structure that can effectively express data relationships, have been widely used in many fields, including Internet applications, commercial finance, and scientific computing. For example, they can be used in product recommendations, route prediction, financial risk detection, social network analysis, and other application scenarios.

[0003] When applying directed graphs to different application scenarios, the structure of the directed graph changes over time, such as by adding or removing edges and vertices. The state values of vertices in the directed graph also change with this structural change, meaning that the vertex state values calculated before the change are invalid in the changed directed graph. A common solution is to discard all previously calculated vertex state values and recalculate the state values of each vertex in the changed directed graph from scratch.

[0004] However, the changes in vertices and edges involved in the process of changing from the directed graph before the change to the directed graph after the change are usually relatively small. Discarding the state values of all vertices calculated previously means discarding many vertex states that are still valid in the directed graph after the change, which will result in redundant calculations in the process of recalculating the state value of each vertex in the directed graph after the change. Summary of the Invention

[0005] The embodiments of this specification provide a task execution method, device, storage medium, and electronic device to partially solve the problems existing in the above-mentioned prior art.

[0006] The embodiments of this specification adopt the following technical solutions:

[0007] This manual provides a task execution method, including:

[0008] Obtain an original directed graph, determine the state of each vertex in the original directed graph, and determine the edges between the vertices in the original directed graph that need to be changed as edges to be changed, wherein for each vertex included in the original directed graph, the vertex is connected to a neighboring vertex through an incoming edge or an outgoing edge, the incoming edge of the vertex is an edge starting from the neighboring vertex and pointing to the vertex, and the outgoing edge of the vertex is an edge starting from the vertex and pointing to the neighboring vertex;

[0009] Based on the direction of the edge to be changed, searching the original directed graph for a vertex affected by the edge to be changed as a target vertex;

[0010] Determining, based on at least one of a state of a starting vertex of the edge to be changed and states of neighbor vertices to which the target vertex is connected through an incoming edge, a changed state of the target vertex after the original directed graph is adjusted through the edge to be changed;

[0011] After receiving the target task request, the target task is executed based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed.

[0012] Optionally, after obtaining the original directed graph, the method further includes:

[0013] Determine the size of the cache and the amount of memory required to store the state of a vertex;

[0014] Determining the number of vertices that can be stored in the cache area based on the size of the cache area and the storage space;

[0015] Sort the vertices in the original directed graph by degree from large to small to obtain a vertex sequence;

[0016] The number of vertices is determined from the vertex sequence in descending order of degree, and the states of the determined vertices are stored in the cache area.

[0017] Optionally, the edges to be changed include edges to be inserted and / or edges to be deleted.

[0018] Optionally, determining the changed state of the target vertex after adjusting the original directed graph through the edge to be changed based on at least one of the state of the starting vertex of the edge to be changed and the state of a neighbor vertex to which the target vertex is connected through an incoming edge specifically includes:

[0019] Determining a starting vertex of the edge to be changed based on the direction of the edge to be changed;

[0020] Based on the state of the starting vertex, determining a state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex in the original directed graph as a first state change amount;

[0021] Find other vertices affected by each outgoing edge of the starting vertex in the original directed graph;

[0022] offsetting the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offsetted state of the other vertices;

[0023] Adjusting the original directed graph based on the edge to be changed to obtain an adjusted directed graph;

[0024] Determining, according to the state of the starting vertex in the adjusted directed graph, an amount of state change that the starting vertex in the adjusted directed graph needs to transmit through an outgoing edge of the starting vertex as a second amount of state change;

[0025] Based on the second state change amount, the offset state of the target vertex in the adjusted directed graph is updated to obtain the changed state of the target vertex.

[0026] Optionally, offsetting the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offsetted state of the other vertices specifically includes:

[0027] Determine, based on the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex, the negative increment required to be transmitted by each outgoing edge of the starting vertex;

[0028] The negative increment is used as a transfer parameter and is transferred along each outgoing edge of the starting vertex to offset the state amount increased when the starting vertex transfers the first state change amount from the states of the other vertices to obtain a state after offset.

[0029] Optionally, determining the changed state of the target vertex after adjusting the original directed graph through the edge to be changed based on at least one of the state of the starting vertex of the edge to be changed and the state of a neighbor vertex to which the target vertex is connected through an incoming edge specifically includes:

[0030] Adjusting the original directed graph based on the edge to be changed to obtain an adjusted directed graph;

[0031] If the edge to be changed is an edge to be inserted, determining an estimated state of a destination vertex of the edge to be changed in the adjusted directed graph based on the state of the starting vertex of the edge to be changed and the weight of the edge to be changed, where the destination vertex refers to the vertex to which the edge to be changed points from the starting vertex, and the destination vertex is one of the target vertices;

[0032] If the predicted state is less than the state of the destination vertex of the edge to be changed in the original directed graph, determining the predicted state as the state of the destination vertex in the adjusted directed graph, and based on the predicted state of the destination vertex, updating the states of other target vertices in the target vertices in the adjusted directed graph except the destination vertex to obtain a changed state;

[0033] If the expected state is not less than the state of the destination vertex of the edge to be changed in the original directed graph, the state of the destination vertex in the original directed graph is maintained and there is no need to update the states of other target vertices in the adjusted directed graph except the destination vertex.

[0034] Optionally, determining the changed state of the target vertex after adjusting the original directed graph through the edge to be changed based on at least one of the state of the starting vertex of the edge to be changed and the state of a neighbor vertex to which the target vertex is connected through an incoming edge specifically includes:

[0035] Adjusting the original directed graph based on the edge to be changed to obtain an adjusted directed graph;

[0036] If the edge to be changed is an edge to be deleted, initializing the state of the target vertex in the adjusted directed graph to obtain an initial state;

[0037] For each neighbor vertex connected to the target vertex through an incoming edge, based on the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex, determine the state amount contributed by the neighbor vertex to the target vertex as the state amount corresponding to the neighbor vertex;

[0038] The minimum state quantity is selected from the state quantities corresponding to each neighbor vertex as the changed state of the target vertex in the adjusted directed graph.

[0039] This specification provides a task execution device, including:

[0040] an acquisition module, configured to acquire an original directed graph, determine the state of each vertex in the original directed graph, and determine edges between vertices in the original directed graph that need to be changed as edges to be changed, wherein for each vertex included in the original directed graph, the vertex is connected to a neighboring vertex through an incoming edge or an outgoing edge, an incoming edge of the vertex is an edge starting from the neighboring vertex and pointing to the vertex, and an outgoing edge of the vertex is an edge starting from the vertex and pointing to the neighboring vertex;

[0041] A search module, configured to search, based on the direction of the edge to be changed, for a vertex affected by the edge to be changed from the original directed graph as a target vertex;

[0042] a determination module, configured to determine, based on at least one of a state of a starting vertex of the edge to be changed and a state of a neighboring vertex to which the target vertex is connected via an incoming edge, a changed state of the target vertex after the original directed graph is adjusted via the edge to be changed;

[0043] The task execution module is used to execute the target task after receiving the target task request based on the changed state of the target vertex and the state of the vertices in the original directed graph that are not affected by the edge to be changed.

[0044] Optionally, the acquisition module is also used to determine the size of the cache area and the storage space required to store the state of a vertex; based on the size of the cache area and the storage space, determine the number of vertices that the cache area can store; sort the vertices in the original directed graph from large to small according to degree to obtain a vertex sequence; determine the number of vertices from the vertex sequence in order of degree from large to small, and save the states of the determined vertices in the cache area.

[0045] Optionally, the determination module is specifically used to determine the starting vertex of the edge to be changed based on the direction of the edge to be changed; determine the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex in the original directed graph based on the state of the starting vertex as the first state change amount; find out other vertices affected by each outgoing edge of the starting vertex in the original directed graph; offset the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offset state of the other vertices; adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; determine the state change amount that the starting vertex in the adjusted directed graph needs to transmit through the outgoing edge of the starting vertex in the adjusted directed graph as the second state change amount according to the state of the starting vertex in the adjusted directed graph; update the offset state of the target vertex in the adjusted directed graph based on the second state change amount to obtain the changed state of the target vertex.

[0046] Optionally, the determination module is specifically used to determine the negative increment that needs to be transmitted through each outgoing edge of the starting vertex based on the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex; using the negative increment as a transmission parameter, it is transmitted along each outgoing edge of the starting vertex to offset the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offset state.

[0047] Optionally, the determination module is specifically used to adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; if the edge to be changed is an edge to be inserted, based on the state of the starting vertex of the edge to be changed and the weight of the edge to be changed, determine the expected state of the destination vertex of the edge to be changed in the adjusted directed graph, the destination vertex refers to the vertex to which the edge to be changed points from the starting vertex, and the destination vertex is one of the target vertices; if the expected state is less than the state of the destination vertex of the edge to be changed in the original directed graph, then the expected state is determined as the state of the destination vertex in the adjusted directed graph, and based on the expected state of the destination vertex, the states of other target vertices in the target vertices in the adjusted directed graph except the destination vertex are updated to obtain a changed state; if the expected state is not less than the state of the destination vertex of the edge to be changed in the original directed graph, then the state of the destination vertex in the original directed graph is maintained and there is no need to update the states of other target vertices in the adjusted directed graph except the destination vertex.

[0048] Optionally, the determination module is specifically used to adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; if the edge to be changed is an edge to be deleted, the state of the target vertex in the adjusted directed graph is initialized to obtain an initial state; for each neighbor vertex connected to the target vertex through an incoming edge, based on the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex, the state quantity contributed by the neighbor vertex to the target vertex is determined as the state quantity corresponding to the neighbor vertex; the minimum state quantity is selected from the state quantities corresponding to each neighbor vertex as the changed state of the target vertex in the adjusted directed graph.

[0049] Optionally, the edges to be changed include edges to be inserted and / or edges to be deleted.

[0050] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned task execution method is implemented.

[0051] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the above-mentioned task execution method is implemented.

[0052] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:

[0053] In the embodiments of this specification, the changed state of the target vertex after the original directed graph is adjusted by the edge to be changed is determined based on the state of the starting vertex of the edge to be changed involved in the original directed graph and at least one of the states of the neighbor vertices connected to the incoming edge of the target vertex affected by the edge to be changed, and the target task is performed based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed. In this method, after the directed graph is adjusted, there is no need to recalculate the states of all vertices in the adjusted directed graph. Instead, based on the states of at least some of the vertices in the original directed graph, only the states of the vertices affected by the inserted or deleted edges are recalculated, and the states of the unaffected vertices do not need to be recalculated, thereby reducing redundant calculations. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The exemplary embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation of this specification. In the drawings:

[0055] Figure 1 A flowchart of a task execution method provided in an embodiment of this specification;

[0056] Figure 2 A schematic diagram of the location of the image processing unit provided in the embodiments of this specification;

[0057] Figure 3 A schematic diagram of the structure of a graph processing unit provided in an embodiment of this specification;

[0058] Figure 4 A schematic diagram of finding a target vertex in an original directed graph provided in an embodiment of this specification;

[0059] Figure 5 A schematic diagram comparing the original directed graph and the adjusted directed graph provided in the embodiments of this specification;

[0060] Figure 6 A schematic diagram comparing the original directed graph before inserting an edge and the adjusted directed graph after inserting the edge provided in the embodiments of this specification;

[0061] Figure 7 A schematic diagram comparing the original directed graph before deleting edges and the adjusted directed graph after deleting edges provided in an embodiment of this specification;

[0062] Figure 8 A schematic diagram of the structure of a task execution device provided in an embodiment of this specification;

[0063] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0064] The task execution method provided in this specification is intended to recalculate the state of each vertex in the last directed graph after local adjustment of the last directed graph, based on the state of the vertices affected by the adjusted edge. The state of the vertices not affected by the adjusted edge does not need to be recalculated and can remain unchanged.

[0065] To make the objectives, technical solutions, and advantages of this specification more clear, the following will clearly and completely describe the technical solutions of this specification in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this specification.

[0066] The technical solutions provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0067] Figure 1 This is a flowchart of a task execution method provided in an embodiment of this specification. The task execution method can be applied to a server, including:

[0068] S100: Obtain an original directed graph, determine the state of each vertex in the original directed graph, and determine the edges that need to be changed between the vertices in the original directed graph as edges to be changed, wherein for each vertex included in the original directed graph, the vertex is connected to a neighbor vertex through an incoming edge or an outgoing edge, the incoming edge of the vertex is an edge starting from the neighboring vertex and pointing to the vertex, and the outgoing edge of the vertex is an edge starting from the vertex and pointing to the neighboring vertex.

[0069] In the embodiments of this specification, Figure 1 The iterative update method for the state of each vertex in the directed graph in the task execution method can be applied to the graph processing unit in the server, and the graph processing unit is parallel to the L1 cache area, such as Figure 2 As shown. Figure 2 In the example, the graph processing unit is located in the upper layer of the L2 cache area, and the graph processing unit interacts with the L2 cache area for data, and the interacted data may refer to the state of the vertex.

[0070] The graph processing unit includes: a reader, a register, a state change generator, a state change processor, and a state change queue. Figure 3 As shown. Figure 3In the example, the reader is used to read the original directed graph, the state of each vertex in the original directed graph, and the edges to be changed from the memory. The temporary register is used to store the vertex identifiers of the initialized vertices, such as the vertex IDs. The state change generator is used to generate the state change transmitted to each vertex in the adjusted directed graph after the original directed graph is adjusted through the edges to be changed based on the original directed graph, the state of each vertex in the original directed graph, and the edges to be changed. The state change queue is used to store state changes. The state change processor is used to transmit state changes in the original directed graph or the adjusted directed graph, and iteratively update the state of each vertex and the state change required to be transmitted for each vertex during the transmission process.

[0071] In an embodiment of the present specification, a reader can be used to obtain the original directed graph, the state of each vertex in the original directed graph, and the edges between the vertices in the original directed graph that need to be changed from the memory. The edges between the vertices in the original directed graph that need to be changed can refer to adding an edge between any two vertices or deleting an edge between any two vertices. In other words, the edges to be changed may include: edges to be inserted and / or edges to be deleted.

[0072] For a directed graph, a directed graph is composed of directed edges and vertices, and edges can include outgoing and incoming edges. In this specification, for each vertex included in the original directed graph, the vertex is connected to a neighbor vertex through an incoming edge or an outgoing edge. The incoming edge of the vertex is the edge that starts from the neighbor vertex and points to the vertex as the destination vertex. The outgoing edge of the vertex is the edge that starts from the vertex and points to the neighbor vertex as the destination vertex.

[0073] The representation of each vertex, the representation of the edges between vertices, and the vertex status vary depending on the application scenario of a directed graph. For example, in a product recommendation scenario, vertices in a directed graph can represent users, products, etc., and the edges between vertices can be used to represent the interaction between users and products (such as browsing, clicking, etc.). In this scenario, the vertex status can refer to the user's user feature value or the product information feature value of a product. In a path prediction scenario, vertices in a directed graph can represent points of interest (POIs), the edges between vertices can represent the paths between POIs, and the vertex status can represent the shortest path length. In a financial risk detection scenario, vertices can represent user information, the edges between vertices can represent the connections between users, and the vertex status can represent the user's fraud probability. User information can include mobile phone numbers, email addresses, etc. If multiple users have the same mobile phone number, email address, etc., the fraud probability of these users is higher. In a social network analysis scenario, vertices can represent user information (such as social accounts), the edges between vertices can represent the connections between users, and the vertex status can represent the user's importance. The greater the importance of a user, the stronger the user's social ability.

[0074] After obtaining the original directed graph, the vertices with higher degrees can be determined according to the number of edges of each vertex in the original directed graph, and the states of the vertices with higher degrees can be stored in a cache area to reduce memory access overhead.

[0075] Specifically, the size of the cache and the storage space required to store the state of a vertex can be determined first. Then, based on the size of the cache and the storage space required to store the state of a vertex, the number of vertices that can be stored in the cache can be determined. At the same time, the vertices in the original directed graph are sorted from large to small according to degree to obtain a vertex sequence. The degree can refer to the total number of edges connected to the vertex. Thereafter, the vertices of the vertex sequence can be determined in descending order of degree, and the states of the determined vertices can be stored in the cache.

[0076] When the state of the vertex in the cache needs to be changed, the state of the vertex can be read from the cache without reading the state of the vertex from the memory, thereby reducing memory access overhead.

[0077] S102: Based on the direction of the edge to be changed, find a vertex affected by the edge to be changed from the original directed graph and use it as a target vertex.

[0078] In the embodiments of this specification, when adjusting the original directed graph based on the edge to be changed, only the vertices affected by the edge to be changed can be determined, and then only the states of the vertices affected by the edge to be changed can be updated. The states of the vertices not affected by the edge to be changed can be kept unchanged, without having to update the states of the vertices not affected by the edge to be changed, thereby reducing the amount of computation.

[0079] After the reader obtains the original directed graph, the state of each vertex in the original directed graph, and the edge to be changed, it can send the original directed graph, the state of each vertex in the original directed graph, and the edge to be changed to the state change generator. The state change generator can find the vertex affected by the edge to be changed from the original directed graph based on the direction of the edge to be changed, the starting vertex of the edge to be changed, the destination vertex of the edge to be changed, and the original directed graph, and use it as the target vertex. Figure 4 As shown in the figure, there can be one or more target vertices. The target vertices affected by the edge to be changed can refer to vertices that can be reached by parameter transfer along the direction of the edge between the vertices of the original directed graph. The parameter transferred between any two vertices can be the state change that one vertex needs to pass to the other vertex. Due to different vertex state update algorithms, the state change amount is also different. For example, the state change amount can refer to the change in the state value of a vertex, or it can refer to the sum of the state value of a vertex and the weight of the edge.

[0080] exist Figure 4 In the original directed graph, there are four vertices: a, b, c, and d. For example, if the edge to be changed is the edge to be deleted, and the edge b→c is used as the edge to be changed (indicated by the dotted line), the target vertices affected by the edge to be changed are c, d, and b.

[0081] S104: Determine the changed state of the target vertex after the original directed graph is adjusted through the edge to be changed, based on at least one of the state of the starting vertex of the edge to be changed and the state of the neighboring vertices to which the target vertex is connected through the incoming edge.

[0082] In an embodiment of the present specification, after determining the target vertex affected by the edge to be changed, a state change amount generator can be used to generate the state change amount required to update the target vertex. Based on the generated state change amount, the state of the target vertex in the original directed graph is updated to obtain the changed state of the target vertex in the adjusted directed graph obtained by adjusting the original directed graph through the edge to be changed. The state change amount required to update any vertex can refer to the state change amount required to be transmitted by any vertex.

[0083] Specifically, through the state change generator, the state change required to update the target vertex in the adjusted directed graph is generated according to the state of the starting vertex of the edge to be changed and at least one of the states of the neighbor vertices connected to the target vertex through the incoming edge, and based on the state change required to update the target vertex, the changed state of the target vertex in the adjusted directed graph is determined.

[0084] Furthermore, after generating the state change amount required to update the target vertex in the adjusted directed graph, the generated state change amount required to update the target vertex can be added to a state change amount queue. Then, a state change amount processor obtains the state change amount required to update the target vertex from the state change amount queue, and then determines the changed state of the target vertex in the adjusted directed graph based on the state change amount required to update the target vertex.

[0085] In the process of iteratively updating the states of vertices in the original directed graph, different state update algorithms are used, resulting in different methods for generating the state change required to update the target vertex. In this specification, state update algorithms can be divided into two categories: the first category is cumulative update algorithms, and the second category is selective update algorithms. Cumulative update algorithms can include: PageRank algorithm, etc., and selective update algorithms can include: single-source shortest path algorithm, etc.

[0086] Cumulative update algorithm for the first category:

[0087] First, let's introduce the algorithm principle of the cumulative update algorithm: in the initialization stage of the directed graph, the state value of each vertex in the directed graph is 0, and each vertex corresponds to an initialized total state change. The total state change can refer to the change in the state value. For a certain vertex, the method for updating the state of the vertex is: add the total state change corresponding to the vertex to the state value of the vertex to obtain a new state value. The method for transmitting the total state change corresponding to the vertex is: first determine the state change of each outgoing edge of the vertex to the destination vertex based on the total state change corresponding to the vertex, the number of outgoing edges of the vertex pair, and preset parameters. For a certain destination vertex, the destination vertex adds the received state change to the total state change corresponding to the destination vertex, and uses the result of the addition as the total state change corresponding to the destination vertex. Among them, the formula for calculating the state change transmitted by each outgoing edge is: D is the total state change corresponding to the vertex, N is the number of outgoing edges of the vertex, and θ is a preset parameter. Under this algorithm principle, for each vertex, the state value of the vertex is the accumulation of the state change of other vertices and its own state change.

[0088] In the case of the cumulative update algorithm, the principle for calculating the changed state of the target vertex after adjusting the original directed graph based on the edge to be changed is as follows: first, based on the original directed graph, assume that all outgoing edges of the starting vertex of the edge to be changed are deleted, and a corresponding negative increment is generated for each outgoing edge. The negative increment is used to offset the state change contributed by the starting vertex to the neighboring vertices connected by the outgoing edge, and the offset state of the neighboring vertices is obtained. Then, the state change contributed by the starting vertex through the outgoing edges that still exist in the adjusted directed graph or the inserted outgoing edges is recalculated. Based on the recalculated state change, the offset state of the neighboring vertices is updated to obtain the changed state.

[0089] Specifically, the amount of state change transmitted by the target vertex in the original directed graph and the amount of state change required to update the target vertex in the adjusted directed graph can be determined based on the state of the starting vertex of the edge to be changed and at least one of the states of the neighbor vertices to which the target vertex is connected through the incoming edge. Then, based on the amount of state change transmitted by the target vertex in the original directed graph and the amount of state change required to update the target vertex in the adjusted directed graph, the changed state of the target vertex in the adjusted directed graph can be determined. In the cumulative update algorithm, there is no need to distinguish whether the edge to be changed is an edge to be inserted or an edge to be deleted.

[0090] When determining the state change amount transmitted by the target vertex in the original directed graph, the starting vertex of the side to be changed can be determined based on the direction of the side to be changed. Then, based on the state of the starting vertex of the side to be changed in the original directed graph, the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex in the original directed graph is determined as the first state change amount. Afterwards, other vertices affected by each outgoing edge of the starting vertex are found in the original directed graph. The state amount increased in the process of the starting vertex transmitting the first state change amount is offset from the states of the other vertices to obtain the offsetted states of the other vertices. It should be noted that the other vertices affected by each outgoing edge of the starting vertex include the target vertex affected by the side to be changed and the neighbor vertices connected by the incoming edges to at least some of the target vertices.

[0091] The method for determining the state change amount transmitted by each edge of the starting vertex is: based on the state of the starting vertex, the number of outgoing edges of the starting vertex, and preset parameters, determine the state change amount transmitted by each outgoing edge of the starting vertex. The formula for calculating the state change amount transmitted by each edge of the starting vertex is: V is the state value of the starting vertex, N is the number of outgoing edges of the starting vertex, and θ is a preset parameter.

[0092] The method for offsetting the state quantity increased during the process of transmitting the first state change from the state of other vertices may include: after determining the first state change transmitted by each outgoing edge, the negative increment required to be transmitted by each outgoing edge passing through the starting vertex may be determined based on the state change transmitted by each outgoing edge passing through the starting vertex. The negative increment may refer to the negative value of the first state change. Using the negative increment as a transmission parameter, the state quantity increased during the transmission of the first state change from the starting vertex is transmitted from other vertices to obtain the offsetted states of the other vertices.

[0093] It should be noted that the state of other vertices obtained by offsetting the increased state quantity when the starting vertex transfers the first state change quantity from other vertices is equivalent to the state of other vertices obtained by deleting all outgoing edges of the starting vertex in the original directed graph and recalculating them when the starting vertex has no contribution.

[0094] After obtaining the offset states of other vertices, the original directed graph can be adjusted based on the edges to be changed to obtain an adjusted directed graph. That is, the edges to be changed can be adjusted, such as by deleting edges and / or inserting edges.

[0095] After adjusting the original directed graph, the method for determining a state change amount required to update a target vertex in the original directed graph may include: determining, based on the state of a starting vertex in the adjusted directed graph, a state change amount required to be transmitted by the starting vertex in the adjusted directed graph via an outgoing edge of the starting vertex, as a second state change amount; and finally, updating the offset state of the target vertex in the adjusted directed graph based on the second state change amount to obtain a changed state.

[0096] Specifically, the second state change is used as a transfer parameter and is transferred along each outgoing edge of the starting vertex to update the offset state of the target vertex in the adjusted directed graph to obtain the changed state. In other words, the second state change is accumulated in the offset state of the target vertex.

[0097] It should be noted that the starting vertex in the adjusted directed graph may still have outgoing edges and / or additional outgoing edges, while the offset state of other vertices does not take into account any outgoing edges of the starting vertex. Therefore, in the adjusted directed graph, the outgoing edges that were deleted in the original directed graph need to be added back and / or additional outgoing edges need to be added.

[0098] The calculated second state change is equivalent to the state change contributed by the starting vertex through the deletion or addition of outgoing edges in the original directed graph. The changed state obtained by updating the offset state of the target vertex based on the second state change is equivalent to adding the second state change contributed by the deletion or addition of edges to the offset state of the target vertex.

[0099] Based on the description of the changed state of the calculation target vertex above, the embodiment of this specification provides a comparison diagram of the original directed graph and the adjusted directed graph, such as Figure 5 shown.

[0100] exist Figure 5 In the original directed graph, the three vertices are A, B, and C. During the initialization phase of the original directed graph, the state values of vertices A, B, and C are all zero, and the total state change corresponding to each vertex is 1. The default parameter is assumed to be 1. During the iterative update of the states of the three vertices in the original directed graph, vertex A first updates its own state, resulting in a state value of 1. The total state change corresponding to vertex A is evenly transferred to vertices B and C via its two outgoing edges, and the total state change corresponding to vertex A is deleted. Vertex C receives the state change of 0.5 sent by vertex A and adds its own total state change to obtain 1.5. Adding 1.5 to its own state value yields 1.5. Therefore, the state value of vertex C is updated to 1.5. Vertex C transfers the total state change of 1.5 to vertex B, and vertex C deletes the total state change of 1.5. Vertex B receives the 0.5 state change from vertex A and the 1.5 total state change from vertex C. It updates its own total state change to 3, and then updates its own state value with the total state change of 3, resulting in 3. Ultimately, vertex B's state value is 3. Vertex B deletes the total state change of 3.

[0101] When adjusting the original directed graph, take deleting the edge A→C as an example. The edge A→C is the edge to be changed, the starting vertex is vertex A, and the outgoing edges of vertex A in the original directed graph are A→C and A→B. Assuming that all outgoing edges of vertex A are deleted, calculate the negative increments contributed by vertex A to vertex B and vertex C in the original directed graph, that is, Pass the negative increment to vertex B and vertex C. For vertex C, the total state change corresponding to vertex C is Update its own state value to 1. Vertex C will Passed to vertex B, vertex C deleted The total state change of vertex B. Vertex B receives the state change of vertex A. State changes and vertex C transmission The total state change of vertex B itself is -1. Update its own state value with -1 to get 2. After adjusting the original directed graph, there is an edge A→B in the adjusted directed graph. It is necessary to recalculate the state change contributed by vertex A through the A→B edge, that is, The state change of 1 is passed to vertex B, which updates its own state value by 1, resulting in 2 + 1 = 3. Finally, in the adjusted directed graph, the state value of vertex A is 1, the state value of vertex B is 3, and the state value of vertex C is 1.

[0102] Selection update algorithm for the second category:

[0103] First, let's explain the principle of the selective update algorithm: In a directed graph, a source vertex is identified. For a vertex, its state value represents the shortest distance from the source vertex. When updating the vertex's state value, any distance less than the vertex's current state value can be used as the new state value.

[0104] When determining the changed state of the target vertex in the adjusted directed graph, the changed state of the target vertex in the adjusted directed graph may be determined based on the state of the starting vertex of the edge to be changed. Alternatively, the changed state of the target vertex in the adjusted directed graph may be determined based on the states of neighboring vertices connected to the target vertex via incoming edges.

[0105] The original directed graph is adjusted based on the edge to be changed to obtain an adjusted directed graph. Then, in the case where the edge to be changed is an edge to be inserted, the expected state of the destination vertex of the edge to be changed in the adjusted directed graph can be determined based on the state of the starting vertex of the edge to be changed and the weight of the edge to be changed. The destination vertex refers to the vertex to which the edge to be changed points from the starting vertex, and the destination vertex is one of the target vertices. The expected state of the destination vertex can refer to the amount of state change contributed by the starting vertex of the edge to be changed to the destination vertex.

[0106] The state of the starting vertex of the edge to be changed is added to the weight of the edge to be changed to obtain the estimated state of the destination vertex of the edge to be changed.

[0107] If the expected state is less than the state of the destination vertex of the edge to be changed in the original directed graph, the expected state is determined as the state of the destination vertex in the adjusted directed graph, and based on the expected state of the destination vertex, the states of other target vertices in the adjusted directed graph except the destination vertex are updated to obtain the changed state of each target vertex.

[0108] If the expected state is not less than the state of the destination vertex of the edge to be changed in the original directed graph, the state of the destination vertex in the original directed graph is maintained.

[0109] While maintaining the state of the destination vertex in the original directed graph, if the adjustment to the original directed graph only involves the insertion of one edge to be changed, there is no need to update the states of the destination vertices in the adjusted directed graph.

[0110] If the adjustment of the original directed graph involves the insertion of multiple edges to be changed, the states of all target vertices in the adjusted directed graph except the destination vertex can be updated based on the state of the destination vertex of one edge to be changed in the original directed graph to obtain the changed states of the other target vertices.

[0111] Based on the above method for calculating the changed state of the target vertex in the directed graph after inserting the edge, the embodiment of this specification provides a comparison diagram of the original directed graph before inserting the edge and the adjusted directed graph after inserting the edge, as shown in FIG. Figure 6 shown.

[0112] exist Figure 6 In the original directed graph, vertex 1 is the source vertex, and its state value is 0. Vertex 2 has a state value of 8, vertex 3 has a state value of 9, vertex 4 has a state value of 12, vertex 5 has a state value of 14, vertex 6 has a state value of 17, and vertex 7 has a state value of 19. Edge 1→4 is inserted into the original directed graph. The target vertices affected by edge 1→4 are vertex 4, vertex 5, vertex 6, and vertex 7. Next, the predicted state of vertex 4, the destination of edge 1→4, is calculated: 0 + 3 = 3. By comparing the predicted state 3 with vertex 4's state value of 12, vertex 4's state value can be updated to 3. Next, the states of vertices 5, 6, and 7 are updated sequentially to obtain the changed states. Ultimately, the changed state value of vertex 5 is 8, the changed state value of vertex 6 is 13, and the changed state value of vertex 7 is 10.

[0113] In the case where the edge to be changed is a deleted edge, after obtaining the adjusted directed graph, the state of the target vertex is initialized to obtain the initial state. The initial state can be a maximum value. Then, for each neighbor vertex connected to the target vertex through an incoming edge, based on the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex, the state quantity contributed by the neighbor vertex to the target vertex is determined as the state quantity corresponding to the neighbor vertex. Finally, the minimum state quantity is selected from the state quantities corresponding to each neighbor vertex as the changed state of the target vertex. The state quantity corresponding to each neighbor vertex can refer to the state change quantity contributed by the neighbor vertex to the target vertex.

[0114] After initializing the state of the target vertex, the vertex identifier of the initialized target vertex can be stored in a temporary register. When recalculating the state of the initialized target vertex, the state change generator can read the target vertex from the temporary register to reduce the time of traversing the directed graph.

[0115] Among them, when determining the state amount contributed by the neighbor vertex to the target vertex, the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex can be summed to obtain the sum result as the state amount contributed by the neighbor vertex to the target vertex.

[0116] Based on the above method for calculating the changed state of the target vertex in the directed graph after deleting the edge, the embodiment of this specification provides a comparison diagram of the original directed graph before deleting the edge and the adjusted directed graph after deleting the edge, as shown in FIG. Figure 7 shown.

[0117] exist Figure 7 In the original directed graph, vertex 1 is the source vertex, and its state value is 0. Vertex 2 has a state value of 8, vertex 3 has a state value of 9, vertex 4 has a state value of 12, vertex 5 has a state value of 14, vertex 6 has a state value of 17, and vertex 7 has a state value of 19. Edge 1→3 is deleted from the original directed graph. The target vertices affected by edge 1→3 are vertex 3, vertex 5, vertex 6, and vertex 7. The state of each target vertex is initialized to obtain the initial state. Assume that the initial state is ∞. Then, for each target vertex, the changed state is recalculated. Vertex 3 has no neighboring vertices connected by incoming edges, so its state is still ∞. Vertex 5 has neighboring vertices connected by incoming edges: vertex 2, vertex 4, vertex 7, and vertex 3. The state contribution of each neighbor vertex to vertex 5 is calculated. Vertex 2 has a state value of 16, vertex 3 has a state value of ∞, vertex 4 has a state value of 17, and vertex 7 has a state value of ∞. Therefore, the smallest state contribution from the state contributions of multiple neighboring vertices is selected as vertex 5's changed state, which is 16. Similarly, the changed state of vertex 6 is 21, and the changed state of vertex 7 is 19.

[0118] S106: After receiving the target task request, the target task is executed based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed.

[0119] In an embodiment of this specification, after determining the changed state of a target vertex in the adjusted directed graph, a target task request is received. After receiving the target task request, the target task can be executed based on the changed state of the target vertex in the adjusted directed graph and the states of vertices in the original directed graph that are not affected by the edge to be changed. Target tasks may include tasks such as product recommendations, road prediction, financial risk detection, and page recommendations.

[0120] It should be noted that the states of the vertices in the adjusted directed graph that are not affected by the edges to be changed are the same as the states of the vertices in the original directed graph that are not affected by the edges to be changed.

[0121] When the target task is road prediction, the system can search for a vertex matching the start address and destination address in the target task request sent by the user, and use it as the first matching vertex. It can also search for a vertex matching the destination address in the adjusted directed graph, and use it as the second matching vertex. Based on the status of the first matching vertex and the status of the second matching vertex, the system searches for the shortest vertex link from the first matching vertex to the second matching vertex in the adjusted directed graph. Based on the searched shortest vertex link, the system determines the shortest path that matches the shortest vertex link. The determined shortest path is then returned to the user and displayed on the user's terminal device.

[0122] When the target task is page recommendation, each vertex in the adjusted directed graph represents a page, the edges between vertices represent the reference relationships between pages, and the vertex status represents the importance of the page. Upon receiving a target task request from a user, the adjusted directed graph searches for page vertices matching the search keyword based on the search keyword carried in the target task request. The pages are then sorted according to their corresponding importance to form a page sequence. Based on this page sequence, the user is presented with pages matching the search keyword.

[0123] Through the above Figure 1 As can be seen from the method shown, this specification determines the changed state of the target vertex after the original directed graph is adjusted by the edge to be changed based on the state of the starting vertex of the edge to be changed involved in the original directed graph and at least one of the states of the neighbor vertices connected to the incoming edge of the target vertex affected by the edge to be changed, and performs the target task based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed. In this method, after the directed graph is adjusted, there is no need to recalculate the states of all vertices in the adjusted directed graph. Instead, based on the states of at least some of the vertices in the original directed graph, only the states of the vertices affected by the inserted or deleted edges are recalculated, and the states of the unaffected vertices do not need to be recalculated, thereby reducing redundant calculations.

[0124] The above is a task execution method provided in the embodiments of this specification. Based on the same idea, this specification also provides corresponding devices, storage media and electronic devices.

[0125] Figure 8 This is a schematic diagram of the structure of a task execution device provided in an embodiment of this specification, the device comprising:

[0126] An acquisition module 801 is configured to acquire an original directed graph, determine the state of each vertex in the original directed graph, and determine edges between vertices in the original directed graph that need to be changed as edges to be changed, wherein for each vertex included in the original directed graph, the vertex is connected to a neighboring vertex through an incoming edge or an outgoing edge, an incoming edge of the vertex is an edge starting from a neighboring vertex and pointing to the vertex, and an outgoing edge of the vertex is an edge starting from the vertex and pointing to the neighboring vertex;

[0127] A search module 802 is configured to search, based on the direction of the edge to be changed, for a vertex affected by the edge to be changed from the original directed graph as a target vertex;

[0128] a determination module 803 for determining, based on at least one of a state of a starting vertex of the edge to be changed and states of neighboring vertices to which the target vertex is connected via an incoming edge, a changed state of the target vertex after the original directed graph is adjusted via the edge to be changed;

[0129] The task execution module 804 is configured to execute the target task after receiving the target task request based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed.

[0130] Optionally, the acquisition module 801 is also used to determine the size of the cache area and the storage space required to store the state of a vertex; based on the size of the cache area and the storage space, determine the number of vertices that can be stored in the cache area; sort the vertices in the original directed graph from large to small according to degree to obtain a vertex sequence; determine the number of vertices from the vertex sequence in order of degree from large to small, and save the states of the determined vertices in the cache area.

[0131] Optionally, the determination module 803 is specifically used to determine the starting vertex of the edge to be changed based on the direction of the edge to be changed; based on the state of the starting vertex, determine the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex in the original directed graph as the first state change amount; find out other vertices affected by each outgoing edge of the starting vertex in the original directed graph; offset the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offset state of the other vertices; adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; according to the state of the starting vertex in the adjusted directed graph, determine the state change amount that the starting vertex in the adjusted directed graph needs to transmit through the outgoing edge of the starting vertex as the second state change amount; based on the second state change amount, update the offset state of the target vertex in the adjusted directed graph to obtain the changed state of the target vertex.

[0132] Optionally, the determination module 803 is specifically used to determine the negative increment that needs to be transmitted through each outgoing edge of the starting vertex based on the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex; using the negative increment as a transmission parameter, it is transmitted along each outgoing edge of the starting vertex to offset the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offset state.

[0133] Optionally, the determination module 803 is specifically used to adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; if the edge to be changed is an edge to be inserted, based on the state of the starting vertex of the edge to be changed and the weight of the edge to be changed, determine the expected state of the destination vertex of the edge to be changed in the adjusted directed graph, the destination vertex refers to the vertex to which the edge to be changed points from the starting vertex, and the destination vertex is one of the target vertices; if the expected state is less than the state of the destination vertex of the edge to be changed in the original directed graph, then the expected state is determined as the state of the destination vertex in the adjusted directed graph, and based on the expected state of the destination vertex, the states of other target vertices in the target vertices in the adjusted directed graph except the destination vertex are updated to obtain a changed state; if the expected state is not less than the state of the destination vertex of the edge to be changed in the original directed graph, then the state of the destination vertex in the original directed graph is maintained and there is no need to update the states of other target vertices in the adjusted directed graph except the destination vertex.

[0134] Optionally, the determination module 803 is specifically used to adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; if the edge to be changed is an edge to be deleted, the state of the target vertex in the adjusted directed graph is initialized to obtain an initial state; for each neighbor vertex connected to the target vertex through an incoming edge, based on the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex, the state quantity contributed by the neighbor vertex to the target vertex is determined as the state quantity corresponding to the neighbor vertex; the minimum state quantity is selected from the state quantities corresponding to each neighbor vertex as the changed state of the target vertex in the adjusted directed graph.

[0135] Optionally, the edges to be changed include edges to be inserted and / or edges to be deleted.

[0136] This specification also provides a computer-readable storage medium, wherein the storage medium stores a computer program, which can be used to perform the above-mentioned Figure 1 Provided task execution method.

[0137] based on Figure 1 The task execution method shown in this specification also provides Figure 9 The structural diagram of the electronic device shown in FIG. Figure 9 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The task execution method.

[0138] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0139] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0140] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.

[0141] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0142] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

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

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

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

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

[0147] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0148] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0149] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0150] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

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

[0152] This specification may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.

[0153] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.

[0154] The foregoing is merely an example of the present invention and is not intended to limit the present invention. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.

Claims

1. A task execution method, characterized in that: include: Obtain an original directed graph, determine the state of each vertex in the original directed graph, and determine the edges between the vertices in the original directed graph that need to be changed as edges to be changed, wherein for each vertex included in the original directed graph, the vertex is connected to a neighboring vertex through an incoming edge or an outgoing edge, the incoming edge of the vertex is an edge starting from the neighboring vertex and pointing to the vertex, and the outgoing edge of the vertex is an edge starting from the vertex and pointing to the neighboring vertex; Determine the size of the cache and the amount of memory required to store the state of a vertex; Determining the number of vertices that can be stored in the cache area based on the size of the cache area and the storage space; Sort the vertices in the original directed graph by degree from large to small to obtain a vertex sequence; Determining the number of vertices from the vertex sequence in descending order of degree, and storing the states of the determined vertices in the cache area; Based on the direction of the edge to be changed, searching the original directed graph for a vertex affected by the edge to be changed as a target vertex; Determining, based on at least one of a state of a starting vertex of the edge to be changed and states of neighbor vertices to which the target vertex is connected through an incoming edge, a changed state of the target vertex after the original directed graph is adjusted through the edge to be changed; After receiving the target task request, the target task is executed based on the changed state of the target vertex and the states of the vertices in the original directed graph that are not affected by the edge to be changed.

2. The method according to claim 1, wherein The edges to be changed include edges to be inserted and / or edges to be deleted.

3. The method according to claim 1, wherein Determining, based on at least one of a state of a starting vertex of the edge to be changed and a state of a neighboring vertex to which the target vertex is connected through an incoming edge, a changed state of the target vertex after adjusting the original directed graph through the edge to be changed, specifically includes: Determining a starting vertex of the edge to be changed based on the direction of the edge to be changed; Based on the state of the starting vertex, determining a state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex in the original directed graph as a first state change amount; Find other vertices affected by each outgoing edge of the starting vertex in the original directed graph; offsetting the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offsetted state of the other vertices; Adjusting the original directed graph based on the edge to be changed to obtain an adjusted directed graph; Determining, according to the state of the starting vertex in the adjusted directed graph, an amount of state change that the starting vertex in the adjusted directed graph needs to transmit through an outgoing edge of the starting vertex as a second amount of state change; Based on the second state change amount, the offset state of the target vertex in the adjusted directed graph is updated to obtain the changed state of the target vertex.

4. The method according to claim 3, wherein Offsetting the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offsetted state of the other vertices specifically includes: Determine, based on the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex, the negative increment required to be transmitted by each outgoing edge of the starting vertex; The negative increment is used as a transfer parameter and is transferred along each outgoing edge of the starting vertex to offset the state amount increased when the starting vertex transfers the first state change amount from the states of the other vertices to obtain a state after offset.

5. The method according to claim 1, wherein Determining, based on at least one of a state of a starting vertex of the edge to be changed and a state of a neighboring vertex to which the target vertex is connected through an incoming edge, a changed state of the target vertex after adjusting the original directed graph through the edge to be changed, specifically includes: Adjusting the original directed graph based on the edge to be changed to obtain an adjusted directed graph; If the edge to be changed is an edge to be inserted, determining an estimated state of a destination vertex of the edge to be changed in the adjusted directed graph based on the state of the starting vertex of the edge to be changed and the weight of the edge to be changed, where the destination vertex refers to the vertex to which the edge to be changed points from the starting vertex, and the destination vertex is one of the target vertices; If the predicted state is less than the state of the destination vertex of the edge to be changed in the original directed graph, determining the predicted state as the state of the destination vertex in the adjusted directed graph, and based on the predicted state of the destination vertex, updating the states of other target vertices in the target vertices in the adjusted directed graph except the destination vertex to obtain a changed state; If the expected state is not less than the state of the destination vertex of the edge to be changed in the original directed graph, the state of the destination vertex in the original directed graph is maintained and there is no need to update the states of other target vertices in the adjusted directed graph except the destination vertex.

6. The method according to claim 1, wherein Determining, based on at least one of a state of a starting vertex of the edge to be changed and a state of a neighboring vertex to which the target vertex is connected through an incoming edge, a changed state of the target vertex after adjusting the original directed graph through the edge to be changed, specifically includes: Adjusting the original directed graph based on the edge to be changed to obtain an adjusted directed graph; If the edge to be changed is an edge to be deleted, initializing the state of the target vertex in the adjusted directed graph to obtain an initial state; For each neighbor vertex connected to the target vertex through an incoming edge, based on the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex, determine the state amount contributed by the neighbor vertex to the target vertex as the state amount corresponding to the neighbor vertex; The minimum state quantity is selected from the state quantities corresponding to each neighbor vertex as the changed state of the target vertex in the adjusted directed graph.

7. A task execution device, characterized in that: include: An acquisition module is configured to acquire an original directed graph, determine the state of each vertex in the original directed graph, and determine the edges between the vertices in the original directed graph that need to be changed as edges to be changed, wherein for each vertex included in the original directed graph, the vertex is connected to a neighbor vertex through an incoming edge or an outgoing edge, the incoming edge of the vertex is an edge starting from the neighbor vertex and pointing to the vertex, and the outgoing edge of the vertex is an edge starting from the vertex and pointing to the neighbor vertex; determine the size of a cache area and the storage space required to store the state of a vertex; determine the number of vertices that can be stored in the cache area based on the size of the cache area and the storage space; sort the vertices in the original directed graph from large to small according to degree to obtain a vertex sequence; determine the number of vertices from the vertex sequence in descending order of degree, and save the states of the determined vertices in the cache area; A search module, configured to search, based on the direction of the edge to be changed, for a vertex affected by the edge to be changed from the original directed graph as a target vertex; a determination module, configured to determine, based on at least one of a state of a starting vertex of the edge to be changed and a state of a neighboring vertex to which the target vertex is connected via an incoming edge, a changed state of the target vertex after the original directed graph is adjusted via the edge to be changed; The task execution module is used to execute the target task after receiving the target task request based on the changed state of the target vertex and the state of the vertices in the original directed graph that are not affected by the edge to be changed.

8. The device according to claim 7, wherein The determining module is specifically configured to determine a starting vertex of the edge to be changed based on the direction of the edge to be changed; determine, based on the state of the starting vertex, a state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex in the original directed graph as a first state change amount; and find other vertices affected by each outgoing edge of the starting vertex in the original directed graph; offsetting the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offsetted state of the other vertices; The original directed graph is adjusted based on the edge to be changed to obtain an adjusted directed graph; according to the state of the starting vertex in the adjusted directed graph, the state change amount that the starting vertex in the adjusted directed graph needs to transmit through the outgoing edge of the starting vertex is determined as the second state change amount; based on the second state change amount, the offset state of the target vertex in the adjusted directed graph is updated to obtain the changed state of the target vertex.

9. The device according to claim 8, wherein The determination module is specifically used to determine the negative increment required to be transmitted through each outgoing edge of the starting vertex based on the state change amount transmitted by the starting vertex through each outgoing edge of the starting vertex; using the negative increment as a transmission parameter, the module transmits the negative increment along each outgoing edge of the starting vertex to offset the state amount increased when the starting vertex transmits the first state change amount from the state of the other vertices to obtain the offset state.

10. The device according to claim 7, wherein The determination module is specifically used to adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; if the edge to be changed is an edge to be inserted, based on the state of the starting vertex of the edge to be changed and the weight of the edge to be changed, determine the expected state of the destination vertex of the edge to be changed in the adjusted directed graph, the destination vertex refers to the vertex to which the edge to be changed points from the starting vertex, and the destination vertex is one of the target vertices; if the expected state is less than the state of the destination vertex of the edge to be changed in the original directed graph, then determine the expected state as the state of the destination vertex in the adjusted directed graph, and based on the expected state of the destination vertex, update the states of other target vertices in the target vertices in the adjusted directed graph except the destination vertex to obtain a changed state; If the expected state is not less than the state of the destination vertex of the edge to be changed in the original directed graph, the state of the destination vertex in the original directed graph is maintained and there is no need to update the states of other target vertices in the adjusted directed graph except the destination vertex.

11. The device according to claim 7, wherein The determining module is specifically configured to adjust the original directed graph based on the edge to be changed to obtain an adjusted directed graph; if the edge to be changed is an edge to be deleted, initialize the state of the target vertex in the adjusted directed graph to obtain an initial state; For each neighbor vertex connected to the target vertex through an incoming edge, based on the state of the neighbor vertex and the weight of the incoming edge between the neighbor vertex and the target vertex, determine the state quantity contributed by the neighbor vertex to the target vertex as the state quantity corresponding to the neighbor vertex; select the minimum state quantity from the state quantities corresponding to each neighbor vertex as the changed state of the target vertex in the adjusted directed graph.

12. The device according to claim 7, wherein The edges to be changed include edges to be inserted and / or edges to be deleted.

13. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

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

    CN112597399A

  • Recommendation method and device based on graph representation learning, equipment and storage medium

    CN114880568A