A path generation method, apparatus, device, and medium
Patent Information
- Application Number
- CN202611438937.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]然而,有向图结构复杂,仅通过人为分析有向图结构中最优路径的准确率较低
[0023]本发明实施例的技术方案,通过获取待处理有向图对应的图结构信息,图结构信息包括至少一个图节点、各图节点对应的至少一条有向边及各有向边对应的边属性信息;获取路径起点节点和路径终点节点;从路径起点节点开始,根据数据流向确定遍历的至少一个候选节点;根据各遍历的候选节点的遍历情况和当前节点信息,确定至少一个节点序列;根据路径起点节点、路径终点节点和各节点序列,确定目标路径,通过多维数据确定目标路径,提升了路径生成的准确性。
Smart Images

Figure CN123011757A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a path generation method, apparatus, device, and medium. Background Technology
[0002] With the rapid development of technology, the amount of data to be stored is gradually increasing and the interaction relationships between data are becoming more complex. Directed graph structures can be used to store data and the interaction relationships between data.
[0003] Currently, the optimal path between the starting node and the ending node is determined by manually analyzing the structure information of the directed graph.
[0004] However, directed graphs have complex structures, and the accuracy of analyzing the optimal path in a directed graph structure by human means alone is low. Summary of the Invention
[0005] This invention provides a path generation method, apparatus, device, and medium to improve the accuracy of path generation.
[0006] In a first aspect, embodiments of the present invention provide a path generation method, the method comprising:
[0007] Obtain the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge.
[0008] Get the starting and ending nodes of the path;
[0009] Starting from the path's starting node, determine at least one candidate node to traverse based on the data flow direction;
[0010] Based on the traversal status of each candidate node and the information of the current node, determine at least one node sequence;
[0011] The target path is determined based on the starting node, ending node, and sequence of nodes.
[0012] Secondly, embodiments of the present invention also provide a path generation apparatus, the apparatus comprising:
[0013] The information acquisition module is used to acquire the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge.
[0014] The node acquisition module is used to acquire the starting node and ending node of a path;
[0015] The candidate point determination module is used to determine at least one candidate node to be traversed, starting from the path start node and based on the data flow direction.
[0016] The sequence determination module is used to determine at least one node sequence based on the traversal status of each candidate node and the current node information.
[0017] The path determination module is used to determine the target path based on the path start node, path end node, and the sequence of nodes.
[0018] Thirdly, embodiments of the present invention also provide a path generation device, the path generation device comprising:
[0019] At least one processor; and
[0020] A memory that is communicatively connected to at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to perform the path generation method of any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement the path generation method of any embodiment of the present invention.
[0023] The technical solution of this invention obtains graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge. It obtains the path start node and the path end node. Starting from the path start node, it determines at least one candidate node to be traversed based on the data flow direction. Based on the traversal status of each candidate node and the current node information, it determines at least one node sequence. Based on the path start node, the path end node, and each node sequence, it determines the target path. By determining the target path through multi-dimensional data, the accuracy of path generation is improved.
[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1This is a flowchart of a path generation method provided in Embodiment 1 of the present invention;
[0027] Figure 2 This is a flowchart of a path generation method provided in Embodiment 2 of the present invention;
[0028] Figure 3 This is a structural diagram of a path generation device provided according to an embodiment of the present invention;
[0029] Figure 4 This is a schematic diagram of the structure of a path generation device provided in an embodiment of the present invention. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] The acquisition, storage, and application of graph structure information and other related information in the technical solutions of this invention comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0033] Example 1
[0034] Figure 1 This is a flowchart illustrating a path generation method according to Embodiment 1 of the present invention. This embodiment of the invention is applicable to path generation, and the method can be executed by a path generation device, which can be implemented in hardware and / or software.
[0035] See Figure 1 The path generation method shown includes:
[0036] S101. Obtain the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge.
[0037] The directed graph to be processed can be a network structure composed of entities and directed relationships between entities, where the relationships have a clear direction (e.g., "Service A calls Service B" ≠ "Service B calls Service A"). For example, entities can be users, services, containers, servers, or databases. Directed relationships can be calls, running in, or containing. Graph structure information can be descriptive information about the structure of the directed graph to be processed. Graph nodes can be entities in the directed graph to be processed, each node having a unique identifier (ID). Example: User (User_001), Order Service (Order_Svc), and Database (DB_Order). Directed edges represent directed relationships between two nodes, consisting of a start point, an end point, and a relationship type. Example: User_001 calls Order_Svc. Each directed edge includes edge attribute information, including: Relationship type: distinguishing between horizontal relationships (e.g., calls) and vertical relationships (e.g., running in or containing). Relationship semantics: describing the business meaning of the relationship, such as "Service A calls Service B". Direction flag: indicating whether the edge is forward (outgoing) or backward (incoming).
[0038] Specifically, all independent entities are extracted from the business system (such as a microservice topology), and each entity is assigned a unique ID and type label. Interaction logs, deployment configurations, and dependency declarations between entities are scanned to identify all directed relationships, recording the start point, end point, and relationship type. Each relationship is labeled with attributes: relationship type (call, run in, or contain, etc.) and relationship direction (forward or reverse). Nodes and edges are organized into a unified graph data structure, forming the graph structure information corresponding to the directed graph to be processed.
[0039] S102. Obtain the starting node and ending node of the path.
[0040] In this context, the starting node of the path can be the initial entity for path lookup, which is the first node traversed. The ending node of the path can be the target entity for path lookup, which is the final node reached.
[0041] Specifically, the starting and ending nodes of a path can be manually specified. Users or maintenance personnel can directly input the names of the starting and ending nodes through the system interface, configuration files, or interface parameters. Based on the input node names, the system matches the corresponding nodes in the acquired graph structure information and verifies whether the node exists (if it does not exist, an input error message is displayed). Alternatively, the starting and ending nodes can be automatically identified and derived based on the business scenario. For example, in a fault diagnosis scenario, if an "order database access anomaly" is detected, the "abnormal database node" is automatically set as the ending node, and the "user-side node" is set as the starting node. Furthermore, the starting and ending nodes can be obtained through batch configuration. Multiple sets of starting and ending node pairs can be predefined in the configuration file and processed sequentially in batches. For example, during daily inspections, multiple sets of paths, such as "user-side and user information database" and "merchant-side and inventory database," can be analyzed in batches.
[0042] S103. Starting from the path starting node, determine at least one candidate node to be traversed based on the data flow direction.
[0043] In this context, the data flow direction can be the direction of an edge in a directed graph, i.e., the direction of the relationship between entities (e.g., when a user calls a gateway, the data flow direction is "user flows to gateway"). Candidate nodes can be nodes that can be directly reached from the current node along the data flow direction.
[0044] Specifically, from the acquired graph structure information, all outgoing edges originating from the path's starting node are selected. Each outgoing edge has a "starting point to ending point" structure. The "ending points" of all these outgoing edges are extracted to form at least one candidate node. For example, the path's starting node is N001 (User_001, the user). Graph structure information: It contains an outgoing edge E001 (N001 calls N002), with no other outgoing edges. Searching the graph structure, the starting point ID = N001 only matches edge E001, and the data flow is from N001 to N002. N002 is extracted as a candidate node.
[0045] S104. Based on the traversal status of each candidate node and the current node information, determine at least one node sequence.
[0046] The traversal status can be the core state description information of the candidate nodes, such as: whether the candidate node has been visited, whether the number of times the candidate node has been called has exceeded the limit, and whether a loop rule has been triggered. The current node information can be a collection of information such as the traversal sequence number of the candidate node determined at the current time and the traversal duration. The node sequence can be an ordered list composed of the starting node of the path and the traversed nodes in sequence.
[0047] Specifically, based on the starting node of the path, at least one candidate node corresponding to the starting node is obtained. For each candidate node, three core traversal states are checked: State 1: Does the node trigger a cycle? State 2: Is the edge from the starting point to the node a lateral call, and has the call count exceeded the limit? State 3: Is the node invalid (e.g., reverse traversal of vertical relationships or path length exceeding the threshold)? If the candidate node passes the verification (no cycle, no exceeding the limit, and the node is valid): the node is appended to the end of the temporary sequence corresponding to the node, forming a new node sequence. The candidate node is then used as the starting node, and candidate nodes corresponding to the starting node are selected for verification. If the candidate node fails the verification, the temporary sequence corresponding to the node is directly deleted. If the last node of the new sequence is the ending node: the sequence is marked as a "valid sequence". If the new sequence does not reach the ending point but there are no more candidate nodes, the sequence is deleted. Based on each valid sequence, at least one node sequence is determined.
[0048] S105. Determine the target path based on the starting node, ending node, and sequence of nodes.
[0049] Specifically, all node sequences generated during the traversal are summarized. Each node sequence corresponds to one path. The node sequences can be filtered; only sequences that begin with the path's starting node and end with its ending node constitute the target path. Filtering rules can include: no loops in the path, the number of times each node in the sequence is called does not exceed the limit, nodes with vertically related edge attributes are not traversed in reverse, and the path length does not exceed the limit.
[0050] The technical solution of this invention obtains graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge. It obtains the path start node and the path end node. Starting from the path start node, it determines at least one candidate node to be traversed based on the data flow direction. Based on the traversal status of each candidate node and the current node information, it determines at least one node sequence. Based on the path start node, the path end node, and each node sequence, it determines the target path. By determining the target path through multi-dimensional data, the accuracy of path generation is improved.
[0051] Example 2
[0052] Figure 2 This is a flowchart illustrating a path generation method according to Embodiment 2 of the present invention. Based on the above embodiments, this embodiment optimizes and improves the path generation operation.
[0053] Furthermore, the step of "determining at least one node sequence based on the traversal status of each candidate node and the current node information" is refined to "determining at least one target node among the candidate nodes in each traversal based on the traversal status of each candidate node; generating candidate sequences corresponding to each target node and path information of the candidate sequences based on each target node; when the target node is the end point of the path, determining the candidate sequence to which the target node belongs as the node sequence; when the path information of the candidate sequence does not meet the path constraints, deleting the candidate sequence and the target node corresponding to the candidate sequence; for the remaining target nodes that are different from the end point of the path, obtaining at least one candidate node corresponding to the data outflow edge of the remaining target nodes that are different from the end point of the path, updating the traversed candidate nodes, determining at least one target node among the candidate nodes in each traversal, and updating the candidate sequences corresponding to each target node and the path information of each candidate sequence", in order to improve the path generation operation.
[0054] It should be noted that for parts not described in detail in the embodiments of the present invention, please refer to the descriptions in other embodiments.
[0055] See Figure 2 The path generation method shown includes:
[0056] S201. Obtain the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge.
[0057] S202. Obtain the starting node and ending node of the path.
[0058] S203. Starting from the path's starting node, determine at least one candidate node to be traversed based on the data flow direction.
[0059] S204. Based on the traversal status of each candidate node, determine at least one target node among the candidate nodes of each traversal.
[0060] Specifically, for each candidate node, two types of key data are extracted from the graph structure information: Edge information: attributes of edges leading to the candidate node (relationship type, call count constraints, and direction constraints, etc.); Path status information: current path visited flags, existence of cycles, and current path length, etc. The system checks whether the candidate node is already in the visited node list of the current path; if so, it is not considered a target node. If the candidate node's edges represent horizontal call relationships, it checks whether the candidate node's call count has reached its limit; if so, it is not considered a target node. If the candidate node's edges represent vertical relationships, it checks whether a reverse traversal constraint is triggered; if so, it is not considered a target node. If a candidate node passes all checks, it is determined to be a target node; if a candidate node fails any check, it is determined to be a non-target node.
[0061] S205. Based on each target node, generate the alternative sequence corresponding to each target node, as well as the path information of the alternative sequence.
[0062] Specifically, for each target node, a sequence expansion operation is performed, appending the target node to the end of its temporary sequence in traversal order to form a new historical sequence (i.e., the candidate sequence corresponding to the target node). Based on the candidate sequence and graph structure information, the path information of the candidate sequence is calculated: path length = number of nodes in the candidate sequence - 1 (e.g., the length of [N001, N002] = 1); path duration: accumulated by adding the business interaction time corresponding to each edge in the candidate sequence (e.g., reading "call time = 50ms" from the edge attributes of the graph structure and accumulating to obtain the total duration). The "candidate sequence" and "path information" corresponding to each target node are bound one by one to form a "candidate sequence and path information" key-value pair.
[0063] S206. When the target node is the end point of the path, the candidate sequence to which the target node belongs is determined as the node sequence.
[0064] Specifically, the unique ID of the target node is precisely compared with the ID of the pre-specified "path endpoint node" to confirm whether they are the same node. If they match completely, the target node is determined to be the path endpoint node; if the match fails, this step is skipped. If the match is successful, the candidate sequence to which the target node belongs is located from the associated stored mapping relationship of "target node and candidate sequence": the candidate sequence is directly marked as a "node sequence", the sequence attribute is changed from "temporary candidate" to "valid confirmation", and it is stored separately from the candidate sequences that have not reached the path endpoint node. No further node appending or traversal operations are performed on this sequence.
[0065] S207. When the path information of the candidate sequence does not meet the path constraint conditions, delete the candidate sequence and the target node corresponding to the candidate sequence.
[0066] Specifically, the core metrics (path length and path duration, etc.) of the candidate sequence are read from the bound data of "candidate sequence and path information"; preset path constraints (path length ≤ 1 or path duration 1 minute, etc.) are read. If the path length or path duration exceeds the threshold, the candidate sequence is deleted, removed from the "candidate sequence set," and memory is released; the corresponding target node is deleted, that is, the target node corresponding to the candidate sequence is removed from the "currently traversable target node pool," and this node will no longer be used as a candidate node or target node for subsequent traversal. The path information (such as path length, etc.) corresponding to the candidate sequence is deleted.
[0067] S208. For the remaining target nodes that are different from the path endpoint node, obtain at least one candidate node corresponding to the data flow outgoing edge of the remaining target node that is different from the path endpoint node, update the traversed candidate nodes, determine at least one target node among the traversed candidate nodes, and update the candidate sequence corresponding to each target node and the path information of each candidate sequence.
[0068] Specifically, from the determined set of target nodes, two types of nodes are filtered out: nodes that are not the endpoints of the path and nodes that were not deleted due to "path information not meeting constraints," ultimately resulting in a "list of remaining target nodes." For each remaining target node, the following steps are performed: Step 1: Extract all outgoing edges from the graph structure information that originate from that node; Step 2: Extract the endpoints of these outgoing edges to form a "new candidate node list" corresponding to that remaining target node; Step 3: Summarize the new candidate nodes of all remaining target nodes and update the traversed candidate node pool (replacing the original candidate node pool). For the updated candidate node pool, target nodes are redefined. Based on the "original candidate sequence" to which each remaining target node belongs: new target nodes are appended sequentially to the end of the original candidate sequence to generate a "new candidate sequence"; Example: Original candidate sequence [N001, N002] (remaining target node N002), append new target node N003, the new sequence is [N001, N002, N003]. Simultaneously calculate the path information of the new candidate sequence. The path length is the original length + 1.
[0069] S209. Determine the target path based on the starting node, ending node, and sequence of nodes.
[0070] This invention, through multi-dimensional data filtering of candidate nodes, determines at least one target node from among the candidate nodes traversed; generates candidate sequences and path information for each target node based on the traversal status of each candidate node; when a target node is the endpoint of a path, the candidate sequence to which the target node belongs is determined as a node sequence; when the path information of a candidate sequence does not meet the path constraints, the candidate sequence and the target node corresponding to the candidate sequence are deleted; for the remaining target nodes that are different from the endpoint of the path, at least one candidate node corresponding to the data outflow edge of the remaining target nodes that are different from the endpoint of the path is obtained, and the traversed candidate nodes are updated. This process, by determining at least one target node from among the candidate nodes traversed and updating the candidate sequences and path information for each target node, improves the accuracy of target node determination by filtering candidate nodes through multi-dimensional data.
[0071] Optionally, based on the traversal status of each candidate node, at least one target node is determined among the candidate nodes of each traversal, including: for each candidate node of each traversal, determining the filtering method of the candidate nodes of the traversal based on the edge attribute information between the candidate node of the traversal and the node of the previous traversal; and detecting whether the candidate node of the traversal is a target node based on the filtering method of the candidate nodes of the traversal.
[0072] Specifically, for each candidate node in the traversal, the relationship type (e.g., calling, running on, or containing) of the edge between the previously traversed node and the candidate node is read from the graph structure information. If the relationship type is a horizontal call (e.g., a user calling a gateway or a gateway calling an order service), the filtering method is horizontal filtering; if the relationship type is a vertical relationship (running on or containing, e.g., the order service runs on a container), the filtering method is vertical filtering. Different filtering methods correspond to completely different validation rules, and only candidate nodes that pass the validation of the corresponding rules can be determined as target nodes. For example, the nodes traversed in the previous iteration are: N002 (Gateway_Svc, Gateway Service); the candidate nodes traversed are: N003 (Order_Svc, Order Service) and N005 (Container_01, Container); edge attribute information: the edge E002 between N002 and N003 has a horizontal call relationship type; the edge E012 between N002 and N005 has a vertical run relationship type. Since the relationship type of the edge E002 of candidate node N003 is horizontal call, the filtering method is horizontal filtering. Since the relationship type of the edge E012 of candidate node N005 is vertical run, the filtering method is vertical filtering.
[0073] By considering the edge attributes between each candidate node in the traversal and the nodes in the previous traversal, the selection method for the candidate nodes is determined. Based on the selection method, it is checked whether the candidate node is the target node. Different selection methods are applied to different nodes, which improves the accuracy of node selection. Different nodes correspond to different selection methods, which refines the selection steps and improves the accuracy of node selection.
[0074] Optionally, depending on the filtering method of the traversed candidate nodes, it is possible to detect whether the traversed candidate nodes are target nodes, including: if the filtering method is horizontal filtering, it is possible to detect whether the traversed candidate nodes are target nodes based on the number of horizontal traversal calls of the traversed candidate nodes; if the filtering method is vertical filtering, it is possible to detect whether the traversed candidate nodes are target nodes based on the traversal detection results corresponding to the traversed candidate nodes.
[0075] Specifically, from the graph structure information, the relationship type (such as call, run in, or contain) of the edges between the previously traversed nodes and the candidate nodes is read. If the relationship type is a horizontal call, the filtering method is horizontal filtering; if the relationship type is a vertical relationship, the filtering method is vertical filtering. The detection rules for horizontal filtering (corresponding to horizontal call relationships) are "call count constraints and loop constraints". The "used call count" of the candidate node is extracted; the upper limit of the call count (e.g., 1 time) is extracted; if the candidate node does not appear in the "set of visited nodes" of the current path; the call count of the candidate node + 1 ≤ the upper limit of the call count (not exceeded); if both conditions are met, the candidate node is the target node; if either condition is not met, it is a non-target node. The detection rules for vertical filtering (corresponding to vertical relationships) verify "reverse traversal constraints and loop constraints" and extract "direction constraints" from edge attributes (such as prohibiting reverse traversal in vertical relationships); verify two core conditions (which must be met simultaneously): Condition 1: The candidate node does not appear in the "visited node set" of the current path; Condition 2: The current traversal direction is the data outflow direction; if both conditions are met, the candidate node is the target node; if either condition is not met, the candidate node is not the target node.
[0076] If the filtering method is horizontal, the system checks whether the candidate node is the target node based on the number of horizontal traversal calls. If the filtering method is vertical, the system checks whether the candidate node is the target node based on the traversal detection result corresponding to the candidate node. Different target node determination methods are used for different nodes, which improves the accuracy of target node determination.
[0077] Optionally, before detecting whether a candidate node is the target node based on the number of horizontal traversal calls of the candidate nodes, the method further includes: determining the first number of calls to the candidate node based on the edge attribute information between the candidate node and the node in the previous traversal; obtaining the node corresponding to the data outflow edge of the candidate node and the edge attribute information of the data outflow edge of the candidate node; comparing the node corresponding to the data outflow edge with the node in the previous traversal to determine the node comparison result; determining the second number of calls to the candidate node based on the node comparison result and the edge attribute information of the data outflow edge; and calculating the number of horizontal traversal calls to the candidate node based on the first number of calls and the second number of calls.
[0078] Specifically, the edge attribute information of the edges between the "previous traversal node and the candidate node" is extracted. If the candidate node does not appear in the called set, and the previous traversal node horizontally calls the candidate node, then the first call count of the candidate node is 1. From the graph structure information, the data flow outgoing edges starting from the "current candidate node" are extracted. Two key pieces of information are extracted from the edges simultaneously: the endpoint node corresponding to the outgoing edge (the downstream node of the candidate node); and the edge attribute information of the outgoing edge (focusing on the "relationship type"). The downstream of the candidate node is checked for loops. For each extracted "outgoing edge endpoint node," a comparison is performed: its node ID name is precisely compared with the ID name of the "previous traversal node." If the results are consistent, it means that the downstream of the candidate node directly points to the "previous traversal node," triggering a loop, and the second call count is 0. If the results are inconsistent, there is no loop, and the candidate node horizontally calls its downstream node, and the second call count is 1. The core of calculating the horizontal traversal call count of the candidate node is the sum of the "first call count" and the "second call count."
[0079] The first call count of a candidate node is determined based on the edge attribute information between the candidate node and the node in the previous traversal. The node corresponding to the data outflow edge of the candidate node and the edge attribute information of the data outflow edge of the candidate node are obtained. The node corresponding to the data outflow edge is compared with the node in the previous traversal to determine the comparison result. Based on the comparison result and the edge attribute information of the data outflow edge, the second call count of the candidate node is determined. Based on the first and second call counts, the horizontal traversal call count of the candidate node is calculated. Multidimensional constraints are used to determine the horizontal traversal count of the candidate node, thereby determining whether a cycle exists in the path and improving the accuracy of path determination.
[0080] Optionally, before detecting whether a candidate node is a target node based on the traversal detection result corresponding to the candidate node, the method further includes: detecting whether a candidate node has a traversal identifier; when a traversal identifier exists, not determining the candidate node as a target node; when no traversal identifier exists, determining the candidate node as a target node; and adding a traversal identifier to the target node.
[0081] Specifically, the process reads all status flags of the candidate nodes currently being traversed; checks if they contain a preset "traversal flag"; if a traversal flag exists (visited), it does not exist (unvisited). When no traversal flag exists: the candidate node has not been visited by the current path, there is no risk of a loop, and it is identified as the target node; when a traversal flag exists: the candidate node has been visited by the current path, triggering a loop rule, and it is not identified as the target node (directly removed). A preset traversal flag is added to the attribute set of the candidate nodes "identified as target nodes": the flag must be bound to the current path (traversal flags for different paths are independent to avoid cross-path interference). When a path traversal is completed (reaching the endpoint or terminating the traversal), the traversal flags of all nodes in that path must be cleared; this prevents flag residue from causing misjudgments in subsequent new path traversals (e.g., if path A is marked N002, path B needs to re-check when traversing N002).
[0082] The process involves checking if a traversal identifier exists for candidate nodes. If a traversal identifier exists, the candidate node is not designated as the target node. If no traversal identifier exists, the candidate node is designated as the target node. A traversal identifier is added to the target node to avoid repeatedly traversing the same node.
[0083] Optionally, determining at least one node sequence based on the traversal status of each candidate node and the current node information further includes: determining whether the path information of the candidate sequence satisfies the path constraint conditions; determining whether the path information of the candidate sequence satisfies the path constraint conditions includes: determining the candidate path length and candidate path duration corresponding to each candidate sequence based on the path information corresponding to each candidate sequence; obtaining the path length threshold and duration threshold; filtering the candidate path length and candidate path duration corresponding to each candidate sequence based on the path length threshold and duration threshold, and detecting whether the path information of the candidate sequence satisfies the path constraint conditions.
[0084] Specifically, calculate the length of the alternative path using the formula: Alternative path length = number of nodes in the alternative sequence – 1. Example: Alternative sequence [N001, N002, N003, N005], number of nodes = 4, length = 3. Calculate the duration of the alternative path by traversing the associated edges of each pair of adjacent nodes in the alternative sequence, reading the “interaction time” from the edge attributes and accumulating it: Formula: Alternative path duration = time spent on edge 1 + time spent on edge 2 + … + time spent on edge n. Example: In the sequence, edge E001 (10ms) + E002 (20ms) + E005 (5ms), duration = 35ms. Obtain path length and duration thresholds. Example configuration: path length threshold = 6 (maximum 7 nodes), duration threshold = 80ms. For each candidate sequence, perform "dual threshold verification," requiring both conditions to be met simultaneously to satisfy the constraints: Length verification: candidate path length ≤ path length threshold; Duration verification: candidate path duration ≤ duration threshold. If either condition is not met, the path information does not meet the constraints; if both conditions are met, the path information meets the constraints. If the path information meets the constraints: retain the candidate sequence; if the path information does not meet the constraints: trigger the logic to "delete the candidate sequence and its corresponding target node," and the candidate sequence will no longer participate in the determination of subsequent node sequences.
[0085] By determining the path length and duration of each candidate sequence based on the path information corresponding to each candidate sequence, a path length threshold and a duration threshold are obtained. Based on the path length threshold and duration threshold, the path length and duration of each candidate sequence are filtered to check whether the path information of the candidate sequence meets the path constraints. Paths can be filtered through multi-dimensional data to improve the accuracy of path determination.
[0086] Example 3
[0087] Figure 3 This is a schematic diagram of a path generation device according to Embodiment 3 of the present invention. This embodiment of the present invention is applicable to path generation, and the device can execute a path generation method. The device can be implemented in hardware and / or software.
[0088] See Figure 3 The path generation device shown includes: an information acquisition module 301, a node acquisition module 302, a candidate point determination module 303, a sequence determination module 304, and a path determination module 305, wherein...
[0089] The information acquisition module 301 is used to acquire the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge.
[0090] The node acquisition module 302 is used to acquire the path start node and the path end node;
[0091] The candidate point determination module 303 is used to determine at least one candidate node to be traversed, starting from the path start node and based on the data flow direction.
[0092] The sequence determination module 304 is used to determine at least one node sequence based on the traversal status of each candidate node and the current node information.
[0093] The path determination module 305 is used to determine the target path based on the path start node, the path end node, and the sequence of nodes.
[0094] The technical solution of this invention obtains graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge. It obtains the path start node and the path end node. Starting from the path start node, it determines at least one candidate node to be traversed based on the data flow direction. Based on the traversal status of each candidate node and the current node information, it determines at least one node sequence. Based on the path start node, the path end node, and each node sequence, it determines the target path. By determining the target path through multi-dimensional data, the accuracy of path generation is improved.
[0095] Optionally, the sequence determination module 304 includes:
[0096] The node filtering unit is used to determine at least one target node among the candidate nodes in each traversal based on the traversal status of each traversal.
[0097] The information determination unit is used to generate candidate sequences corresponding to each target node and path information of the candidate sequences based on each target node.
[0098] The sequence filtering unit is used to determine the candidate sequence to which the target node belongs as the node sequence when the target node is the end node of the path;
[0099] The information judgment unit is used to delete the candidate sequence and the target node corresponding to the candidate sequence when the path information of the candidate sequence does not meet the path constraint conditions.
[0100] The node update unit is used to obtain at least one candidate node corresponding to the data flow outgoing edge of the remaining target node that is different from the path endpoint node, update the traversed candidate nodes, determine at least one target node among the traversed candidate nodes, and update the candidate sequence corresponding to each target node and the path information of each candidate sequence.
[0101] Optional, node filtering units include:
[0102] The method determines the sub-unit, which is used to determine the selection method of candidate nodes for each traversal based on the edge attribute information between the candidate node and the node of the previous traversal.
[0103] The target point determination sub-unit is used to detect whether a candidate node being traversed is the target node, based on the selection method of the candidate nodes being traversed.
[0104] Optional, the target point determination sub-unit is specifically used for:
[0105] If the filtering method is horizontal filtering, the number of horizontal traversal calls of the candidate nodes is used to check whether the candidate node is the target node.
[0106] If the filtering method is vertical filtering, the traversal of candidate nodes is determined based on the traversal detection results corresponding to the traversed candidate nodes to determine whether the traversed candidate nodes are the target nodes.
[0107] Optionally, the target point determination sub-unit is also specifically used for:
[0108] Before checking whether a candidate node is the target node based on the number of horizontal traversal calls of the candidate node, the first call count of the candidate node is determined based on the edge attribute information between the candidate node and the node in the previous traversal.
[0109] Get the node corresponding to the data outflow edge of the traversed candidate node and the edge attribute information of the data outflow edge of the traversed candidate node;
[0110] Compare the nodes corresponding to the data outflow edges with the nodes from the previous iteration to determine the comparison results.
[0111] Based on the node comparison results and the edge attribute information of the data outflow edges, determine the second call count for the candidate nodes to be traversed;
[0112] The number of horizontal traversal calls for the candidate nodes is calculated based on the first and second call counts.
[0113] Optionally, the target point determination sub-unit is also specifically used for:
[0114] Before checking whether a candidate node is the target node based on the traversal detection result corresponding to the candidate node, check whether the candidate node has a traversal identifier.
[0115] When a traversal identifier exists, the candidate node to be traversed is not determined as the target node;
[0116] When there is no traversal identifier, the candidate node to be traversed is determined as the target node;
[0117] Add a traversal marker to the target node.
[0118] Optionally, the sequence determination module 304 further includes:
[0119] The condition judgment unit is used to determine whether the path information of the candidate sequence meets the path constraint conditions;
[0120] The conditional judgment unit is specifically used for:
[0121] Based on the path information corresponding to each candidate sequence, determine the candidate path length and candidate path duration for each candidate sequence;
[0122] Obtain the path length threshold and time threshold;
[0123] Based on the path length threshold and duration threshold, the candidate path length and duration corresponding to each candidate sequence are filtered to check whether the path information of the candidate sequence meets the path constraint conditions.
[0124] The path generation apparatus provided in this embodiment of the invention can execute the path generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the path generation method.
[0125] Example 4
[0126] Figure 4 A schematic diagram of the structure of a path generation device 400 that can be used to implement embodiments of the present invention is shown.
[0127] like Figure 4 As shown, the path generation device 400 includes at least one processor 401 and a memory, such as a read-only memory (ROM) 402 and a random access memory (RAM) 403, communicatively connected to the at least one processor 401. The memory stores computer programs executable by the at least one processor. The processor 401 can perform various appropriate actions and processes based on the computer program stored in the ROM 402 or loaded into the RAM 403 from storage unit 408. The RAM 403 may also store various programs and data required for the operation of the path generation device 400. The processor 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0128] Multiple components in the path generation device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, optical disk, etc.; and a communication unit 409, such as a network card, modem, wireless transceiver, etc. The communication unit 409 allows the path generation device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0129] Processor 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 401 performs the various methods and processes described above, such as path generation methods.
[0130] In some embodiments, the path generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed onto the path generation device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by processor 401, one or more steps of the path generation method described above may be performed. Alternatively, in other embodiments, processor 401 may be configured to execute the path generation method by any other suitable means (e.g., by means of firmware).
[0131] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0132] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0133] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0134] To provide user interaction, the systems and techniques described herein can be implemented on a path generation device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the path generation device. Other types of devices can also be used to provide user interaction; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0135] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0136] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system. It addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability.
[0137] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0138] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A path generation method, characterized in that, The method includes: Obtain the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge. Get the starting node and ending node of the path; Starting from the starting node of the path, determine at least one candidate node to be traversed based on the data flow direction; Based on the traversal status of each candidate node and the current node information, at least one node sequence is determined; The target path is determined based on the path start node, the path end node, and the sequence of nodes.
2. The method according to claim 1, characterized in that, The step of determining at least one node sequence based on the traversal status of each candidate node and the current node information includes: Based on the traversal of each candidate node, at least one target node is determined from each candidate node. Based on each target node, generate a candidate sequence corresponding to each target node, as well as path information for the candidate sequence; When the target node is the end point of the path, the candidate sequence to which the target node belongs is determined as the node sequence; When the path information of the candidate sequence does not meet the path constraint conditions, delete the candidate sequence and the target node corresponding to the candidate sequence. For the remaining target nodes that are different from the path endpoint node, obtain at least one candidate node corresponding to the data outflow edge of the remaining target node that is different from the path endpoint node, update the traversed candidate nodes, determine at least one target node among the traversed candidate nodes, and update the candidate sequence corresponding to each target node and the path information of each candidate sequence.
3. The method according to claim 2, characterized in that, The step of determining at least one target node from among the candidate nodes traversed based on the traversal status of each candidate node includes: For each candidate node in the traversal, the selection method for the candidate node in the traversal is determined based on the edge attribute information between the candidate node in the traversal and the node in the previous traversal. Based on the filtering method of the traversed candidate nodes, it is determined whether the traversed candidate nodes are the target nodes.
4. The method according to claim 3, characterized in that, The step of detecting whether a candidate node is a target node based on the filtering method of the traversed candidate nodes includes: If the filtering method is horizontal filtering, the number of horizontal traversal calls of the traversed candidate nodes is used to detect whether the traversed candidate nodes are the target nodes. If the filtering method is vertical filtering, the candidate node being traversed is checked to see if it is the target node based on the traversal detection result corresponding to the candidate node being traversed.
5. The method according to claim 4, characterized in that, Before detecting whether a candidate node is the target node based on the number of horizontal traversal calls of the candidate nodes, the method further includes: The first call count of the candidate node is determined based on the edge attribute information between the candidate node being traversed and the node being traversed in the previous traversal. Obtain the node corresponding to the data outflow edge of the traversed candidate node and the edge attribute information of the data outflow edge of the traversed candidate node; The nodes corresponding to the data outflow edges are compared with the nodes from the previous traversal to determine the node comparison results; Based on the node comparison results and the edge attribute information of the data outflow edge, determine the second number of calls for the candidate nodes to be traversed; The number of horizontal traversal calls for the candidate nodes is calculated based on the first number of calls and the second number of calls.
6. The method according to claim 4, characterized in that, Before detecting whether a candidate node is a target node based on the traversal detection result corresponding to the traversed candidate nodes, the method further includes: Check whether the candidate nodes being traversed have traversal identifiers; When a traversal identifier exists, the candidate node being traversed is not determined as the target node; When there is no traversal identifier, the candidate node to be traversed is determined as the target node; Add a traversal identifier to the target node.
7. The method according to claim 2, characterized in that, Also includes: Determine whether the path information of the candidate sequence meets the path constraint conditions; The step of determining whether the path information of the candidate sequence meets the path constraint conditions includes: Based on the path information corresponding to each of the candidate sequences, determine the length and duration of each candidate path. Obtain the path length threshold and time threshold; Based on the path length threshold and duration threshold, the candidate path length and duration corresponding to each candidate sequence are filtered, and it is detected whether the path information of the candidate sequence meets the path constraint conditions.
8. A path generation device, characterized in that, The device includes: The information acquisition module is used to acquire the graph structure information corresponding to the directed graph to be processed. The graph structure information includes at least one graph node, at least one directed edge corresponding to each graph node, and edge attribute information corresponding to each directed edge. The node acquisition module is used to acquire the starting node and ending node of a path; The candidate point determination module is used to determine at least one candidate node to be traversed, starting from the starting node of the path, based on the data flow direction. The sequence determination module is used to determine at least one node sequence based on the traversal status of each candidate node and the current node information. The path determination module is used to determine the target path based on the path start node, the path end node, and the sequence of nodes.
9. A path generation device, characterized in that, The path generation device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the path generation method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the path generation method according to any one of claims 1-7.
