Time-effect calculation method based on directed graph, electronic device and storage medium

CN122986208APending Publication Date: 2026-10-27KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610952410.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-29
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

然而,这种方式在面对多条件聚合、动态变更等复杂业务场景时,难以准确表达多前置事件的聚合约束关系,且当某节点发生变更时,需要人工逐一排查并重算所有受影响的下游节点,无法自动识别变更影响的边界范围,导致在节点规模较大的情况下,计算效率低下且容易出现遗漏或错误,难以满足实时、精准的时效管理需求

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122986208A_ABST
    Figure CN122986208A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of based on directed graph time limit calculation method, electronic equipment and storage medium, it is related to computer technical field, the method comprises: obtaining directed graph;Wherein, the directed graph is with event as node, with the time limit rule between event as directed edge, the time limit rule is used to define time offset;In response to trigger event, from the starting node corresponding to the trigger event in the directed graph, along the directed edge traversal, obtain the affected node set;Based on the dependency relationship of each node in the affected node set, determine the calculation order;According to the calculation order, the node in the affected node set is time limit calculated, and the time limit calculation result of each node is obtained.The method provided in the embodiments of the present application realizes the automatic accurate calculation of the event time limit with complex dependency relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a time-efficiency calculation method, electronic device, and storage medium based on directed graphs. Background Technology

[0002] In the fields of engineering project management and supply chain collaboration, timely control of material flow is crucial to ensuring project progress. There are often complex network dependencies between various material nodes. For example, the arrival time of a certain material needs to simultaneously meet different time offset requirements after the completion of multiple prerequisites, and these prerequisites are interconnected.

[0003] Currently, existing technologies typically employ preset fixed linear rules or manual scheduling tables for timeliness assessment. This involves setting individual trigger conditions and time nodes for each event, and when the status of an event changes, the time requirements for subsequent events are calculated manually or through simple scripts. However, this approach struggles to accurately represent the aggregation constraints of multiple preceding events when dealing with complex business scenarios involving multi-condition aggregation and dynamic changes. Furthermore, when a node changes, it requires manual investigation and recalculation of all affected downstream nodes, failing to automatically identify the boundary range of the change's impact. This results in low computational efficiency and a high risk of omissions or errors when dealing with a large number of nodes, making it difficult to meet the needs of real-time and accurate timeliness management.

[0004] Therefore, a solution is urgently needed to address the above problems. Summary of the Invention

[0005] This application provides a time-efficiency calculation method, electronic device, and storage medium based on directed graphs to address the deficiencies in the prior art.

[0006] This application provides a timeliness calculation method based on a directed graph, the method comprising: Obtain a directed graph; wherein the directed graph uses events as nodes and time-sensorship rules between events as directed edges, and the time-sensorship rules are used to define time offsets; In response to a triggering event, starting from the starting node in the directed graph corresponding to the triggering event, traverse along the directed edges to obtain the set of affected nodes; The computation order is determined based on the dependencies of each node in the affected node set; According to the calculation order, the timeliness calculation is performed on the nodes in the affected node set to obtain the timeliness calculation result for each node.

[0007] According to an embodiment of this application, a timeliness calculation method based on a directed graph is provided, wherein obtaining the directed graph includes: Read multiple pre-configured time-sensitive rules; each time-sensitive rule defines a trigger event, a target event, and the time offset between the trigger event and the target event; Using events as nodes, directed edges are established between event nodes that have dependencies, and the time offsets in the corresponding timeliness rules are marked on the directed edges to form the directed graph.

[0008] According to an embodiment of this application, a time-sensitivity calculation method based on a directed graph is provided, wherein establishing directed edges between event nodes with dependencies includes: If multiple time-sensitive rules are detected pointing to the same target event, an aggregation node is created for the target event; Connect the directed edges corresponding to the multiple time-limited rules to the aggregation node; The aggregation node is configured to, when performing timeliness calculation, take the latest time as the timeliness calculation result of the target event based on the time offset of each timeliness rule and the timeliness calculation result of the corresponding triggering event.

