BPMN flow chart optimization method based on tree structure algorithm

By optimizing the BPMN flowchart using a tree structure algorithm, the problems of uneven node distribution and intersecting connections in existing technologies are solved, resulting in a more aesthetically pleasing and clear flowchart display that is suitable for complex business scenarios.

CN121582367APending Publication Date: 2026-02-27FAIRYLANDS ENVIRONMENTAL SCI TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511777845.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing BPMN flowchart generation technologies suffer from simple layout algorithms that result in uneven node distribution and complex, intertwined connections. They cannot be dynamically adjusted, and manual adjustments are costly, making it difficult to meet the needs of complex business scenarios.

Method used

The tree structure algorithm is adopted. The BPMN model is obtained through the Activiti process engine, the tree structure is constructed, the hierarchy is divided, the node position and connection are optimized, and the optimized BPMN process diagram is generated.

Benefits of technology

The flowchart node layout has been optimized, improving its aesthetics and clarity, and enabling it to intuitively display process logic, making it suitable for complex business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582367A_ABST
    Figure CN121582367A_ABST
Patent Text Reader

Abstract

The invention relates to a BPMN flow chart optimization method based on a tree structure algorithm, and the method comprises the steps: obtaining a BPMN model through an Activiti flow engine, and reading all flow elements in the BPMN model to construct a directed graph; a starting node in the BPMN model serves as a root node, the directed graph is traversed, and a tree structure is constructed; the tree-shaped structure comprises a trunk and sub-trees; hierarchy division is carried out according to the dependency relationship among the nodes on the tree trunk; arranging the corresponding sub-trees according to the positions and the widths of the sub-trees; and on the basis of an optimization strategy, reducing connection edge intersection between the nodes on each sub-tree, and generating an optimized BPMN flow chart. According to the method, the nodes in the flow chart are rearranged, so that node layout optimization of the flow chart is realized, the optimized flow chart can intuitively display the flow execution logic, and the requirements of complex business scenes can be met.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of flowchart layout, in particular to a BPMN flowchart optimization method based on a tree structure algorithm. BACKGROUND

[0002] In the existing workflow management system, the BPMN flowchart is usually automatically generated by using a process engine such as Activiti or manually drawn. When a node is added through code, the flowchart automatically generated by Activiti will become unattractive and the connections between the nodes will overlap, which seriously affects the viewing of the flowchart. The existing flowchart generation technology has the following defects: 1. Simple layout algorithm, poor graphic attractiveness: The layout algorithm of most process engines is relatively simple, and the node positions generated by the flowchart are not optimized, resulting in uneven distribution of nodes, complex interlaced connections, and affecting the overall attractiveness and clarity.

[0003] 2. Unable to dynamically adjust the layout according to complex processes: In complex processes, there are often a large number of nodes and branches. The current technology lacks layout optimization strategies for large flowcharts, resulting in overcrowding of flowcharts and difficulty in intuitively displaying process logic.

[0004] 3. High cost of manual adjustment: In order to improve the visual effect of the flowchart, it is usually necessary to manually adjust the node positions and connections, which is particularly time-consuming in business scenarios where processes change frequently, increasing maintenance costs.

[0005] The above defects make it difficult for business personnel to intuitively view the execution logic of the flowchart, especially in the process design and display stage. The flowchart generation method of the existing technology cannot meet the needs of complex business scenarios. SUMMARY

[0006] Therefore, it is necessary to provide a BPMN flowchart optimization method based on a tree structure algorithm, which comprises: S1: Obtain a BPMN model through an Activiti process engine, and read all flow elements in the BPMN model to construct a directed graph; S2: Take the start node in the BPMN model as the root node, traverse the directed graph, and construct a tree structure; the tree structure includes a trunk and sub-trees; according to the dependency relationship between the nodes on the trunk, the levels are divided; S3: Arrange the corresponding sub-trees according to their positions and widths; S4: Reduce the intersection of connection edges between the nodes in each sub-tree based on an optimization strategy, and generate an optimized BPMN flowchart.

[0007] Preferably, the reading of all flow elements in the BPMN flowchart to construct a directed graph comprises: reading all flow elements in the BPMN model; ignoring the swimlane border in the BPMN model, converting the sequence flow in the BPMN model into directed edges, taking each node in the BPMN model as a node, and constructing the directed graph based on each node and the directed edges corresponding to the connection.

