Graph node hybrid traversal ordering method and system for workflow visualization

By combining depth-first traversal with throttling and branch backflow prevention control mechanisms, the problems of node duplication and branch data backflow in workflow visualization are solved, achieving efficient and accurate node sorting and clear layout, meeting real-time response requirements.

CN122114587BActive Publication Date: 2026-07-03SHENZHEN FENXIANG INTERNET TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN FENXIANG INTERNET TECH CO LTD
Filing Date
2026-04-28
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing technologies in workflow visualization scenarios suffer from issues such as redundant node processing, backflow of branch data, sorting results that do not conform to visual hierarchy, and chaotic layout. In particular, they are difficult to achieve real-time response performance under complex branch structures.

Method used

It employs a depth-first traversal combined with a throttling and branch anti-backflow control mechanism, detects duplicate nodes through a hash set, delays the merging of nodes, and executes a secondary sorting algorithm based on node coordinates to ensure that nodes are sorted according to visual habits.

Benefits of technology

It achieves zero duplicate processing and zero branch backflow, improves sorting accuracy and layout clarity, meets the real-time layout calculation requirements of large-scale workflow graphs, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122114587B_ABST
    Figure CN122114587B_ABST
Patent Text Reader

Abstract

The application discloses a kind of graph node mixed traversal sorting method and system of workflow visualization, it is related to data visualization technical field.The method includes: obtaining workflow graph and initializing data structure;From start node, perform depth-first mixed traversal, repeat detection and block to node in the traversal process;After traversal is completed, the coordinates of each node are calculated, and the secondary sorting is executed to the node list, finally, continuous serial number is distributed and the sorting result is output.The application realizes zero repeat processing by throttling blocking mechanism, realizes zero data backflow by branch anti-backflow control mechanism, improves the sorting accuracy by secondary sorting algorithm, has excellent real-time response performance, and can be widely applied in workflow visualization, ETL task arrangement, low-code development platform and other fields.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data visualization technology, and more specifically, to a method and system for traversing and sorting graph nodes in workflow visualization scenarios, particularly a hybrid traversal and sorting method and system that combines depth-first traversal and breadth-first sorting features and introduces a throttling blocking mechanism and a branch anti-backflow control mechanism. Background Technology

[0002] In applications such as workflow visualization, flowchart editing, data lineage analysis, ETL task orchestration, and low-code development platforms, it is necessary to convert data models with tree or graph structures (usually represented as directed acyclic graphs) into two-dimensional visual layouts. The core of this conversion process lies in traversing and sorting the graph nodes, and the output directly determines the readability of the visual layout, user cognitive efficiency, and system interaction experience. However, existing technologies still have several unresolved technical shortcomings when addressing these issues.

[0003] Currently, the mainstream technical solutions for sorting nodes in graph structures mainly include depth-first traversal-based sorting methods, breadth-first traversal-based sorting methods, and some hybrid strategies that attempt to combine the advantages of both.