[0009] According to an embodiment of this application, a time-related calculation method based on a directed graph is provided, wherein the step of traversing along the directed edges from the starting node corresponding to the triggering event in the directed graph to obtain the set of affected nodes includes: Starting from the initial node, perform a depth-first traversal along the direction of the directed edge; The nodes that are visited during the traversal and have a direct or indirect dependency relationship with the starting node are identified as the affected node set.

[0010] According to an embodiment of this application, a time-efficiency calculation method based on a directed graph is provided, wherein determining the calculation order based on the dependency relationship of each node in the affected node set includes: Perform topological sorting on each node in the affected node set to obtain the order of computation between the nodes; Nodes without prior dependencies are designated as the first calculation batch, while nodes that depend on the calculation results of the first calculation batch are designated as subsequent calculation batches.

[0011] According to an embodiment of this application, a timeliness calculation method based on a directed graph is provided, wherein the timeliness calculation is performed on the nodes in the affected node set according to the calculation order to obtain the timeliness calculation result of each node, including: Perform timeliness calculations on the nodes in the first calculation batch to obtain the timeliness calculation results of the first calculation batch; After the first calculation batch is completed, the timeliness calculation of the first batch in the subsequent calculation batch is triggered, and after the calculation of each batch is completed, the timeliness calculation of the next batch of that batch is triggered. Specifically, for any node in any batch, the time-related calculation results of all predecessor nodes that the node depends on are read, and aggregated based on the time offset on the corresponding directed edge to obtain the time-related calculation result of the node.

[0012] According to an embodiment of this application, a timeliness calculation method based on a directed graph is provided. After performing timeliness calculations on the nodes in the affected node set according to the calculation order to obtain the timeliness calculation result for each node, the method further includes: The timeliness calculation result of each node is compared with the actual occurrence time of the node to determine the timeliness status of each node. A visual timeliness map is generated based on the timeliness status, and the overdue nodes and their dependent paths are highlighted in the visual timeliness map.

[0013] This application also provides a time-efficiency calculation device based on a directed graph, the device comprising: The acquisition module is used to acquire a directed graph; wherein the directed graph uses events as nodes and time-effect rules between events as directed edges, and the time-effect rules are used to define time offsets; The traversal module is used to respond to a triggering event by traversing the directed graph from the starting node corresponding to the triggering event along the directed edges to obtain the set of affected nodes. The determination module is used to determine the computation order based on the dependencies of each node in the affected node set; The calculation module is used to perform timeliness calculations on the nodes in the affected node set according to the calculation order, and obtain the timeliness calculation result for each node.

[0014] This application also 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 computer program, it implements the time-efficiency calculation method based on directed graphs as described above.

[0015] This application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the time-efficiency calculation method based on directed graphs as described above.

[0016] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the time-efficiency calculation method based on directed graphs as described above. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the time-efficiency calculation method based on directed graphs provided in the embodiments of this application.

[0019] Figure 2 This is a schematic diagram of the structure of the time-efficiency calculation device based on a directed graph provided in the embodiments of this application.

[0020] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the embodiments of this application.

[0022] The following describes, with reference to the accompanying drawings, a time-efficiency calculation method, electronic device, and storage medium based on a directed graph according to embodiments of this application.

[0023] Figure 1 This is a flowchart illustrating the time-efficiency calculation method based on directed graphs provided in this application. Figure 1 As shown, it includes the following: Step 100: Obtain a directed graph; wherein the directed graph uses events as nodes and time-sensorship rules between events as directed edges, and the time-sensorship rules are used to define time offsets.

[0024] Specifically, a directed graph is a data structure used to model the time-dependent relationships between events. This data structure consists of nodes and directed edges. Each event represents a business node in an engineering project management or supply chain collaboration scenario, such as actual business actions or status nodes like "completion of commencement briefing," "material ordering," "material arrival," and "completion of material installation." Time-dependent rules are used to define the time constraints between two events, specifically defining a time offset. This time offset represents the time interval that must be satisfied from the completion of the previous event to the completion of the next event. For example, in the business rule "material A must be ordered 3 days after the completion of commencement briefing," the triggering event is the completion of commencement briefing, the target event is the ordering of material A, and the time offset is 3 days.