[0008] Preferably, S2 comprises: taking the start node in the BPMN model as the root node, and traversing the directed graph using the breadth-first search algorithm to assign a level value to each node; taking the path from the start node to the end node with the smallest total level value as the trunk, taking the remaining paths as sub-trees, and taking the branch gateway node in the BPMN model as the corresponding node in the tree structure as the mounting of its sub-tree.

[0009] Preferably, the assigning of the level value to each node comprises: taking the start node in the BPMN model as the root node, and taking each node as a node; initializing the attribute of each node, which includes a level value of -1 and a remaining number of unprocessed predecessor nodes; when the node corresponds to a merge gateway node in the BPMN model, the corresponding remaining number of unprocessed predecessor nodes is the number of incoming edges of the node, otherwise the corresponding remaining number of unprocessed predecessor nodes is 1; setting the level value of the root node to 0 and adding the root node to the BFS queue; when the BFS queue is not empty, taking the root node from the BFS queue, querying all directed edges from the root node, finding all child nodes directly connected to the root node, for each child node, if the corresponding remaining number of unprocessed predecessor nodes is 0 after being reduced by 1, setting the level value of the corresponding child node to the level value of the parent node plus 1, and adding the corresponding child node to the BFS queue; traversing using the breadth-first search algorithm until all nodes are traversed, and assigning a level value to each node.

[0010] Preferably, S2 further comprises level value correction: identifying paired branch gateway nodes and merge gateway nodes in the BPMN model through post dominance analysis or structured subgraph method, taking all nodes between the paired branch gateway nodes and merge gateway nodes as the logical sub-tree of the corresponding gateway node; calculating the maximum level value in the logical sub-tree of the corresponding merge gateway node, setting the level value of the corresponding node in the tree structure to the maximum level value plus one to obtain the new level value of the corresponding node; when the level value of the corresponding node is greater than or equal to the new level value, no processing is performed; Otherwise, the level value of the corresponding node and its downstream nodes is synchronously promoted until the level value of the corresponding node equals the new level value; the downstream nodes include all nodes between the corresponding node and the leaf node or the next merging gateway node in the tree structure.

[0011] Preferably, in S3, the width calculation of the subtree includes: The width of each leaf node is calculated, and the width of the leaf node is the width of the node itself; Starting from the leaf node, each layer of the tree structure is traversed upwards, and for each node in the current layer, the width calculation formula is: subtreeWidth = max(sum(children.subtreeWidth + horizontal distance between child nodes), node.width); Wherein, subtreeWidth represents the subtree width of any node in the current layer, max(·) represents the maximum value function, sum(·) represents the summation function, node.width represents the width of the corresponding node itself, and children.subtreeWidth represents the subtree width of the child nodes of the corresponding node.

[0012] Preferably, in S3, the position calculation of the subtree includes: In the same layer of the tree structure, each node is placed from left to right, wherein the horizontal coordinate of the non-gateway node is aligned with the horizontal center of its parent node, the horizontal coordinate of the branch gateway node is the horizontal coordinate of the symmetry axis of its subtree, and the horizontal coordinate of the merging gateway node is the bounding box center of all branches converged by it; The vertical coordinate calculation formula of each node is: y = level·(node.height + levelGap), wherein y represents the vertical coordinate, level represents the level value corresponding to the node, node.height represents the height of the node itself, and levelGap represents the layer gap.

[0013] Preferably, in the same layer of the tree structure, small y jitter or gateway group alignment strategy is used to prevent node overlap.

[0014] Preferably, in S4, the reducing of the connection edge intersection between nodes in each subtree based on the optimization strategy includes: In the same layer of the tree structure, the parent node center sequence + subtree width rule is used for sorting; When node overlap occurs, local bubble exchange is performed to reduce the connection edge intersection; A dedicated horizontal channel is allocated for the connection edge of the subtree, and the corresponding node port is offset up and down to generate an optimized BPMN process diagram.

[0015] Preferably, the optimized BPMN flowchart is written back to the BPMN model, rendering is completed through BpmnAutoLayout(), and the rendering result is exported in SVG or PNG format for front-end display or export.