[0004] Depth-first traversal (DFS) methods recursively traverse a graph structure along its depth, outputting nodes in the order they are visited. This approach is widely used in tree structures or simple graph structures, effectively preserving the depth dependencies between nodes. However, when multiple branches converge to the same node (i.e., the node's in-degree is greater than 1), traditional DFS algorithms repeatedly visit this convergence node while traversing different branches, resulting in the same node being processed and output multiple times. This repeated processing not only increases the algorithm's time overhead, degrading the ideal linear time complexity to superlinear or even quadratic complexity, but also introduces redundant information in the output, affecting the accuracy of subsequent layout calculations. More importantly, when handling conditional branching structures, DFS may process one branch and output the convergence node before processing another branch, causing the convergence node's output position to appear before some branch nodes. This creates a visually backward flow of data, contradicting the typical user's perception of unidirectional data flow from top to bottom or left to right.

[0005] Breadth-first traversal (BFS) methods visit nodes level by level, outputting nodes in order of their distance from the starting node. This approach ensures nodes are clustered hierarchically, forming a relatively neat row structure. However, BFS exhibits significant drawbacks when handling complex branching structures: When conditional branches exist, nodes in the two branches may be distributed at the same or different levels. BFS cannot identify the correspondence between branches and merging nodes, easily leading to cross-sorting of nodes from different branches and resulting in a chaotic layout. When multiple branches converge on the same merging node, BFS processes the node immediately upon reaching its level, without considering whether all its predecessor nodes have been processed. This can cause the merging node to be output prematurely before some of its dependent branch nodes have been output, disrupting the visual representation of dependencies. In complex scenarios such as nested or parallel branches, the output of BFS struggles to maintain logical coherence within branches, making it difficult for users to trace the complete path of a single branch.

[0006] Some existing technologies attempt to employ a hybrid strategy: depth-first traversal for construction and breadth-first traversal for output. This aims to balance the integrity of depth relationships with the clarity of hierarchical relationships. However, these hybrid solutions still suffer from the following technical shortcomings: First, they lack effective marking and blocking mechanisms for processed nodes, and the problem of the same node being accessed multiple times remains unresolved; second, they lack mechanisms for identifying conditional branch structures and for delayed processing of merged nodes, and the problem of branch data backflow persists; third, the sorting granularity is coarse, only sorting by hierarchy without fine-grained positional sorting of nodes within the same level, resulting in a mismatch between the output order and the visual layout.

[0007] Existing technologies, represented by publicly available documents CN115328626A (A Distributed Task Scheduling Method for Big Data Engines Supporting Stream-Batch Integration) and CN113254010A (A Visual DAG Workflow Task Scheduling System and Its Operation Method), primarily focus on the architecture design of task scheduling systems, multi-cluster resource management, workflow instance backtracking and control, front-end drag-and-drop components, and back-end cluster architecture. While these technologies involve the construction and application of directed acyclic graphs (DAGs) in workflows, their core solutions lie in the functional implementation at the task scheduling level, rather than the traversal and sorting algorithms for graph nodes themselves. In other words, they do not address the following technical issues: the problem of repetitive node processing during graph traversal, the data backflow problem in conditional branching structures, the problem of fine-grained sorting based on coordinates, and the corresponding efficient data structure design and algorithm optimization. Therefore, these existing technologies cannot provide an effective solution to the node layout and sorting problem in workflow visualization scenarios.

[0008] In summary, existing technologies have the following unresolved technical shortcomings in graph node sorting for workflow visualization:

[0009] First, there's the issue of duplicate node processing. In graph structures where multiple branches converge on the same node, repeatedly accessing and processing that same node increases algorithm time complexity, leads to redundant output, and causes system response delays. In typical workflow graphs, nodes traditionally traversed using depth-first search are often processed repeatedly.

[0010] Second, there's the issue of backflow of branch data. In conditional branching structures, existing algorithms cannot identify the correspondence between branches and merging nodes. Merging nodes may be prematurely output before all branch nodes have been processed, causing visual confusion in data flow, violating the unidirectional data flow principle, and increasing the cognitive burden on users. Backflow of branches can occur in workflow graphs containing conditional branching structures.

[0011] Third, the sorting results do not conform to visual hierarchy. The output order of existing algorithms mainly depends on the traversal path, without fully considering the hierarchical and horizontal positional relationships of nodes, and cannot guarantee that nodes are output according to visual habits. Traditional algorithms have low sorting accuracy in complex graph structures.

[0012] Fourth, the problem of chaotic layout under complex branching structures. In complex graph structures such as nested branches, multi-level branches, or parallel branches, existing algorithms struggle to balance the neatness of the global hierarchy with the logical coherence within branches, resulting in a significant decrease in the readability of the visual layout.

[0013] Fifth, the problem of insufficient real-time response performance. As the scale of workflows increases, existing algorithms, due to repetitive processing and unreasonable data structure design, struggle to achieve real-time layout calculations for large-scale graphs (more than 1,000 nodes) in interactive scenarios, affecting user experience.

[0014] Therefore, the present invention provides a graph node hybrid traversal sorting method and system that can simultaneously solve the above-mentioned technical problems. Summary of the Invention

[0015] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for hybrid traversal and sorting of graph nodes in workflow visualization. This method and system solves the technical problems existing in the existing graph traversal and sorting algorithms, such as repeated processing of nodes, backflow of branch data, sorting results that do not conform to the visual hierarchy, chaotic layout under complex branch structures, and insufficient real-time response performance. This invention achieves efficient, accurate, and logically clear workflow graph node layout and sorting.

[0016] To achieve the above objectives, this invention provides a hybrid traversal and sorting method for workflow visualization of graph nodes. This method constructs a node relationship graph through depth-first traversal, embeds throttling and blocking mechanisms and branch backflow prevention control mechanisms during the traversal process, and executes a secondary sorting algorithm based on node coordinates after traversal, ultimately outputting a node sorting sequence that meets visual hierarchy requirements. Specifically:

[0017] A method for hybrid traversal and sorting of graph nodes in workflow visualization, comprising the following steps:

[0018] Step S1: Obtain the workflow graph, which includes a set of nodes and a set of directed edges;

[0019] Step S2: Initialize the set of processed nodes, the branch merge mapping table, and the node output list;

[0020] Step S3: Perform a depth-first mixed traversal on the nodes;

[0021] Step S4: Traverse the branch merge mapping table and add all deferred processing merge nodes to the node output list;

[0022] Step S5: Calculate the coordinates for each node in the node output list;

[0023] Step S6: Perform a secondary sort on the node output list;

[0024] Step S7: Assign consecutive serial numbers to the sorted list of nodes and output the sorting result.

[0025] Furthermore, the depth-first hybrid traversal described in step 3 includes:

[0026] Step S31: Determine whether the currently traversed node exists in the set of processed nodes. If it exists, skip the current node and return; if it does not exist, add the currently traversed node to the set of processed nodes.

[0027] Step S32: If the type of the currently traversed node is a condition node, then check whether the two branches of the condition node converge at the same merge node. If so, store the mapping relationship in the branch merge mapping table and mark the merge node as a delayed processing node.

[0028] Step S33: If the type of the currently traversed node is a merged node and it is marked as a delayed processing node, then the currently traversed node will not be added to the node output list for the time being, and will be added after all predecessor nodes have been processed; otherwise, the currently traversed node will be added to the node output list.

[0029] Step S34: Recursively traverse all child nodes of the current node.

[0030] Furthermore, in step S31, a throttling blocking mechanism is adopted, and the duplicate detection of the throttling blocking mechanism is implemented through a hash set, so that the current traversed node satisfies:

[0031] ,like If so, then skip the processing;

[0032] And ultimately satisfied ,in:

[0033] It is a node. It is the identifier of the node. It is a collection of nodes in a workflow diagram. It is the set of processed nodes. This is the actual set of nodes that are processed, with each node being processed only once.

[0034] Furthermore, in step S32, a branch anti-backflow control mechanism is adopted to make the condition node The branch merging mapping relationship satisfies:

[0035]

[0036] in, It is a branch merge mapping table. It is a condition node. It is the identifier of the node. To merge nodes, and These are the end nodes of the two branches;

[0037] The merged node is output when all its predecessor nodes have been processed.

[0038] Furthermore, the sub-step of calculating node coordinates in step S5 includes:

[0039] Based on node depth Calculate the ordinate ( ):

[0040]

[0041] Based on the topological order within the same depth layer ( Calculate the x-coordinate ( ):

[0042]

[0043] in, The initial ordinate, For the spacing between levels, The starting x-coordinate, This represents the horizontal spacing between nodes.

[0044] Furthermore, step S6 includes first defining the sorting rules:

[0045]

[0046] in, Output any two nodes in the node list. For sorting rules;

[0047] Then, according to the sorting rules, priority is given to... Sort by coordinates in ascending order. When coordinates are the same, Sort by coordinates in ascending order.

[0048] Furthermore, the workflow graph is a directed acyclic graph;

[0049] The types of nodes include start nodes, normal nodes, condition nodes, merge nodes, and end nodes;

[0050] The condition node is used to represent a branch decision point, which has two branch outputs;

[0051] The merge node is used to represent the convergence point of multiple branches, and it has at least two predecessor nodes.

[0052] Furthermore, it also includes an exception handling mechanism: when a circular dependency is detected in the workflow graph, the traversal is terminated; when two branches of a condition node are not found to converge at the same merge node, the branch anti-backflow control is skipped and the node is treated as a normal node.

[0053] Another aspect of the present invention provides a hybrid traversal and sorting system for graph nodes in workflow visualization, comprising:

[0054] The workflow parsing module is used to obtain and parse workflow diagrams;

[0055] The hybrid traversal engine is used to perform depth-first hybrid traversal, and calls the throttling blocking controller and the branch anti-backflow controller during the traversal process;

[0056] The throttling and blocking controller is used to maintain the set of processed nodes and to perform repeated detection and blocking of nodes at the node processing entry point;

[0057] The branch anti-backflow controller is used to maintain the branch merging mapping table, identify conditional branch structures, and delay the processing of merging nodes;

[0058] The coordinate calculation and sorting module is used to calculate the coordinates of nodes, perform secondary sorting, and assign consecutive serial numbers;

[0059] The visualization output module is used to output the sorted list of nodes and refresh the visualization interface.

[0060] Furthermore, the throttling blocking controller uses a hash table to implement the set of processed nodes, and determines whether a node has been processed before processing it.

[0061] When the branch anti-backflow controller detects that two branches of a condition node converge at the same merging node, it performs delayed processing; after traversal is completed, it determines that when all predecessor nodes of the merging node are already in the set of processed nodes, it adds the merging node to the output list.

[0062] Compared with the prior art, the present invention has the following beneficial effects:

[0063] First, it achieves zero duplicate processing rate. This invention introduces a throttling blocking mechanism and uses a hash set. By performing O(1) time-complexity duplicate detection at the node processing entry point, the problem of duplicate node processing is fundamentally eliminated. Each node is processed only once, the duplicate processing rate is 0%, and the overall time complexity of the algorithm is strictly controlled within a certain time complexity. Scale. Experimental data shows that for a workflow graph with 1000 nodes, this invention achieves a 0% duplication rate.

[0064] Second, it achieves zero branch backflow rate. This invention introduces a branch backflow prevention control mechanism, establishes a mapping relationship between condition nodes and merging nodes, and delays the processing of merging nodes, fundamentally eliminating the branch data backflow problem. For any condition node... and its corresponding merge nodes ,satisfy This ensures unidirectional data flow. In workflow diagrams containing conditional branching structures, this invention achieves a 0% backflow rate.

[0065] Third, sorting accuracy. This invention achieves precise arrangement of nodes in a visual order of "from top to bottom and from left to right" through coordinate calculation and a two-level sorting algorithm. The sorting rule prioritizes sorting by vertical coordinate. Sort in ascending order, and sort by x-axis when the y-axis is the same. Arranging in ascending order ensures that the output sequence fully conforms to the user's visual habits, improving the readability of the visual layout.

[0066] Fourth, it achieves a clear layout for complex branching structures. This invention achieves a clear layout for complex branching structures by organically combining depth-first traversal with secondary sorting. The characteristics of depth-first traversal ensure that nodes within the same branch remain continuous in the output sequence, while the secondary sorting algorithm aligns nodes from different branches hierarchically, ensuring a neat and orderly overall layout. Tests show that the accuracy of identifying branching structures is improved while the cognitive time is reduced.

[0067] Fifth, it enables real-time layout of large-scale workflows. This invention achieves real-time layout computation capabilities for large-scale workflow graphs through algorithm optimization and efficient data structure design. The overall time complexity of the algorithm is O(n log n). The space complexity is For a large-scale workflow graph containing 1200 nodes and 1500 edges, the average processing time of this invention is lower than that of traditional methods, with low memory usage, meeting the performance requirements of real-time interactive scenarios (≤200ms).

[0068] In summary, this invention achieves the technical effects of zero duplicate processing, zero branch backflow, high sorting accuracy, clear complex structure layout, and excellent real-time performance through the synergistic effect of throttling blocking mechanism, branch anti-backflow control mechanism, coordinate calculation and secondary sorting algorithm, thereby improving the user experience and system performance of workflow visualization tools. Attached Figure Description

[0069] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the specific embodiments will be briefly described below. It should be noted that the following drawings are merely illustrative diagrams of the present invention, used to assist in understanding the technical solution, and not to limit the scope of the present invention.

[0070] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0071] Figure 1 A schematic diagram of the architecture of a workflow visualization graph node hybrid traversal and sorting system provided in an embodiment of the present invention;

[0072] Figure 2 A flowchart of the depth-first hybrid traversal method provided in an embodiment of the present invention;

[0073] Figure 3 A flowchart illustrating the collaborative workflow of the throttling blocking mechanism and the branch anti-backflow control mechanism provided in this embodiment of the invention;

[0074] Figure 4 A flowchart of the coordinate calculation and secondary sorting method provided in the embodiments of the present invention;

[0075] Figure 5 This is a schematic diagram illustrating the node sorting effect of a specific workflow diagram provided in an embodiment of the present invention. Detailed Implementation

[0076] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0077] This invention provides a hybrid traversal and sorting method for workflow visualization of graph nodes. This method constructs a node relationship graph through depth-first traversal, embeds throttling and blocking mechanisms and branch backflow prevention control mechanisms during the traversal process, and executes a secondary sorting algorithm based on node coordinates after traversal, ultimately outputting a node sorting sequence that meets visual hierarchy requirements. The method includes the following steps:

[0078] Step S1: Obtain the workflow diagram The workflow graph includes a set of nodes. and the set of directed edges ,Right now, For a set of nodes, It is a set of directed edges;

[0079] Step S2: Initialize the set of processed nodes ( The initialization mentioned above refers to performing the empty set ( Assigned step: Similarly, initialize the branch merge mapping table. ),make: and initialize the node output list ( );

[0080] Step S3: Perform a depth-first mixed traversal of the nodes in the workflow graph from step S1, starting from the initial set of nodes in the workflow graph. Begin executing a depth-first hybrid traversal, where Represents a node The depth-first hybrid traversal, considering the in-degree, includes the following sub-steps:

[0081] Step S31: For the current node being traversed (i.e., the current traversed node) ,judge Does it exist in middle, It is this node If an identifier exists, skip the current node and return; otherwise, leave the node as is. join in middle;

[0082] Preferably, step S31 employs a throttling blocking mechanism, using a hash set to achieve duplicate detection, thus making the time complexity of the throttling blocking mechanism O(n log n). And make the currently traversed node satisfy:

[0083] ,like If so, then skip the processing;

[0084] And ultimately satisfied ,

[0085] in, It is a node. It is the identifier of the node. This is the actual set of nodes that are processed, with each node being processed only once.

[0086] Step S32: If the currently traversed node Types ( If a condition node is selected, then it checks whether the two branches of that condition node converge to the same merge node. If so, then the mapping relationship will be... Store in the branch merge mapping table ( ), and merge the nodes Marked as a delayed processing node;

[0087] Preferably, in the branch anti-backflow control mechanism, the condition node The branch merging mapping relationship satisfies:

[0088]

[0089] in To merge nodes, and These are the end nodes of the two branches; the merged node Added to the node output list The conditions are:

[0090]

[0091] in, This indicates the conditions for merging output nodes. Indicates merged nodes The set of all predecessor nodes, As a predecessor node, This is the identifier for the node. The set of nodes that have been processed. That is, if and only if nodes are merged. The merged node is output only when all predecessor nodes have been processed, meaning all predecessor nodes already exist in the set of processed nodes. (Nodes to be merged soon) Add to node output list ).

[0092] Step S33: If the current node Types ( ) is a merged node and If a node is marked as a delayed processing node, it will not be processed for the time being. Add to node output list Wait until all predecessor nodes of the merge node have been processed before adding it; otherwise, Add to node output list ;

[0093] Step S34: Recursively traverse the current node All child nodes;

[0094] Step S4: After the depth-first mixed traversal is completed, merge the traversal branches into the mapping table. Merge all delayed processing nodes ( Add to the node output list ( );

[0095] Step S5: Output a list of nodes ( Calculate the coordinates of each node. ,in Represents a node The vertical axis reflects the level at which the node is located; Represents a node The x-coordinate reflects the horizontal position of the node within the same level;

[0096] Preferably, the node coordinates are calculated using the Dagre layout algorithm, where the ordinate... Based on node depth calculate:

[0097]

[0098] x-axis Based on topological order within the same depth layer calculate:

[0099]

[0100] in The initial ordinate, For the spacing between levels, The starting x-coordinate, This represents the horizontal spacing between nodes.

[0101] Step S6: Output a list of nodes To perform a two-level sort, first, select the sorting rule as follows:

[0102]

[0103] That is, prioritize Sort by coordinates in ascending order. When coordinates are the same, Sort by coordinates in ascending order; where, Output any two nodes in the node list. For sorting rules;

[0104] Preferably, a two-level sorting algorithm is used to arrange nodes in a visual order "from top to bottom and from left to right", assuming the following condition is met: for any two nodes ,like ,but consecutive serial numbers less than consecutive serial numbers; if and ,but consecutive serial numbers less than consecutive serial numbers.

[0105] Step S7: Assign consecutive serial numbers to the sorted list of nodes ( ),in, , , and output the sorting results.

[0106] More preferably, the workflow diagram It is a directed acyclic graph, and the node types include start node, ordinary node, condition node, merge node and termination node; among them, condition node is used to represent the branch decision point and has two branch outputs; merge node is used to represent the convergence point of multiple branches and has at least two predecessor nodes.

[0107] More preferably, the method further includes an exception handling mechanism: when a circular dependency is detected in the workflow graph, i.e., a node... If a condition node appears in its own set of predecessor nodes, the system throws a circular dependency exception and terminates the traversal; when it is detected that two branches of a condition node do not converge at the same merge node, the branch anti-backflow control is skipped and the node is treated as a normal node.

[0108] More preferably, in step S3, the recursion depth of the depth-first hybrid traversal does not exceed the maximum depth of the workflow graph. The overall time complexity of the algorithm is The space complexity is .

[0109] More preferably, the consecutive serial numbers allocated in step S7 Used to mark the display order of nodes in the visualization interface, so that users can track the execution logic of the workflow according to the consecutive sequence number.

[0110] Another embodiment of the present invention provides a workflow visualization graph node hybrid traversal and sorting system for performing the above-described graph node hybrid traversal and sorting method. The system includes:

[0111] The workflow parsing module is used to obtain and parse workflow diagrams. ;

[0112] The hybrid traversal engine is used to perform depth-first hybrid traversal, and calls the throttling blocking controller and the branch anti-backflow controller during the traversal process;

[0113] Throttling and blocking controllers are used to maintain the set of processed nodes. Repeated node detection and blocking are performed at the node processing entry point;

[0114] Branch backflow prevention controller, used to maintain branch merging mapping table Identify conditional branching structures and delay the processing of merged nodes;

[0115] The coordinate calculation and sorting module is used to calculate the coordinates of nodes. And perform a two-level sort, assigning consecutive serial numbers;

[0116] The visualization output module is used to output the sorted list of nodes and refresh the visualization interface.

[0117] Preferably, the throttling blocking controller uses a hash table to implement the set of processed nodes. Before processing a node, the following judgment logic is executed:

[0118] if(processedSet.has(node.id)){

[0119] return; / / Block: Skip processed nodes

[0120] }

[0121] processedSet.add(node.id); / / Mark as processed

[0122] The branch anti-backflow controller detects a condition node. The two branches converge at the same merge node. When this happens, the following delayed processing logic will be executed:

[0123] conditionMergeMap.set(c.id,{

[0124] mergeNode:m,

[0125] branchEnds:[end1,end2]

[0126] });

[0127] / / Mark m as delayed processing, no output for now

[0128] And after the traversal is complete, if and only if At that time, Add to the output list.

[0129] like Figure 1 The diagram shows the system architecture, core modules, and functions provided in this embodiment of the invention:

[0130] The system architecture is divided into a user layer, a core processing layer, a data layer, and an output layer, among which:

[0131] The user layer mainly includes a visual interactive interface, through which the workflow diagram is input and the visual rendering structure is received.

[0132] The core processing layer consists of five modules and their functions are as follows:

[0133] (a) Workflow parsing module

[0134] This module receives the workflow graph defined by the user through a visual interactive interface and parses the topology of nodes and edges. Specifically, the workflow parsing module performs the following operations:

[0135] Traverse the input workflow graph and extract the node set. and the set of directed edges ;

[0136] Assign a unique identifier to each node and determine the node type. Node types include start node, normal node, condition node, merge node, and end node;

[0137] Calculate the in-degree of each node and out-degree ;

[0138] Identify the set of starting nodes and the set of terminating nodes .

[0139] (ii) Hybrid Traversal Engine

[0140] This engine is the core control unit of the system, responsible for performing a depth-first hybrid traversal. The engine starts from the set of initial nodes. Starting from the beginning, the graph structure is recursively traversed according to the depth-first strategy, and the throttling blocking controller and the branch anti-backflow controller are called during the traversal to control node processing.

[0141] (iii) Throttling and blocking controller

[0142] The controller maintains the set of processed nodes. Implemented using a hash table Membership detection with time complexity. Its core function is to perform duplicate detection at the node processing entry point and block already processed nodes. The execution logic of the throttling and blocking controller is as follows:

[0143] function throttle(node):

[0144] if(processedSet.has(node.id)){

[0145] return false; / / Block: Node has been processed, skip.

[0146] }

[0147] processedSet.add(node.id); / / Mark as processed

[0148] return true; / / Allow further processing

[0149] (iv) Branch anti-backflow controller

[0150] This controller maintains a branch merge mapping table. This is used to store the correspondence between condition nodes and merge nodes. Its core function is to identify the conditional branch structure, delay the processing of merge nodes, and prevent data backflow. The execution logic of the branch anti-backflow controller is as follows:

[0151] function handleConditionNode(node):

[0152] / / Detect the two branches of the condition node

[0153] let branchEnds=getBranchEnds(node);

[0154] let mergeNode=getMergeNode(branchEnds);

[0155] if (mergeNode!==null){

[0156] conditionMergeMap.set(node.id,{

[0157] mergeNode: mergeNode,

[0158] branchEnds:branchEnds

[0159] });

[0160] pendingMergeSet.add(mergeNode.id); / / Mark merge nodes as pending.

[0161] }

[0162] function handleMergeNode(node):

[0163] if(pendingMergeSet.has(node.id)){

[0164] / / Delayed processing: Check if all predecessor nodes have been processed

[0165] let allPredecessorsProcessed=true;

[0166] for (let pred of node.parents){

[0167] if(!processedSet.has(pred.id)){

[0168] allPredecessorsProcessed=false;

[0169] break

[0170] }

[0171] }

[0172] if (all PredecessorsProcessed) {

[0173] pendingMergeSet.delete(node.id);

[0174] return true; / / This can output...

[0175] }

[0176] return false; / / Do not output for now

[0177] }

[0178] return true; / / Non-delayed nodes will output normally.

[0179] (v) Coordinate Calculation and Sorting Module

[0180] This module executes after the depth-first hybrid traversal is completed and is responsible for calculating the two-dimensional coordinates of each node. Then, a two-level sorting algorithm is executed to assign consecutive serial numbers.

[0181] The data layer includes: ProcessedSet (a set of processed nodes), ConditionMergeMap (a map of branch merging), EdgeList (a list of edge outputs), and NodeList (a list of node outputs).

[0182] The output layer includes a visualization output module, which receives the sorted list of nodes, calls the front-end rendering engine to refresh the user layer's visualization interface, and displays the final node layout.

[0183] like Figure 1 As shown, the workflow parsing module receives the input workflow graph, parses it, and passes it to the hybrid traversal engine. During the traversal process, the hybrid traversal engine calls the throttling blocking controller and the branch anti-backflow controller to control node processing. After the traversal is completed, the coordinate calculation and sorting module performs coordinate calculation and secondary sorting. Finally, the visualization output module outputs the sorting results and refreshes the interface.

[0184] Another embodiment of the present invention is combined with Figure 2 This paper provides a detailed explanation of the depth-first hybrid traversal method. Using a specific conditional branching structure example, the execution process of the depth-first hybrid traversal is explained in detail below. This includes core steps such as node entry processing, throttling and blocking judgment, conditional node branch detection, delayed merging of nodes, and recursive traversal of child nodes, fully demonstrating the entire process from the starting node to the end of the traversal.

[0185] Suppose the workflow diagram contains the following nodes:

[0186] Node A: Start node; Node B: Condition node; Node C: Branch 1 node (condition is true); Node D: Branch 2 node (condition is false); Node E: End node of Branch 1; Node F: End node of Branch 2; Node G: Merge node; Node H: End node

[0187] The edge relationship is: , , , , , , , .

[0188] Traversal process record:

[0189]

[0190] Key point analysis:

[0191] During the traversal process described above, when the merge node G is first visited in step 6, it is marked as deferred and not immediately added to the node output list NodeList. G is not marked as output until step 10, when all predecessor nodes (E and F) have been processed. Finally, after the traversal is complete, G is added to NodeList, ensuring that G's output position is after all branch nodes. This achieves a unidirectional data flow of "branch → merge," eliminating the data backflow phenomenon in traditional algorithms where the merge node appears before the branch node.

[0192] Another embodiment of the present invention is combined with Figure 3 The working principle of the throttling and blocking mechanism and the branch anti-backflow control mechanism is explained in detail. Figure 3 The diagram illustrates the "detection → blocking → marking" process of the throttling blocking mechanism and the "branch detection → mapping establishment → delay processing → conditional output" process of the branch anti-backflow control mechanism. The interaction between the two mechanisms during the depth-first hybrid traversal process is also shown. (The diagram includes the information provided.)

[0193] Analysis of the principles of collaborative work:

[0194] The throttling and blocking mechanism and the branch anti-backflow control mechanism work together during the depth-first mixed traversal to ensure the correctness and efficiency of node processing.

[0195] (1) The core logic of the throttling and blocking mechanism

[0196] The throttling and blocking mechanism is executed at the node processing entry point, implemented through a hash set, ensuring that each node is processed only once. Its time complexity is O(log n). The space complexity is .

[0197] (2) The core logic of the branch anti-backflow control mechanism

[0198] The branch backflow prevention control mechanism is executed at the condition node and the merge node. Its core lies in establishing a mapping relationship between the condition node and the merge node, and delaying the processing of the merge node. (Merge node) The conditions for being added to the output list are:

[0199]

[0200] That is, only if and only if merging nodes The merged node is output and added to the node output list only after all its predecessor nodes have been processed.

[0201] (3) Collaborative working mechanism

[0202] The synergistic relationship between the throttling and blocking mechanism and the branch backflow prevention control mechanism is reflected in the following aspects:

[0203] First, the throttling and blocking mechanism is executed first at the node processing entry point, ensuring that each node is processed only once, providing the correct state basis for the branch anti-backflow control mechanism.

[0204] Second, the branch anti-backflow control mechanism is executed after the throttling blocking mechanism has passed, utilizing the throttling blocking mechanism for maintenance. This determines whether all predecessor nodes of the merge node have been processed, and thus decides when to output the merge node.

[0205] Third, both share The data forms a closed-loop control chain of "labeling → detection → decision-making".

[0206] Another embodiment of the present invention is combined with Figure 4 The calculation of coordinates (assigning ordinates based on node depth and assigning abscissas based on topological order) and the steps of the two-level sorting method (first sorting by ordinates, then sorting by abscissas) are explained in detail.

[0207] (I) Coordinate Calculation Method

[0208] The coordinate calculation uses the Dagre layout algorithm, whose core idea is to transform the graph structure into a hierarchical layout. The specific calculation steps are as follows:

[0209] Step 1: Calculate node depth

[0210] Node depth Defined as from the starting node to the node Longest path length:

[0211]

[0212] The depth of the starting node is defined as follows: .

[0213] Step 2: Assign the ordinate

[0214] Assigning the ordinate based on node depth :

[0215]

[0216] in: The initial ordinate is usually set to 0. Or minimum boundary value;

[0217] The spacing between levels is determined based on the canvas size and node height, for example... Pixel; :node The depth.

[0218] Step 3: Topological sorting within the same depth layer

[0219] For the same depth layer Sort by topological order. Topological order Determined in the following way: for any two nodes If there exists from arrive The path, then If there is no path relationship, the order is determined by the original order of the nodes or the order of the incoming edges.

[0220] Step 4: Assign x-coordinates

[0221] Assign x-coordinates based on topological order :

[0222]

[0223] in: The starting x-coordinate is usually set to 0. Or minimum boundary value;

[0224] The horizontal spacing between nodes is determined based on the canvas size and the node width, for example... Pixel;

[0225] :node Topological index in the same depth layer, from It begins to increase.

[0226] (ii) Two-level sorting algorithm: After the coordinate calculation is completed, ... Perform a secondary sort. The sorting rules are defined as follows:

[0227]

[0228] The meaning of this sorting rule is:

[0229] First priority: By vertical axis Sort in ascending order. The smaller the ordinate, the higher the node is on the canvas, and therefore the smaller the consecutive sequence number.

[0230] Second priority: When the vertical coordinates are the same, prioritize the horizontal coordinates. Sort in ascending order. The smaller the x-coordinate, the further left the node is on the canvas, and therefore the smaller the consecutive sequence number.

[0231] (iii) Assigning consecutive serial numbers: After sorting, assign consecutive serial numbers to each node:

[0232] ,

[0233] in For the sorted node list 1 node .

[0234] Another embodiment of the present invention combines Figure 5 Taking a complete workflow diagram as an example, this invention demonstrates the entire process from input to output. The diagram shows the original positional relationship of the nodes, the sequential numbering after secondary sorting, and the final layout effect, intuitively demonstrating the technical effect of the invention's method in achieving "top-to-bottom, left-to-right" visual sorting.

[0235] (a) Input stage

[0236] Users create through a visual interactive interface, such as Figure 5 The workflow graph shown contains 8 nodes and 8 directed edges. The system's workflow parsing module receives this graph and constructs a node set. Sum of edges .

[0237] (II) Initialization Phase

[0238] System initialization core data structures:

[0239]

[0240]

[0241]

[0242]

[0243] (III) Depth-first hybrid traversal phase

[0244] according to Figure 2 The process shown is a traversal, detailed as described in Example 2. After the traversal is complete, The intermediate state is The merge node G is marked as delayed and has not been added yet.

[0245] (iv) Delayed merging node processing phase

[0246] After the traversal is complete, the system merges the traversal branches in the mapping table. It was detected that all predecessor nodes E and F of the merged node G already exist. If the output condition is met, add G to... ,get .

[0247] (v) Coordinate Calculation Stage

[0248] The system calculates the coordinates for each node. Assume the canvas parameters are set as follows:

[0249] , Pixels

[0250] , Pixels

[0251] Calculate the depth of each node. and topology number The coordinate values ​​are shown in the table below:

[0252]

[0253] (vi) Secondary sorting stage

[0254] right Perform a second-level sort, nodes by Lexicographically ordered, the sorted sequence is as follows:

[0255]

[0256] (vii) Continuous sequence number allocation and output stage

[0257] Assign consecutive sequence numbers to the sorted nodes:

[0258]

[0259] (viii) Visualization Output Stage

[0260] The visualization output module renders the sorted list of nodes to the interface, and the final result is as follows: Figure 5 As shown, the nodes are neatly arranged in the order of "from top to bottom and from left to right". The two branches of the conditional branch (C→E and D→F) are clearly distinguishable. The merging node G is accurately located after the two branches. The data flow is clear and there is no backflow phenomenon.

[0261] Another embodiment of the present invention tests the performance of a large-scale workflow graph containing more than 1,000 nodes.

[0262] Test environment configuration:

[0263] Processor: Intel Core i7-12700H

[0264] Memory: 32GB DDR4

[0265] Browser: Chrome 120

[0266] Number of nodes: 1200

[0267] Number of edges: Approximately 1500

[0268] Conditional branching structure: approximately 80

[0269] Test results:

[0270]

[0271] Results analysis:

[0272] The method of this invention exhibits significant advantages in large-scale workflow graph scenarios:

[0273] First, by using a throttling and blocking mechanism, each node is processed only once, completely eliminating redundant processing and strictly controlling the time complexity. The magnitude is small, and the reprocessing rate is 0%.

[0274] Second, through the branch anti-backflow control mechanism, the merging nodes of all conditional branches are delayed to ensure that the data flow is always a unidirectional flow of "branch node → merging node", with a backflow rate of 0%.

[0275] Third, through a two-level sorting algorithm, all nodes are arranged in a visual order of "from top to bottom and from left to right", achieving a sorting accuracy of 100%.

[0276] Fourth, the average processing time is about 1 / 3 of that of traditional methods, and the memory usage is about 1 / 2 of that of traditional methods, meeting the real-time response requirements of interactive visualization scenarios.

[0277] Another embodiment of the present invention illustrates the exception handling mechanism included in the present invention.

[0278] (I) Circular Dependency Detection and Handling

[0279] When circular dependencies exist in the workflow graph, nodes will appear during the depth-first traversal. This refers to instances where the node appears in its own set of predecessor nodes. This invention addresses this by maintaining a recursive call stack. To detect circular dependencies:

[0280]

[0281] When a circular dependency is detected, the system immediately throws a circular dependency exception, terminates the current traversal, returns the specific circular path information to the user, and prompts the user to correct the workflow graph.

[0282] (ii) Branches not merged

[0283] When two branches of a condition node do not converge at the same merge node, the branch backflow prevention control mechanism cannot establish a mapping relationship. In this case, the system skips the branch backflow prevention control and processes the child nodes of the condition node as ordinary nodes. In this situation, the absence of a merge node or the independent termination of a branch does not affect the correctness of the data flow.

[0284] (III) Handling of isolated nodes

[0285] For isolated nodes that have neither predecessor nor successor nodes, the system outputs them directly as independent nodes during the traversal phase. During the coordinate calculation phase, isolated nodes are assigned to independent levels, typically placed at the top or bottom of the canvas.

[0286] (iv) Fault tolerance for delayed merging node predecessor nodes not being fully processed

[0287] In the normal execution process, all predecessor nodes of the delayed merge node are processed before the merge node outputs. However, in extreme cases (such as abnormal data as shown in the figure), predecessor nodes may not be fully processed. Preferably, a fault tolerance check can be added in step S4 to ensure that the system can complete the output normally even in the case of abnormal data and will not crash due to the abnormality.

[0288] This invention can be used in a variety of workflow visualization scenarios. Several typical application scenarios are listed below.

[0289] Application Scenario 1: Enterprise Process Automation

[0290] In robotic process automation (RoLA) and platform-as-a-service (PAS) scenarios, users need to visually configure data integration processes, design API orchestration logic, and build event-driven automation processes. The method of this invention can accurately handle automation processes containing complex conditional branches, ensuring clear node ordering and facilitating user understanding of the process logic.

[0291] Application Scenario 2: Data Lake Warehouse and ETL Task Orchestration

[0292] In data lake warehouse and ETL task orchestration scenarios, users need to design complex directed acyclic graph (DAG) data processing flows, including multi-level dependencies and data quality check nodes. This invention's method ensures accurate node sequencing for large-scale data tasks through throttling and branch backflow prevention mechanisms, thereby improving the efficiency of data developers.

[0293] Application Scenario 3: Low-code Development Platform

[0294] In low-code development platforms, users design business rules and logic orchestration through drag-and-drop. The method of this invention can respond to user editing operations in real time, quickly recalculating the layout after nodes are added, deleted, or modified, providing a smooth visual editing experience.

[0295] Application Scenario 4: Visualization of DevOps and Continuous Integration / Continuous Deployment Pipelines

[0296] In DevOps and continuous integration / continuous deployment pipeline visualization scenarios, users need to design pipelines that include parallel build, testing, and deployment phases. The method described in this invention can clearly display parallel branches and merge points, helping operations personnel quickly locate pipeline bottlenecks and faulty nodes.

[0297] Application Scenario 5: Data Lineage Analysis and Data Quality Tracking

[0298] In data lineage analysis scenarios, users need to trace the complete flow path of data from the source to the target. The method of this invention uses a two-level sorting algorithm to ensure that data nodes are clearly arranged hierarchically, making it easier for users to understand data dependencies and quality inspection processes.

[0299] The method of this invention can be used to achieve efficient, accurate, and logically clear workflow graph node layout and sorting in all the above application scenarios, fully demonstrating the wide applicability and practical value of this invention.

[0300] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for hybrid traversal and sorting of graph nodes in workflow visualization, characterized in that, Includes the following steps: Step S1: Obtain the workflow graph, which includes a set of nodes and a set of directed edges; Step S2: Initialize the set of processed nodes, the branch merge mapping table, and the node output list; Step S3: Perform a depth-first mixed traversal on the nodes in the node set of the workflow graph; Step S4: Traverse the branch merge mapping table and add all deferred processing merge nodes to the node output list; Step S5: Calculate the coordinates for each node in the node output list; Step S6: Perform a secondary sort on the node output list; Step S7: Assign consecutive serial numbers to the sorted node output list and output the sorting result; The depth-first hybrid traversal described in step S3 includes: Step S31: Determine whether the current node being traversed exists in the set of processed nodes. If it exists, skip the current node and return; if it does not exist, add the current node to the set of processed nodes. Step S32: If the type of the currently traversed node is a condition node, then check whether the two branches of the condition node converge at the same merge node. If so, store the mapping relationship in the branch merge mapping table and mark the merge node as a delayed processing node. Step S33: If the type of the currently traversed node is a merged node and it is marked as a delayed processing node, then the currently traversed node will not be added to the node output list for the time being, and will be added after all predecessor nodes have been processed; otherwise, the currently traversed node will be added to the node output list. Step S34: Recursively traverse all child nodes of the current node; In step S31, a throttling blocking mechanism is adopted, and the repetition detection of the throttling blocking mechanism is implemented through a hash set, so that the current traversed node satisfies: ,like If so, then skip the processing; And ultimately satisfied ,in: It is a node. It is the identifier of the node. It is a collection of nodes in a workflow diagram. It is the set of processed nodes. This is the actual set of nodes that are processed, with each node being processed only once. In step S32, a branch anti-backflow control mechanism is adopted to ensure that the branch merging mapping relationship of condition node c satisfies: ; in, It is a branch merge mapping table. It is a condition node. It is the identifier of the node. To merge nodes, and These are the end nodes of the two branches; The merged node is output when all its predecessor nodes have been processed.

2. The method according to claim 1, characterized in that, The sub-steps in step S5 that calculate the coordinates for each node include: Based on node depth Calculate the ordinate : ; Based on topological order within the same depth layer Calculate the x-coordinate : ; in, The initial ordinate is... For the spacing between levels, The starting x-coordinate, This represents the horizontal spacing between nodes.

3. The method according to claim 1, characterized in that, Step S6 includes first defining the sorting rules: ; in Output any two nodes in the node list. For sorting rules; Then, according to the sorting rules, priority is given to... Sort by coordinates in ascending order When coordinates are the same, Sort by coordinates in ascending order.

4. The method according to claim 1, characterized in that, The workflow graph is a directed acyclic graph; The types of nodes include start nodes, normal nodes, condition nodes, merge nodes, and end nodes; The condition node is used to represent a branch decision point, which has two branch outputs; The merge node is used to represent the convergence point of multiple branches, and it has at least two predecessor nodes.

5. The method according to claim 4, characterized in that, It also includes an exception handling mechanism: when a circular dependency is detected in the workflow graph, the traversal is terminated; when two branches of a condition node are not converged at the same merge node, the branch anti-backflow control is skipped and the node is treated as a normal node.

6. A workflow visualization graph node hybrid traversal and sorting system, characterized in that, include: The workflow parsing module is used to obtain and parse workflow diagrams; The hybrid traversal engine is used to perform depth-first hybrid traversal, and calls the throttling blocking controller and the branch anti-backflow controller during the traversal process; The throttling and blocking controller is used to maintain the set of processed nodes, and the throttling and blocking controller performs repeated detection and blocking of nodes at the node processing entry point; The branch anti-backflow controller is used to maintain the branch merging mapping table, identify conditional branch structures, and delay the processing of merging nodes; The coordinate calculation and sorting module is used to calculate the coordinates of nodes, perform secondary sorting, and assign consecutive serial numbers; The visualization output module is used to output the sorted list of nodes and refresh the visualization interface. The hybrid traversal engine performs a depth-first hybrid traversal, which includes the following steps: Check if the current node being traversed exists in the set of already processed nodes. If it does, skip the current node and return. If it does not exist, then add the current node to the set of processed nodes; If the type of the currently traversed node is a condition node, then check whether the two branches of the condition node converge to the same merge node. If so, store the mapping relationship in the branch merge mapping table and mark the merge node as a delayed processing node. If the type of the currently traversed node is a merged node and it is marked as a delayed processing node, then the currently traversed node will not be added to the node output list for the time being, and will be added after all predecessor nodes have been processed; otherwise, the currently traversed node will be added to the node output list. Recursively traverse all child nodes of the current node; The throttling blocking controller employs a throttling blocking mechanism and uses a hash set to detect duplicates of the throttling blocking mechanism, ensuring that the currently traversed node satisfies: ,like If so, then skip the processing; And ultimately satisfied ,in: It is a node. It is the identifier of the node. It is the set of nodes in a workflow diagram. It is the set of processed nodes. This is the actual set of nodes that are processed, with each node being processed only once. The branch anti-backflow controller employs a branch anti-backflow control mechanism to ensure that the branch merging mapping relationship of condition node c satisfies: ; in, It is a branch merge mapping table. It is a condition node. It is the identifier of the node. To merge nodes, and These are the end nodes of the two branches; The merged node is output when all its predecessor nodes have been processed.