[0025] By abstracting the above events into nodes in a graph, abstracting the timeliness rules into directed edges between nodes, and marking the time offset on the edges, a directed graph reflecting the timeliness dependency relationship of the entire project's material flow can be constructed.

[0026] Step 200: In response to the triggering event, starting from the starting node corresponding to the triggering event in the directed graph, traverse along the directed edges to obtain the set of affected nodes.

[0027] Specifically, in response to a triggering event, the system first locates the node corresponding to the triggering event in the directed graph as the starting node, and then traverses along the direction of the directed edges. All nodes that can be reached during the traversal are identified as the set of affected nodes. These nodes represent all events that need to be re-evaluated due to the occurrence of the triggering event.

[0028] Step 300: Determine the computation order based on the dependencies of each node in the affected node set.

[0029] Specifically, the computation order is determined based on the dependencies between nodes in the affected node set, i.e., which nodes should be computed first and which nodes need to wait for the computation results of their predecessor nodes to be completed before they can be computed.

[0030] Step 400: According to the calculation order, perform timeliness calculation on the nodes in the affected node set to obtain the timeliness calculation result for each node.

[0031] Specifically, according to the determined calculation order, the timeliness calculation is performed on each affected node one by one or in batches. For example, the timeliness calculation result of the predecessor node of a certain node is added to the time offset on the corresponding directed edge to obtain the time requirement that the node should complete, thereby obtaining the timeliness calculation result of each affected node.

[0032] For example, in a materials management scenario for a renovation project, there are three events and two time-sensitive rules: Rule 1 states that "material A must be ordered 3 days after the completion of the pre-construction briefing," and Rule 2 states that "material A must be ordered 2 days after the completion of material B installation." Both rules must be satisfied simultaneously, with the later time taking precedence. When constructing the directed graph, "completion of pre-construction briefing," "completion of material B installation," and "ordering of material A" are treated as nodes. Based on the two rules, two directed edges are created: one from "completion of pre-construction briefing" to "ordering of material A," and the other from "completion of material B installation" to "ordering of material A." These edges are labeled with time offsets of 3 days and 2 days, respectively. When the "completion of pre-construction briefing" event occurs in actual business operations, the node corresponding to this event is used as the starting node. Traversing along the directed edges, the "ordering of material A" node is reached, thus identifying "ordering of material A" as the affected node. Since the "Ordering Material A" node depends on two preceding nodes, "Completion of Construction Commencement Briefing" and "Completion of Material B Installation," the calculation order is determined by first waiting for the timeliness calculation result of the "Completion of Material B Installation" node to be ready before performing aggregate calculation on "Ordering Material A." During the calculation, it is assumed that the actual time of "Completion of Construction Commencement Briefing" is May 1st, adding 3 days gives May 4th; the actual time of "Completion of Material B Installation" is May 3rd, adding 2 days gives May 5th; the later of the two, May 5th, is taken as the final timeliness requirement for ordering Material A. Thus, the timeliness calculation for the affected "Ordering Material A" event is automatically completed, eliminating the need for manual investigation and calculation.

[0033] The above describes the steps of the timeliness calculation method based on a directed graph provided in this application embodiment. As can be seen from the above description, according to the timeliness calculation method based on a directed graph provided in this application embodiment, a directed graph is obtained; wherein the directed graph uses events as nodes and timeliness rules between events as directed edges, and the timeliness rules are used to define time offsets; in response to a triggered event, starting from the starting node corresponding to the triggered event in the directed graph, the system traverses along the directed edges to obtain a set of affected nodes; based on the dependency relationships of each node in the set of affected nodes, the calculation order is determined; according to the calculation order, timeliness calculations are performed on the nodes in the set of affected nodes to obtain the timeliness calculation result for each node. Therefore, this application embodiment achieves automated and accurate calculation of the timeliness of events with complex dependencies by obtaining a directed graph with events as nodes and timeliness rules as directed edges, traversing along the directed edges to obtain a set of affected nodes when a triggered event occurs, and then determining the calculation order and performing timeliness calculations based on dependencies.

[0034] Based on the above embodiments, in this embodiment, step 100, obtaining the directed graph, includes: Step 110: Read multiple pre-configured time-sensitive rules; wherein each time-sensitive rule defines a triggering event, a target event, and the time offset between the triggering event and the target event.