[0016] Beneficial effects: the method realizes node layout optimization of the flowchart by rearranging the nodes in the flowchart, and the optimized flowchart can intuitively show the process execution logic and meet the needs of complex business scenarios. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0018] Figure 1 The flowchart of the BPMN flowchart optimization method based on the tree structure algorithm in the embodiments of the present application.

[0019] Figure 2 The schematic diagram of the unoptimized BPMN flowchart of the case one of the business process of applying for a seal in the embodiments of the present application.

[0020] Figure 3 The schematic diagram of the optimized BPMN flowchart of the case one of the business process of applying for a seal in the embodiments of the present application.

[0021] Figure 4 The schematic diagram of the unoptimized BPMN flowchart of the case two of the business process of applying for a seal in the embodiments of the present application.

[0022] Figure 5 The schematic diagram of the optimized BPMN flowchart of the case two of the business process of applying for a seal in the embodiments of the present application. DETAILED DESCRIPTION

[0023] In order to make the above purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below. In the following description, many specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without departing from the scope of the present application, therefore the present application is not limited to the specific embodiments disclosed below.

[0024] In addition, the terms "first", "second", "third", etc. are used only for descriptive purposes and are not to be construed as indicating or implying relative importance or an ordered ranking of the indicated technical features. Thus, features defined with "first", "second" or "third" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, for example two, three, etc., unless otherwise explicitly and specifically limited.

[0025] As shown in Figure 1 The embodiment provides a BPMN flowchart optimization method based on a tree structure algorithm, which comprises the following steps: S1: acquiring a BPMN model through an Activiti process engine, and reading all flow elements in the BPMN model to construct a directed graph.

[0026] Specifically, the reading of all flow elements in the BPMN flowchart to construct a directed graph comprises the following steps: reading all flow elements in the BPMN model; ignoring the swimlane border in the BPMN model, converting the sequential flow in the BPMN model into a directed edge, taking each node in the BPMN model as a node, and constructing the directed graph based on each node and the corresponding connected directed edge. In the embodiment, the node comprises a specific task, a gateway, an event, etc.

[0027] S2: taking the start node in the BPMN model as a root node, traversing the directed graph, constructing a tree structure, and dividing levels according to the dependency relationship between each node on the trunk.

[0028] Specifically, the start node in the BPMN model is taken as a root node, and the breadth-first search algorithm is used to traverse the directed graph, and each node is assigned a level value; the path with the minimum sum of level values between the start node and the end node is taken as the trunk, the remaining paths are taken as sub-trees, and the branch gateway node in the BPMN model is taken as the mounting of the sub-trees in the corresponding node in the tree structure.

[0029] Further, the step of assigning a level value to each node comprises the following steps: taking the start node in the BPMN model as a root node, and taking each node as a node; initializing the attribute of each node respectively, the attribute comprising a level value of -1 and a remaining number of unprocessed predecessor nodes; when the node corresponds to a merge gateway node in the BPMN model, the corresponding remaining number of unprocessed predecessor nodes is the number of incoming edges of the node, otherwise the corresponding remaining number of unprocessed predecessor nodes is 1; the level value of the root node is set to 0, and the root node is added to the BFS queue; When the BFS queue is not empty, the root node is taken out from the BFS queue, and all directed edges from the root node are queried to find all child nodes directly connected to the root node, and for each child node, if the corresponding number of remaining unprocessed predecessor nodes is 0 after being reduced by 1, the level value of the corresponding child node is set to the level value of the parent node plus 1, and the corresponding child node is added to the BFS queue; The breadth-first search algorithm is used for traversal until all nodes are traversed, and level values are respectively assigned to all nodes.

[0030] In this embodiment, S2 further includes level value correction: The paired branch gateway node and the merge gateway node in the BPMN model are identified by post dominance analysis or structured subgraph method, and all nodes between the paired branch gateway node and the merge gateway node are regarded as a logical subtree of the corresponding gateway node; The maximum level value in the logical subtree of the corresponding merge gateway node is calculated, the level value of the node corresponding to the merge gateway node in the tree structure is set to the maximum level value plus one to obtain a new level value of the corresponding node; When the level value of the corresponding node is greater than or equal to the new level value, no processing is performed; Otherwise, the level values of the corresponding node and downstream nodes are synchronously improved until the level value of the corresponding node is equal to the new level value; the downstream nodes include all nodes between the node corresponding to the corresponding node and the next merge gateway node in the tree structure.

[0031] The level value correction process ensures the consistency of the level structure and the clarity of the flowchart.

[0032] S3: The corresponding subtree is arranged according to the position and width of each subtree.

[0033] Specifically, the width calculation of the subtree includes: The width of each leaf node is calculated, and the width of the leaf node is the width of the node itself; Starting from the leaf node, each layer of the tree structure is traversed upwards, and for each node in the current layer, the width calculation formula is: subtreeWidth = max(sum(children.subtreeWidth + horizontal spacing between child nodes), node.width); Wherein, subtreeWidth represents the subtree width of any node in the current layer, max(·) represents the maximum value function, sum(·) represents the summation function, node.width represents the width of the corresponding node itself, and children.subtreeWidth represents the subtree width of the child nodes of the corresponding node. Each branch is regarded as a subtree, and the equal-width merging width is adopted, and the edge routing channel is reserved.

[0034] The position calculation of the subtree includes: In the same layer of the tree structure, the nodes are placed from left to right, wherein the horizontal coordinates of the non-gateway nodes are aligned with the horizontal center of the parent node, the horizontal coordinates of the branch gateway nodes are the horizontal coordinates of the symmetry axis of the subtree, and the horizontal coordinates of the merging gateway nodes are the center of the bounding box of all branches converged. The vertical coordinate calculation formula of each node is: y = level·(node.height + levelGap), wherein y represents the vertical coordinate, level represents the level value corresponding to the node, node.height represents the height of the node itself, and levelGap represents the layer spacing.

[0035] In the embodiment, in the same layer of the tree structure, the small y jitter or the gateway group alignment strategy is used to prevent node overlap. Specifically, for multiple nodes in the same level, to avoid overlap, the vertical coordinates of the nodes can be fine-tuned (small y jitter) or aligned using the gateway group alignment strategy, so as to ensure that the nodes do not overlap. Through this process, the level of the flowchart is clear, the node distribution is reasonable, and the readability and aesthetics of the graph are improved.

[0036] S4: reducing the connection edge intersection between nodes on each subtree based on the optimization strategy, and generating an optimized BPMN flowchart.

[0037] Specifically, the method for reducing the connection edge intersection between nodes on each subtree based on the optimization strategy includes: In the same layer of the tree structure, the sorting adopts the parent node center sequence + subtree width rule; When the node overlap occurs, the local bubble exchange is performed to reduce the connection edge intersection; A dedicated horizontal channel is allocated for the connection edge on the subtree, and the up and down offsets are made for the corresponding node port, and an optimized BPMN flowchart is generated.

[0038] Further, in the intersection / overlap elimination step, by performing "parent node center sequence + sub-tree width" sorting on nodes of the same level, the nodes are arranged in order and the intersection is reduced. If there is still overlap after sorting, the position of adjacent nodes is adjusted using the local bubble exchange method until there is no overlap. At the same time, for non-main tree edges (such as back edges or cross-layer edges), a virtual line track is inserted between layers, and the end port offset technique is used to avoid the intersection of these edges with the main path. Through these methods, node overlap and edge intersection are eliminated, and the clarity and readability of the flowchart are improved.

[0039] In the embodiment, the method further comprises: writing the optimized BPMN flowchart back to the BPMN model, and completing rendering by BpmnAutoLayout(·), and exporting the rendering result in SVG or PNG format for front-end display or export.

[0040] For non-main path edges, channel wiring, shortest path offset and other strategies are used to reduce edge intersection and ensure consistent connection direction, improving the aesthetic appearance of the graph.

[0041] To intuitively reflect the advantages of the optimization method provided in the embodiment, the embodiment provides a comparison of the use of seals application business process in a company, as follows: Case one: starting from the application of seals, the department head of the corresponding department needs to be approved, and after the department head approves, the use of seals application is sent to the personnel administration for approval of reporting the use of seals application, and after confirming the reporting of the use of seals application, the personnel administration sends the use of seals application to the legal department, the supervisor and the finance department for approval, and after the approval of the legal department and the finance department, the supervisor needs to be sent for comprehensive approval, and finally, the supervisor approves the use of seals, and the use of seals application process ends. In the entire process, if the approval of any link fails, the use of seals will not be allowed. The BPMN flowchart of the unoptimized case one is shown in Figure 2 , and the BPMN flowchart after optimization is shown in Figure 3 .