[0035] Step 120: Using events as nodes, establish directed edges between event nodes that have dependencies, and mark the time offsets in the corresponding timeliness rules on the directed edges to form the directed graph.

[0036] Step 120 involves establishing directed edges between event nodes that have dependencies, specifically including: Step 121: If multiple time-sensitive rules are detected pointing to the same target event, create an aggregation node for the target event.

[0037] Step 122: Connect the directed edges corresponding to the multiple time-limited rules to the aggregation node; The aggregation node is configured to, when performing timeliness calculation, take the latest time as the timeliness calculation result of the target event based on the time offset of each timeliness rule and the timeliness calculation result of the corresponding triggering event.

[0038] Specifically, it reads multiple pre-configured time-limited rules. These time-limited rules are derived from the time constraints set by business personnel based on the actual management needs of the project. Each time-limited rule clearly defines three elements: the triggering event, the target event, and the time offset between the triggering event and the target event, which is the allowed time interval from the occurrence of the triggering event to the completion of the target event.

[0039] After reading all the time-sensitive rules, the system begins to construct a directed graph: the events involved in each time-sensitive rule are abstracted as nodes in the graph. If multiple rules involve the same event, then the event corresponds to a unique node in the graph, thus avoiding redundancy. Based on this, for each time-sensitive rule, a directed edge is established from the node corresponding to the triggering event to the node corresponding to the target event. The direction of this directed edge represents the direction of dependency propagation, that is, the time-sensitive calculation of the target event depends on the occurrence time of the triggering event. At the same time, the time offset in the rule is used as weight information and labeled on the corresponding directed edge.

[0040] It should be noted that when the system detects multiple timeliness rules pointing to the same target event, it creates an aggregation node for that target event. This node serves as an intermediate node for performing multi-condition time aggregation calculations, integrating the timeliness constraints of multiple preconditions into a single final timeliness requirement. Specifically, the system connects all directed edges corresponding to the multiple timeliness rules that originally pointed to the target event to this aggregation node, which then unifies these edges to the target event node. During timeliness calculation, for each directed edge connected to the aggregation node, the system adds the timeliness calculation result of the triggering event corresponding to that edge to the time offset marked on the edge, obtaining a candidate time. Among all candidate times, the latest time is selected as the final timeliness calculation result for the target event.

[0041] The timeliness calculation method based on directed graphs provided in this embodiment achieves automation and accuracy in timeliness calculation under multi-condition aggregation constraint scenarios by creating an aggregation node when multiple timeliness rules point to the same target event and taking the latest time.

[0042] Based on the above embodiments, in this embodiment, step 200 involves traversing the directed graph from the starting node corresponding to the triggering event, along the directed edges, to obtain the set of affected nodes, including: Step 210: Starting from the starting node, perform a depth-first traversal along the direction of the directed edge.

[0043] Step 220: Determine the set of affected nodes as those nodes that have a direct or indirect dependency relationship with the starting node during the traversal process.

[0044] Specifically, when the system responds to a trigger event and locates the corresponding starting node in the directed graph, it performs a depth-first traversal along the directed edges, starting from that starting node. Depth-first traversal means starting from the starting node and visiting downstream nodes as deeply as possible along a directed edge until the end of the current path, then backtracking to explore other unvisited branch paths. This traversal method ensures that no node on any dependency chain is missed. During the traversal, all visited nodes are included in the set of affected nodes, including nodes that have a direct dependency on the starting node (i.e., nodes that can be reached from the starting node via a single directed edge) and nodes that have an indirect dependency on the starting node (i.e., nodes that require intermediate nodes and multiple directed edges to reach).

[0045] The timeliness calculation method based on directed graphs provided in this embodiment comprehensively captures direct and indirect dependent nodes along the directed edge direction using a depth-first traversal approach, ensuring the integrity and accuracy of the affected node set and avoiding deviations in timeliness calculation due to the omission of downstream nodes.

[0046] Based on the above embodiments, in this embodiment, step 300 determines the calculation order based on the dependency relationship of each node in the affected node set, including: Perform topological sorting on each node in the affected node set to obtain the order of computation between the nodes; Nodes without prior dependencies are designated as the first calculation batch, while nodes that depend on the calculation results of the first calculation batch are designated as subsequent calculation batches.