[0042] Case two: starting from the application of seals, the department head of the corresponding department needs to be approved, and after the department head approves, the use of seals application is sent to the legal department, the supervisor and the finance department for approval, or the use of seals application can be directly sent to the legal department, the supervisor and the finance department for approval; after the approval of the legal department and the finance department, the supervisor is sent for comprehensive approval, and the order of the use of seals application after the approval of the supervisor is the supervisor of the supervisor, the general manager and the administrative department in turn, finally, the administrative department approves the use of seals, and the use of seals application process ends. In the entire process, if the approval of any link fails, the use of seals will not be allowed. The BPMN flowchart of the unoptimized use of seals application business process in the company in case two is shown in Figure 4 , and the BPMN flowchart after optimization is shown in Figure 5 .

[0043] Contrast Figure 2 With Figure 3 , Figure 4 With Figure 5 As can be seen, Figure 2 , Figure 4 The flowchart shown in the flowchart is disordered, and it is difficult to directly show the execution logic, and Figure 3 , Figure 5 The flowchart shown in the flowchart realizes the node layout optimization of the flowchart through the rearrangement of the nodes, the overall flowchart is simple and beautiful, and the optimized flowchart can directly show the process execution logic and can meet the needs of complex business scenarios.

[0044] The BPMN flowchart optimization method based on the tree structure algorithm provided in the embodiment has the following beneficial effects: 1. Compared with simple grid / sequential layout, the algorithm is more compact through main tree extraction + sub-tree width from bottom to top, and reduces unnecessary white space.

[0045] 2. Compared with the traditional Sugiyama flowchart method, the combination of gateway pair constraints ensures the visual symmetry and layer alignment of the split and the combination, and the user understanding cost is lower.

[0046] 3. The introduction of channelized edge routing and port offset significantly reduces cross-layer / back-edge intersection and improves readability.

[0047] 4. The calculation process is linear, suitable for online layout and incremental recalculation of large-scale processes.

[0048] The technical features of the above-described embodiments can be combined arbitrarily, and in order to make the description concise, not all possible combinations of the technical features in the above-described embodiments are described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0049] The above-described embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the patent scope of the application. It should be noted that for ordinary skilled persons in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the patent protection scope of the present application should be subject to the appended claims.

Claims

1. A method for optimizing a BPMN flowchart based on a tree structure algorithm, characterized in that, include: S1: Obtain the BPMN model through the Activiti process engine and read all flow elements in the BPMN model to construct a directed graph; S2: Using the start node in the BPMN model as the root node, traverse the directed graph to construct a tree structure; the tree structure includes a trunk and subtrees; divide the hierarchy according to the dependencies between nodes on the trunk; S3: Arrange the corresponding subtrees according to their position and width; S4: Based on the optimization strategy, reduce the intersection of connection edges between nodes in each subtree to generate an optimized BPMN flowchart.

2. The tree structure algorithm based BPMN flowchart optimization method of claim 1, wherein, The process of reading all flow elements in the BPMN flowchart to construct a directed graph includes: Read all stream elements in the BPMN model; Ignore the swimlane boundaries in the BPMN model, transform the sequential flow in the BPMN model into directed edges, treat each node in the BPMN model as a node, and construct the directed graph based on each node and the corresponding directed edges.

3. The tree structure algorithm based BPMN flowchart optimization method of claim 2, wherein S2 include: Using the start node in the BPMN model as the root node, and traversing the directed graph using a breadth-first search algorithm, each node is assigned a level value. The path with the smallest sum of hierarchical values ​​between the start and end nodes is taken as the trunk, the remaining paths are taken as subtrees, and the nodes corresponding to the branch gateway nodes in the BPMN model in the tree structure are taken as the attachments of their subtrees.