[0047] Specifically, after obtaining the set of affected nodes, the system performs a topological sort on each node in the set, that is, arranges all nodes in the directed acyclic graph into a linear sequence, so that for any directed edge in the graph, the starting point is always located before the ending point in the sequence, thereby ensuring that when each node is being calculated, all the preceding nodes it depends on have been calculated.

[0048] Based on topological sorting, the system divides the affected set of nodes into different computation batches. Nodes that do not depend on any other nodes, i.e., nodes without prior dependencies, are identified as the first computation batch. These nodes can directly use the triggering event time of external input for time-sensitive calculations. Nodes that depend on the calculation results of the first computation batch are identified as subsequent computation batches. Nodes in subsequent computation batches must wait for the calculation results of their preceding batches to be ready before they can start computation.

[0049] Using the aforementioned renovation project scenario as an example, suppose the set of affected nodes includes three nodes: "Order for Material A", "Material A Arrives on Site", and "Material A Installation Completed". "Order for Material A" depends on an external triggering event and has no prior dependencies, so it is classified into the first calculation batch. "Material A Arrives on Site" depends on the calculation result of "Order for Material A" and is classified into a subsequent calculation batch. "Material A Installation Completed" depends on the calculation result of "Material A Arrives on Site" and is classified into an even later calculation batch.

[0050] The time-efficiency calculation method based on directed graphs provided in this embodiment can reasonably arrange the execution order of calculation tasks through batch partitioning. Under the premise of ensuring the correctness of dependencies, it enables independent nodes within the same batch to be calculated in parallel, thereby improving the overall calculation efficiency.

[0051] Based on the above embodiments, in this embodiment, step 400 performs timeliness calculations on the nodes in the affected node set according to the calculation order to obtain the timeliness calculation result for each node, including: Step 410: Perform timeliness calculation on the nodes in the first calculation batch to obtain the timeliness calculation result of the first calculation batch.

[0052] Step 420: After the first calculation batch is completed, the timeliness calculation of the first batch in the subsequent calculation batch is triggered, and after the calculation of each batch is completed, the timeliness calculation of the next batch of that batch is triggered. Specifically, for any node in any batch, the time-related calculation results of all predecessor nodes that the node depends on are read, and aggregated based on the time offset on the corresponding directed edge to obtain the time-related calculation result of the node.

[0053] Specifically, after determining the division of each calculation batch, the timeliness calculation of the first calculation batch is started first. The nodes in the first calculation batch are all nodes without any prerequisites, and the precursor information required for its timeliness calculation can be directly obtained from the outside. After the calculation is completed, the timeliness calculation results of each node in the first calculation batch are obtained.

[0054] Once the first batch of calculations is completed, the system automatically triggers the time-sensitive calculation for the first batch in the subsequent batches. The predecessor nodes that the nodes in this batch depend on have all completed the calculations and generated time-sensitive calculation results in the previous batch, thus meeting the conditions for starting. Similarly, after the calculation of this batch is completed, the calculation of the next batch is triggered, and so on, forming a progressive and automatically connected calculation process until the time-sensitive calculations of all affected nodes are completed.

[0055] In this process, for any node in any batch, the system reads the time-efficiency calculation results of all the predecessor nodes that the node depends on. These predecessor nodes are those nodes in the directed graph that point to the node through directed edges. Then, combined with the time offset marked on each directed edge, the time-efficiency calculation results of each predecessor node are added to the corresponding time offset to obtain the candidate time. Then, multiple candidate times are aggregated, for example, the latest time is taken, and finally the time-efficiency calculation result of the node is obtained.

[0056] The timeliness calculation method based on directed graphs provided in this embodiment divides the affected nodes into different batches and automatically triggers the calculation in batches, so that the timeliness results of all its predecessor nodes are ready when each node is calculated, thereby achieving efficient and orderly timeliness calculation while ensuring the correctness of the dependency relationship.

[0057] Based on the above embodiments, in this embodiment, after step 400 performs timeliness calculations on the nodes in the affected node set according to the calculation order to obtain the timeliness calculation result for each node, the method further includes: The timeliness calculation result of each node is compared with the actual occurrence time of the node to determine the timeliness status of each node. A visual timeliness map is generated based on the timeliness status, and the overdue nodes and their dependent paths are highlighted in the visual timeliness map.

[0058] Specifically, the system compares the timeliness calculation result of each node with the actual occurrence time corresponding to that node. The actual occurrence time refers to the time point when the event is actually completed in real business. Through comparison, the system determines the timeliness status of each node. For example, when the actual occurrence time is earlier than or equal to the timeliness calculation result, the node is determined to be in a normal state. When the actual occurrence time exceeds the timeliness calculation result, the node is determined to be in an overdue state. In addition, the warning level can be further subdivided according to the degree of overdue.

[0059] After determining the timeliness status, the system generates a visual timeliness map based on the timeliness status of each node. This is an interactive interface that presents the event nodes and their dependencies in a directed graph in a graphical way. On this map, nodes with different timeliness statuses are distinguished by different colors or symbols. In particular, for nodes that are determined to be overdue, the system highlights them in the visual timeliness map, for example, by marking the node in a striking red, and highlights the complete dependency path of the overdue node, so that managers can easily identify the overdue event and the scope of its upstream and downstream nodes.

[0060] Optionally, this embodiment also includes a corresponding dynamic adjustment mechanism. When a change in an existing rule is detected, the system does not need to rebuild the entire directed graph. Instead, it incrementally updates the graph structure, modifying only the local nodes and directed edges related to the changed rule, and automatically marking the historical event nodes affected by the change. Subsequently, only the marked nodes and their downstream branches are recalculated locally, without affecting the existing calculation results of other unchanged parts of the graph, thus achieving precise scheduling of rule computation resources. Similarly, when the actual occurrence time of an event needs to be corrected, the system propagates the corrected time along the direction of the directed edges to downstream nodes, recalculating only the affected branch links. When new business event nodes are added to the project, the system can automatically integrate the new nodes into the existing directed graph structure and dynamically adjust the allocation strategy of computation resources as needed, thereby ensuring that the entire timeliness assessment system has good business adaptability and scalability.

[0061] The timeliness calculation method based on directed graphs provided in this embodiment compares the timeliness calculation results with the actual occurrence time and generates a visual timeliness map, highlighting overdue nodes and their dependent paths, enabling managers to quickly locate problematic links and intuitively assess their chain impact on the overall progress.

[0062] The time-efficiency calculation device based on directed graphs provided in the embodiments of this application will be described below. The time-efficiency calculation device based on directed graphs and the time-efficiency calculation method based on directed graphs described below can be referred to in correspondence with each other.

[0063] Figure 2 This is a schematic diagram of the structure of the time-efficiency calculation device based on a directed graph provided in the embodiments of this application, as shown below. Figure 2 As shown in the embodiment of this application, the time-efficiency calculation device based on a directed graph includes: The acquisition module 201 is used to acquire a directed graph; wherein the directed graph uses events as nodes and time-effect rules between events as directed edges, and the time-effect rules are used to define time offsets; Traversal module 202 is used to respond to a triggering event by traversing the directed graph from the starting node corresponding to the triggering event along the directed edges to obtain the set of affected nodes. The determination module 203 is used to determine the computation order based on the dependency relationship of each node in the affected node set; The calculation module 204 is used to perform timeliness calculations on the nodes in the affected node set according to the calculation order, and obtain the timeliness calculation result for each node.

[0064] The timeliness calculation device based on a directed graph provided in this application obtains a directed graph, wherein the directed graph uses events as nodes and timeliness rules between events as directed edges, and the timeliness rules are used to define time offsets. In response to a triggered event, starting from the starting node corresponding to the triggered event in the directed graph, the device traverses along the directed edges to obtain a set of affected nodes. Based on the dependencies of each node in the set of affected nodes, the calculation order is determined. According to the calculation order, the timeliness calculation is performed on the nodes in the set of affected nodes to obtain the timeliness calculation result for each node. Therefore, this application embodiment achieves automated and accurate calculation of the timeliness of events with complex dependencies by obtaining a directed graph with events as nodes and timeliness rules as directed edges, traversing along the directed edges to obtain a set of affected nodes when an event is triggered, and then determining the calculation order and performing timeliness calculation based on dependencies.