4. The tree structure algorithm based BPMN flowchart optimization method of claim 3, wherein, Assigning a hierarchy value to each node includes: The starting node in the BPMN model is taken as the root node, and all other nodes are taken as nodes respectively; Initialize the attributes for each node, including the level value of -1 and the number of remaining unprocessed predecessor nodes; When a node corresponds to a merged gateway node in a BPMN model, the number of remaining unprocessed predecessor nodes is equal to the number of incoming edges of the node; otherwise, the number of remaining unprocessed predecessor nodes is 1. Set the root node's level value to 0 and add the root node to the BFS queue; When the BFS queue is not empty, the root node is taken out from the BFS queue, and all directed edges originating from the root node are queried. All child nodes directly connected to the root node are found. For each child node, if the value of the corresponding remaining unprocessed predecessor node minus 1 is 0, the level value of the corresponding child node is set to the level value of the parent node plus 1, and the corresponding child node is added to the BFS queue. A breadth-first search algorithm is used to traverse the nodes until all nodes have been traversed, and each node is assigned a level value.

5. The tree structure algorithm based BPMN flowchart optimization method of claim 4, wherein, S2 also includes hierarchical value correction: The paired branch gateway nodes and merged gateway nodes in the BPMN model are identified by post-dominance analysis or structured subgraph method, and all nodes between the paired branch gateway nodes and merged gateway nodes are taken as logical subtrees of the corresponding gateway nodes. Calculate the maximum level value in the logical subtree of the corresponding merged gateway node, and set the level value of the node corresponding to the merged gateway node in the tree structure to the maximum level value plus one to obtain the new level value of the corresponding node. If the level value of the corresponding node is greater than or equal to the new level value, no action is taken. Otherwise, synchronously increase the level value of the corresponding node and its downstream nodes until the level value of the corresponding node equals the new level value; The downstream nodes include all nodes between the corresponding nodes in the tree structure from the corresponding node to the leaf node or the next merging gateway node.

6. The tree structure algorithm based BPMN flow chart optimization method of claim 1, wherein, In S3, the width calculation of the sub-tree includes: calculating the width of each leaf node, and the width of the leaf node is the width of the node itself; starting from the leaf node, traversing each layer of the tree structure upwards, for each node in the current layer, the width calculation formula is: subtreeWidth = max(sum(children.subtreeWidth + horizontal distance between child nodes), node.width); wherein subtreeWidth represents the sub-tree width of any node in the current layer, max(·) represents the maximum value function, sum(·) represents the summation function, node.width represents the width of the corresponding node itself, and children.subtreeWidth represents the sub-tree width of the child nodes of the corresponding node.

7. The tree structure algorithm based BPMN flowchart optimization method of claim 1, wherein, In S3, the position calculation of the sub-tree includes: in the same layer of the tree structure, each node is placed from left to right, wherein the horizontal coordinate of the non-gateway node is aligned with the horizontal center of its parent node, the horizontal coordinate of the branch gateway node is the horizontal coordinate of the symmetry axis of its sub-tree, and the horizontal coordinate of the merging gateway node is the bounding box center of all branches converged by it; the vertical coordinate calculation formula of each node is: y = level·(node.height + levelGap), wherein y represents the vertical coordinate, level represents the level value corresponding to the node, node.height represents the height of the node itself, and levelGap represents the layer gap.

8. The tree structure algorithm based BPMN flowchart optimization method of claim 7, wherein, In the same layer of the tree structure, small y jitter or gateway group alignment strategy is used to prevent node overlap.

9. The tree structure algorithm based BPMN flow chart optimization method of claim 1, wherein, In S4, the connection edge intersection between nodes in each sub-tree is reduced based on the optimization strategy, which includes: in the same layer of the tree structure, the sorting adopts the parent node center sequence + sub-tree width rule; when node overlap occurs, local bubble exchange is performed to reduce the connection edge intersection; dedicated horizontal channels are allocated for the connection edges on the sub-tree, and up and down offsets are made for the corresponding node ports to generate the optimized BPMN flowchart.

10. The tree structure algorithm based BPMN flowchart optimization method of claim 1, wherein, Further comprising: write the optimized BPMN flowchart back to the BPMN model, and complete the rendering through BpmnAutoLayout(·), and export the rendering result as SVG or PNG format for front-end display or export.