[0065] Based on the above embodiments, in this embodiment, the acquisition module 201 is specifically used for: Read multiple pre-configured time-sensitive rules; each time-sensitive rule defines a trigger event, a target event, and the time offset between the trigger event and the target event; Using events as nodes, directed edges are established between event nodes that have dependencies, and the time offsets in the corresponding timeliness rules are marked on the directed edges to form the directed graph.

[0066] Based on the above embodiments, in this embodiment, the traversal module 202 is specifically used for: If multiple time-sensitive rules are detected pointing to the same target event, an aggregation node is created for the target event; Connect the directed edges corresponding to the multiple time-limited rules to the aggregation node; The aggregation node is configured to, when performing timeliness calculation, take the latest time as the timeliness calculation result of the target event based on the time offset of each timeliness rule and the timeliness calculation result of the corresponding triggering event.

[0067] Based on the above embodiments, in this embodiment, the traversal module 202 is further configured to: Starting from the initial node, perform a depth-first traversal along the direction of the directed edge; The nodes that are visited during the traversal and have a direct or indirect dependency relationship with the starting node are identified as the affected node set.

[0068] Based on the above embodiments, in this embodiment, the determining module 203 is specifically used for: Perform topological sorting on each node in the affected node set to obtain the order of computation between the nodes; Nodes without prior dependencies are designated as the first calculation batch, while nodes that depend on the calculation results of the first calculation batch are designated as subsequent calculation batches.

[0069] Based on the above embodiments, in this embodiment, the calculation module 204 is specifically used for: Perform timeliness calculations on the nodes in the first calculation batch to obtain the timeliness calculation results of the first calculation batch; After the first calculation batch is completed, the timeliness calculation of the first batch in the subsequent calculation batch is triggered, and after the calculation of each batch is completed, the timeliness calculation of the next batch of that batch is triggered. Specifically, for any node in any batch, the time-related calculation results of all predecessor nodes that the node depends on are read, and aggregated based on the time offset on the corresponding directed edge to obtain the time-related calculation result of the node.

[0070] Based on the above embodiments, in this embodiment, the device further includes a display module, specifically used for: Following the aforementioned calculation order, timeliness calculations are performed on the nodes in the affected node set to obtain the timeliness calculation result for each node. The timeliness calculation result of each node is compared with the actual occurrence time of the node to determine the timeliness status of each node. A visual timeliness map is generated based on the timeliness status, and the overdue nodes and their dependent paths are highlighted in the visual timeliness map.

[0071] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device can be a robot or other electronic device. This electronic device may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340. The processor 310, communication interface 320, and memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions from the memory 330 to execute a time-based calculation method based on a directed graph, including: Obtain a directed graph; wherein the directed graph uses events as nodes and time-sensorship rules between events as directed edges, and the time-sensorship rules are used to define time offsets; In response to a triggering event, starting from the starting node in the directed graph corresponding to the triggering event, traverse along the directed edges to obtain the set of affected nodes; The computation order is determined based on the dependencies of each node in the affected node set; According to the calculation order, the timeliness calculation is performed on the nodes in the affected node set to obtain the timeliness calculation result for each node.

[0072] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application embodiment, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in at least one embodiment of this application embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0073] On the other hand, embodiments of this application also provide a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the time-efficiency calculation method based on the directed graph provided by the above methods, including: Obtain a directed graph; wherein the directed graph uses events as nodes and time-sensorship rules between events as directed edges, and the time-sensorship rules are used to define time offsets; In response to a triggering event, starting from the starting node in the directed graph corresponding to the triggering event, traverse along the directed edges to obtain the set of affected nodes; The computation order is determined based on the dependencies of each node in the affected node set; According to the calculation order, the timeliness calculation is performed on the nodes in the affected node set to obtain the timeliness calculation result for each node.

[0074] In another aspect, embodiments of this application also provide a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the time-efficiency calculation methods based on directed graphs provided by the methods described above, including: Obtain a directed graph; wherein the directed graph uses events as nodes and time-sensorship rules between events as directed edges, and the time-sensorship rules are used to define time offsets; In response to a triggering event, starting from the starting node in the directed graph corresponding to the triggering event, traverse along the directed edges to obtain the set of affected nodes; The computation order is determined based on the dependencies of each node in the affected node set; According to the calculation order, the timeliness calculation is performed on the nodes in the affected node set to obtain the timeliness calculation result for each node.

[0075] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0076] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of this application, and are not intended to limit them; although the embodiments of this application have been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A time-efficiency calculation method based on directed graphs, characterized in that, include: Obtain a directed graph; wherein the directed graph uses events as nodes and time-sensorship rules between events as directed edges, and the time-sensorship rules are used to define time offsets; In response to a triggering event, starting from the starting node in the directed graph corresponding to the triggering event, traverse along the directed edges to obtain the set of affected nodes; The computation order is determined based on the dependencies of each node in the affected node set; According to the calculation order, the timeliness calculation is performed on the nodes in the affected node set to obtain the timeliness calculation result for each node.

2. The time-efficiency calculation method based on directed graphs according to claim 1, characterized in that, The process of obtaining the directed graph includes: Read multiple pre-configured time-sensitive rules; each time-sensitive rule defines a trigger event, a target event, and the time offset between the trigger event and the target event; Using events as nodes, directed edges are established between event nodes that have dependencies, and the time offsets in the corresponding timeliness rules are marked on the directed edges to form the directed graph.

3. The time-efficiency calculation method based on directed graphs according to claim 2, characterized in that, The establishment of directed edges between event nodes with dependencies includes: If multiple time-sensitive rules are detected pointing to the same target event, an aggregation node is created for the target event; Connect the directed edges corresponding to the multiple time-limited rules to the aggregation node; The aggregation node is configured to, when performing timeliness calculation, take the latest time as the timeliness calculation result of the target event based on the time offset of each timeliness rule and the timeliness calculation result of the corresponding triggering event.

4. The time-efficiency calculation method based on directed graphs according to claim 1, characterized in that, The step of traversing the directed edges from the starting node corresponding to the triggering event in the directed graph to obtain the set of affected nodes includes: Starting from the initial node, perform a depth-first traversal along the direction of the directed edge; The nodes that are visited during the traversal and have a direct or indirect dependency relationship with the starting node are identified as the affected node set.

5. The time-efficiency calculation method based on directed graphs according to claim 1, characterized in that, Determining the computation order based on the dependencies of each node in the affected node set includes: Perform topological sorting on each node in the affected node set to obtain the order of computation between the nodes; Nodes without prior dependencies are designated as the first calculation batch, while nodes that depend on the calculation results of the first calculation batch are designated as subsequent calculation batches.

6. The time-efficiency calculation method based on directed graphs according to claim 5, characterized in that, The step of performing timeliness calculations on the nodes in the affected node set according to the calculation order to obtain the timeliness calculation result for each node includes: Perform timeliness calculations on the nodes in the first calculation batch to obtain the timeliness calculation results of the first calculation batch; After the first calculation batch is completed, the timeliness calculation of the first batch in the subsequent calculation batch is triggered, and after the calculation of each batch is completed, the timeliness calculation of the next batch of that batch is triggered. Specifically, for any node in any batch, the time-related calculation results of all predecessor nodes that the node depends on are read, and aggregated based on the time offset on the corresponding directed edge to obtain the time-related calculation result of the node.

7. The time-efficiency calculation method based on directed graphs according to any one of claims 1 to 6, characterized in that, After performing timeliness calculations on the nodes in the affected node set according to the calculation order to obtain the timeliness calculation result for each node, the method further includes: The timeliness calculation result of each node is compared with the actual occurrence time of the node to determine the timeliness status of each node. A visual timeliness map is generated based on the timeliness status, and the overdue nodes and their dependent paths are highlighted in the visual timeliness map.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the time-efficiency calculation method based on directed graphs as described in any one of claims 1 to 7.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the time-efficiency calculation method based on directed graphs as described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the time-efficiency calculation method based on directed graphs as described in any one of claims 1 to 7.