CN113065177A - Layout method and device for directed acyclic flow chart and electronic equipment - Google Patents

Layout method and device for directed acyclic flow chart and electronic equipment Download PDF

Info

Publication number
CN113065177A
CN113065177A CN202011454737.2A CN202011454737A CN113065177A CN 113065177 A CN113065177 A CN 113065177A CN 202011454737 A CN202011454737 A CN 202011454737A CN 113065177 A CN113065177 A CN 113065177A
Authority
CN
China
Prior art keywords
node
flow chart
path
nodes
paths
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011454737.2A
Other languages
Chinese (zh)
Other versions
CN113065177B (en
Inventor
徐浪
王文斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN202011454737.2A priority Critical patent/CN113065177B/en
Publication of CN113065177A publication Critical patent/CN113065177A/en
Application granted granted Critical
Publication of CN113065177B publication Critical patent/CN113065177B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/12Geometric CAD characterised by design entry means specially adapted for CAD, e.g. graphical user interfaces [GUI] specially adapted for CAD

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Geometry (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Optimization (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Architecture (AREA)
  • Design And Manufacture Of Integrated Circuits (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The embodiment of the application provides a layout method, a layout device and electronic equipment for a directed acyclic flow chart, relates to the field of computer aided design, and comprises the steps of obtaining a logical relationship among all steps in a target project; determining the steps of the nodes of the flow chart and judging conditions between the steps of the nodes of the flow chart based on the logical relationship; generating a node map based on the flow chart node steps, and arranging the node map in an operation plane; adjusting the position of the node picture by taking the minimum blank area in the operation plane as an optimization condition; and adding corresponding judgment condition flow chart connecting lines between the adjusted node pictures to finish the flow chart layout. The position of the node picture is adjusted by taking the minimum blank area in the operation plane as an optimization condition, so that the plane space can be fully utilized on the basis of continuous reasonable layout and clear arrangement, as much content as possible can be clearly displayed in a smaller space, and a user can conveniently and quickly read and analyze the content.

Description

Layout method and device for directed acyclic flow chart and electronic equipment
Technical Field
The present application relates to the field of computer aided design, and in particular, to a layout method and apparatus for a directed acyclic flow chart, and an electronic device.
Background
A flow diagram is a graphical representation of information flow, point of view flow, or component flow through a system. The method has the characteristics of being visual and convenient to understand, being easy to find when an algorithm is wrong, and being directly converted into a program, and is gradually applied to more and more fields.
As their applications become more widespread, the disadvantages manifest themselves: i.e., occupying a large space, which causes inconvenience in reading. In the prior art, patent application No. 201310334758.4, system and apparatus for implementing automatic layout of flow chart, discloses a method for implementing automatic layout of flow chart, which includes the following steps: obtaining the logical relationship between the nodes; analyzing the logical relationship of the nodes and dividing the levels of the nodes; optimizing nodes in the same level, and calculating an optimal layout mode; and determining the coordinates of each node in the optimized flow chart by adopting the topological sequence. The method comprises the steps of dividing the levels of nodes by analyzing the logical relationship of the nodes, calculating the optimal arrangement mode in each level by adopting a Randker iterative sequencing algorithm for the nodes in the same level to ensure the minimum number of cross points of a flow chart connecting line, and uniformly and linearly distributing all the nodes in a plane at equal intervals by utilizing a symmetrical layout method, thereby effectively solving the chaos and complexity of manually drawing the flow chart, quickly and efficiently realizing the reasonable layout of the flow chart, and ensuring the accuracy of the flow chart layout and clear business logic.
However, the above-mentioned published patent technology is only an automatic layout for the graph, and the use of this algorithm results in a particularly low space utilization rate because the nodes are uniformly and linearly distributed in the plane at equal intervals. Especially, in some larger projects, a large amount of blank space may be left in the flow chart, which is not favorable for later reading.
Content of application
In order to solve the defects and shortcomings in the prior art, the application provides a layout method, a device and electronic equipment for a directed acyclic flow chart, the position of a node picture is adjusted by taking the minimum blank area in an operation plane as an optimization condition, the plane space can be fully utilized on the basis of continuous reasonable layout and clear arrangement, as much content as possible can be clearly displayed in a smaller space, and a user can conveniently and quickly read and analyze the content.
In order to achieve the above technical object, according to a first aspect of an embodiment of the present disclosure, the embodiment provides a layout method for a directed acyclic flow chart, the layout method including:
acquiring a logical relation among steps in a target project;
determining the steps of the nodes of the flow chart and judging conditions between the steps of the nodes of the flow chart based on the logical relationship;
generating a node map based on the flow chart node steps, and arranging the node map in an operation plane;
adjusting the position of the node picture by taking the minimum blank area in the operation plane as an optimization condition;
and adding corresponding judgment condition flow chart connecting lines between the adjusted node pictures to finish the flow chart layout.
Optionally, the obtaining of the logical relationship between the steps in the target item includes:
traversing the data related to each step in the target project to obtain a sequential path corresponding to all data storage of the target project;
selecting the longest path from the traversed sequential paths, and screening nodes contained in the traversed sequential paths to obtain nodes with the largest path width;
determining a path key coordinate based on the selected longest path and the node with the largest path width;
and carrying out node sequencing on all paths passing through the path key coordinate, and carrying out access sequencing on the paths according to a sequencing result.
Optionally, the node sorting all the paths passing through the path key coordinate, and performing access sorting on the paths according to the sorting result includes:
traversing all paths to find out the longest path, and marking the sequence number of the selected path as an index;
assigning a variable to all the obtained sequential paths by taking index as a boundary, taking the value of the variable as a threshold value for dividing each sequential path into two sub-paths, and dividing all the sequential paths one by one to obtain two sub-sequential path sets;
and adopting traversal operation on the sub-paths in the sub-path set by using a greedy algorithm until only one sub-path exists in the sub-sequence path set.
Optionally, the layout method further includes:
traversing the current path and sorting coordinates of each node from top to bottom through the path key coordinates;
judging whether the current node is accessed and sequenced or not before sequencing the nodes, skipping the sequencing of the node if the current node is accessed and sequenced, and recording the node as sequenced if the current node is not accessed and sequenced;
optionally, the adjusting the position of the node image under the optimization condition of the minimum blank area in the operation plane includes:
acquiring edge coordinates of a plane space in four directions, establishing a plane quadrangle based on the acquired edge coordinates, dividing grids according to the width and height of a node picture corresponding to a flow chart node, traversing each flow chart node, placing the node picture corresponding to the flow chart node into the divided grids, and establishing a corresponding relation with the coordinates;
traversing all the nodes of the flow chart again to find the previous node and the next node of the current nodes of the flow chart;
and if the previous node and the next node are on the same side of the current flow chart node, searching whether the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied, and if not, moving in the direction of the upper and lower nodes.
In order to achieve the above technical object, according to a second aspect of an embodiment of the present disclosure, the embodiment provides a layout apparatus for a directed acyclic flow chart, the layout apparatus including:
the logic extraction unit is used for acquiring the logic relation among all steps in the target project;
a condition judgment unit for determining the steps of the nodes of the flow chart and judgment conditions between the steps of the nodes of the flow chart based on the logical relationship;
a picture generation unit for generating a node picture based on the flow chart node steps, arranging the node picture in an operation plane;
the picture adjusting unit is used for adjusting the position of the node picture by taking the minimum blank area in the operation plane as an optimization condition;
and the picture connecting unit is used for adding corresponding judgment condition flow chart connecting lines among the adjusted node pictures to finish the flow chart layout.
Optionally, the logic extracting unit includes:
the traversal subunit is used for traversing the data related to each step in the target project to obtain a sequential path corresponding to all data storage of the target project;
the selecting subunit is used for selecting the longest path from the traversed sequential paths and screening the nodes contained in the traversed sequential paths to obtain the nodes with the largest path width;
the coordinate determination subunit is used for determining the key coordinates of the path based on the selected longest path and the node with the largest path width;
and the sequencing subunit is used for carrying out node sequencing on all the paths passing through the path key coordinate and carrying out access sequencing on the paths according to a sequencing result.
Optionally, the sorting subunit is specifically configured to:
traversing all paths to find out the longest path, and marking the sequence number of the selected path as an index;
assigning a variable to all the obtained sequential paths by taking index as a boundary, taking the value of the variable as a threshold value for dividing each sequential path into two sub-paths, and dividing all the sequential paths one by one to obtain two sub-sequential path sets;
and adopting traversal operation on the sub-paths in the sub-path set by using a greedy algorithm until only one sub-path exists in the sub-sequence path set.
Optionally, the sorting subunit is further configured to:
traversing the current path and sorting coordinates of each node from top to bottom through the path key coordinates;
before the nodes are sorted, judging whether the current node is accessed and sorted or not, if so, skipping the sorting of the node, and if not, sorting and recording the record of the node as the sorted.
Optionally, the picture adjusting unit includes:
the grid dividing subunit is used for acquiring edge coordinates of the plane space in four directions, establishing a plane quadrangle based on the acquired edge coordinates, dividing grids according to the width and height of the node pictures corresponding to the flow chart nodes, traversing each flow chart node, placing the node pictures corresponding to the flow chart nodes into the divided grids, and establishing a corresponding relation with the coordinates;
the node extraction subunit is used for traversing all the nodes of the flow chart again to find the previous node and the next node of the current nodes of the flow chart;
and the picture adjusting subunit is used for searching whether the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied or not if the previous node and the next node are on the same side of the current flow chart node, and moving in the direction of the upper and lower nodes if the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied.
According to a third aspect of embodiments of the present disclosure, the present embodiment provides an electronic device, including: an electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the steps of any of the foregoing methods for layout of directed acyclic flow diagrams via execution of the executable instructions.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program for executing, by a processor, the steps of any one of the preceding methods for layout of a directed acyclic flow chart.
The beneficial effect that technical scheme that this application provided brought is:
by adopting the method, all paths of the flow chart can be accurately sequenced, so that nodes are not overlapped, cross lines are minimum, and the paths are clear. The whole picture can be clearly displayed in a small space, the plane space is fully utilized, and the arranged flow charts are consistent in style and easy to read. For a more complex flow chart, an optimal balance point is found between resolution and space utilization according to the output format of the flow chart.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flow chart of a layout method for a directed acyclic flow chart according to this embodiment;
FIG. 2 is a schematic diagram of a layout apparatus for a directed acyclic flow chart according to the present embodiment;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
To make the structure and advantages of the present application clearer, the structure of the present application will be further described with reference to the accompanying drawings.
Example one
According to a first aspect of the embodiments of the present disclosure, the present embodiments provide a layout method for a directed acyclic flow chart, as shown in fig. 1, the layout method including:
11. acquiring a logical relation among steps in a target project;
12. determining the steps of the nodes of the flow chart and judging conditions between the steps of the nodes of the flow chart based on the logical relationship;
13. generating a node map based on the flow chart node steps, and arranging the node map in an operation plane;
14. adjusting the position of the node picture by taking the minimum blank area in the operation plane as an optimization condition;
15. and adding corresponding judgment condition flow chart connecting lines between the adjusted node pictures to finish the flow chart layout.
In implementation, an Acyclic Directed Graph is called a Directed Acyclic Graph (Directed Acyclic Graph). Referred to as a DAG graph for short. In order to construct a DAG graph based on a target project, the layout method for the DAG graph provided by the embodiment of the application has the following main ideas: and acquiring the logical relationship among the steps and the existing judgment conditions, generating the node images corresponding to the steps, and further placing the obtained node images in an operation plane. And adjusting the size and the placing position of the node pictures by taking the minimum blank area in the operation plane as an optimization condition, and finally adding connecting lines among the node pictures.
Compared with the prior art, the layout method provided by the embodiment of the application can clearly display the whole image in a smaller space through a processing mode taking the minimum blank area as the optimization condition in the operation plane, and improves the space utilization rate of the operation plane. In addition, the step sequencing operation of the nodes of the flow chart is carried out based on the logical relationship of each step, so that all paths of the flow chart can be accurately sequenced, the nodes are not overlapped, the cross lines are minimum, and the paths are clear. For a more complex flow chart, an optimal balance point can be found between resolution and space utilization according to the output format of the flow chart.
Specifically, the obtaining of the logical relationship between the steps in the target item, which is proposed in step 11, includes:
111. traversing the data related to each step in the target project to obtain a sequential path corresponding to all data storage of the target project;
112. selecting the longest path from the traversed sequential paths, and screening nodes contained in the traversed sequential paths to obtain nodes with the largest path width;
113. determining a path key coordinate based on the selected longest path and the node with the largest path width;
114. and carrying out node sequencing on all paths passing through the path key coordinate, and carrying out access sequencing on the paths according to a sequencing result.
In implementation, in order to obtain the logical relationship among the steps in the target project, the project needs to be traversed through a depth-first algorithm, all sequential paths from the beginning to the end are obtained, and the sequential paths are stored in a dual-cycle data structure; traversing all paths to find out a longest path; finding out the node with the maximum current path width; determining a path key coordinate based on the selected longest path and the node with the largest path width; traversing the current path to perform coordinate sorting from top to bottom on each node through the path key coordinates, judging whether the current node is accessed and sorted before sorting the nodes, skipping the sorting of the node if the current node is accessed and sorting and recording the node as the sorted node if the current node is not accessed and sorted.
The specific manner of step 114 is: and traversing all the paths, finding out the longest path, and marking the sequence number of the selected path as an index. And assigning a value to the variable i by taking the index position of the longest path as a boundary in all the sequential paths obtained in the step 111, taking the value of the variable i as a threshold value for dividing each sequential path into two sub-paths, and dividing all the sequential paths one by one to obtain two sub-sequential path sets. And adopting traversal operation on the sub-paths in the sub-path set by using a greedy algorithm until only one sub-path exists in the sub-sequence path set.
For example: a flow chart has 4 paths and the longest path is the 3 rd path, where index is 2 (since subscripts all start from 0), the divided sets of sub-sequential paths are [0,1] and [2,4], respectively, the former set includes the 1 st and 2 nd paths in the current 4 paths, and the latter set includes the 3 rd and 4 th paths in the current 4 paths. Then, carrying out recursion processing on the obtained sub-sequence path set by adopting a greedy algorithm, wherein the processing purpose is to carry out access marking on the nodes and adjust and sort the position attributes of the nodes so as to ensure that the nodes are uniformly distributed; and performing recursive processing on all the sub-sequence paths in the same way until the limit variable i of the sub-sequence path dividing set is superposed with the index, and only one path is available at the moment, so that the division cannot be continued.
The above example process is based on a divide-and-conquer approach, and aims to mark access to nodes and adjust and sort the node positions. The sorting principle is that the nodes are rearranged according to the small-to-large sequence based on the abscissa or the ordinate of the nodes, and the coordinates of the nodes are reset according to the sorted sequence, so that all the nodes which are not accessed are more uniformly distributed in the area with the fixed size.
Optionally, the layout method provided in this embodiment further includes the following steps:
traversing the current path and sorting coordinates of each node from top to bottom through the path key coordinates;
before the nodes are sorted, judging whether the current node is accessed and sorted or not, if so, skipping the sorting of the node, and if not, sorting and recording the record of the node as the sorted.
It is worth noting that in the process of obtaining the path key coordinate, the related path key coordinate refers to the x coordinate of the left vertex of the generated picture of the process node, the least process connection line intersection is finally generated after positioning, the x coordinate of each path is recorded in an xs [ index-1] + ws [ index-1] + gaps, xs [ ] array of the coordinate xs [ index-1] + ws [ index-1] + gaps of the previous path, ws [ ] records the maximum width of each path, gaps are constant values, and the x coordinate is generally determined according to the size of the canvas of the distribution node.
The path width here refers to a width value of a node having the largest width in all sequential paths in the target project, and the longest path refers to a data flow path having the largest number of nodes in the flow of the target project.
Wherein, the processing steps involved in step 114 employ a greedy algorithm. Greedy algorithms mean that the choice that seems best at the present time is always made when solving a problem. Rather than being considered from a global optimum, the algorithm results in a locally optimal solution in some sense. The greedy algorithm does not yield an overall optimal solution for all problems.
Optionally, the processing content proposed in step 14 relates to performing position adjustment on the node map, and includes:
141. acquiring edge coordinates of a plane space in four directions, establishing a plane quadrangle based on the acquired edge coordinates, dividing grids according to the width and height of a node picture corresponding to a flow chart node, traversing each flow chart node, placing the node picture corresponding to the flow chart node into the divided grids, and establishing a corresponding relation with the coordinates;
142. traversing all the nodes of the flow chart again to find the previous node and the next node of the current nodes of the flow chart;
143. and if the previous node and the next node are on the same side of the current flow chart node, searching whether the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied, and if not, moving in the direction of the upper and lower nodes.
In implementation, the operations in steps 141 to 143 are aimed at adjusting positions of front and back node maps of a certain flow map node, so that the adjusted node maps can occupy the entire operation plane, and the situation that the front and back node maps are located on the same side is avoided as much as possible, thereby improving the definition of the DAG map on the structural level.
Based on the above steps, the distance between the parallel process connection lines is not less than twice the line width of the process connection lines when step 15 is performed. Such setting ensures that the flow connecting lines can not be arranged too densely, and especially avoids that adjacent flow connecting lines are adhered to each other and are difficult to distinguish due to too thick line width of the flow connecting lines in the printing process.
The name explanation involved in this example:
path: refers to an ordered set of all nodes that pass from the beginning to the end node
Sequential path: a double-loop data structure that refers to the path stored in the data structure being from left to right: is a variable two-dimensional array
The key coordinates of the path are as follows: the method refers to the x coordinate of the left vertex of the flow node, so that the layout of the flow graph is compact, and the intersection of connecting lines is reduced.
Example two
The present embodiment provides a layout apparatus 2 for a directed acyclic flow chart, as shown in fig. 2, the layout apparatus including:
a logic extraction unit 21, configured to obtain a logic relationship between steps in the target project;
a condition judgment unit 22 for determining the steps of the nodes of the flowchart and judgment conditions between the steps of the nodes of the flowchart based on the logical relationship;
a picture generation unit 23 for generating a node picture based on the flowchart node steps, arranging the node picture within the operation plane;
a picture adjusting unit 24, configured to adjust the position of the node picture under the optimization condition of minimum blank area in the operation plane;
and the picture connecting unit 25 is configured to add corresponding judgment condition flowchart connecting lines between the adjusted node pictures to complete the flowchart layout.
In implementation, an Acyclic Directed Graph is called a Directed Acyclic Graph (Directed Acyclic Graph). Referred to as a DAG graph for short. In order to construct a DAG graph based on a target project, the layout method for the DAG graph provided by the embodiment of the application has the following main ideas: and acquiring the logical relationship among the steps and the existing judgment conditions, generating the node images corresponding to the steps, and further placing the obtained node images in an operation plane. And adjusting the size and the placing position of the node pictures in the operation plane, and finally adding connecting lines between the node pictures.
Compared with the prior art, the layout method provided by the embodiment of the application can clearly display the whole image in a smaller space through a processing mode taking the minimum blank area as the optimization condition in the operation plane, and improves the space utilization rate of the operation plane. In addition, the step sequencing operation of the nodes of the flow chart is carried out based on the logical relationship of each step, so that all paths of the flow chart can be accurately sequenced, the nodes are not overlapped, the cross lines are minimum, and the paths are clear. For a more complex flow chart, an optimal balance point can be found between resolution and space utilization according to the output format of the flow chart.
In implementation, the logic extracting unit 21 is used to obtain the logic relationship between the steps in the target item, including:
a traversal subunit 211, configured to traverse data related to each step in the target project to obtain a sequential path corresponding to all data storage of the target project;
a selecting subunit 212, configured to select a longest path from the traversed sequential paths, and filter nodes included in the traversed sequential paths to obtain a node with a largest path width;
a coordinate determination subunit 213, configured to determine a path key coordinate based on the selected longest path and the node with the largest path width;
and the sorting subunit 214 is configured to perform node sorting on all paths passing through the path key coordinate, and perform access sorting on the paths according to a sorting result.
In implementation, in order to obtain the logical relationship among the steps in the target project, the project needs to be traversed through a depth-first algorithm, all sequential paths from the beginning to the end are obtained, and the sequential paths are stored in a dual-cycle data structure; traversing all paths to find out a longest path; finding out the node with the maximum current path width; determining a path key coordinate based on the selected longest path and the node with the largest path width; traversing the current path to perform coordinate sorting from top to bottom on each node through the path key coordinates, judging whether the current node is accessed and sorted before sorting the nodes, skipping the sorting of the node if the current node is accessed and sorting and recording the node as the sorted node if the current node is not accessed and sorted.
The sorting subunit 214 is specifically configured as follows: and traversing all the paths, finding out the longest path, and marking the sequence number of the selected path as an index. Assigning a value to the variable i by using the index position of the longest path as a boundary in all the sequential paths obtained in the traversal subunit 211, taking the value of the variable i as a threshold for dividing each sequential path into two sub-paths, and dividing all the sequential paths one by one to obtain two sub-sequential path sets. And adopting traversal operation on the sub-paths in the sub-path set by using a greedy algorithm until only one sub-path exists in the sub-sequence path set.
For example: a flow chart has 4 paths and the longest path is the 3 rd path, where index is 2 (since subscripts all start from 0), the divided sets of sub-sequential paths are [0,1] and [2,4], respectively, the former set includes the 1 st and 2 nd paths in the current 4 paths, and the latter set includes the 3 rd and 4 th paths in the current 4 paths. Then, carrying out recursion processing on the obtained sub-sequence path set by adopting a greedy algorithm, wherein the processing purpose is to carry out access marking on the nodes and adjust and sort the position attributes of the nodes so as to ensure that the nodes are uniformly distributed; and performing recursive processing on all the sub-sequence paths in the same way until the limit variable i of the sub-sequence path dividing set is superposed with the index, and only one path is available at the moment, so that the division cannot be continued.
The above example process is based on a divide-and-conquer approach, and aims to mark access to nodes and adjust and sort the node positions. The sorting principle is that the nodes are rearranged according to the small-to-large sequence based on the abscissa or the ordinate of the nodes, and the coordinates of the nodes are reset according to the sorted sequence, so that all the nodes which are not accessed are more uniformly distributed in the area with the fixed size.
Optionally, the sorting subunit 214 is further configured to:
traversing the current path and sorting coordinates of each node from top to bottom through the path key coordinates;
before the nodes are sorted, judging whether the current node is accessed and sorted or not, if so, skipping the sorting of the node, and if not, sorting and recording the record of the node as the sorted.
It is worth noting that in the process of obtaining the path key coordinate, the related path key coordinate refers to the x coordinate of the left vertex of the generated picture of the process node, the least process connection line intersection is finally generated after positioning, the x coordinate of each path is recorded in an xs [ index-1] + ws [ index-1] + gaps, xs [ ] array of the coordinate xs [ index-1] + ws [ index-1] + gaps of the previous path, ws [ ] records the maximum width of each path, gaps are constant values, and the x coordinate is generally determined according to the size of the canvas of the distribution node.
The path width here refers to a width value of a node having the largest width in all sequential paths in the target project, and the longest path refers to a data flow path having the largest number of nodes in the flow of the target project.
Wherein, the ordering subunit 214 involves a greedy algorithm in the processing steps. Greedy algorithms mean that the choice that seems best at the present time is always made when solving a problem. Rather than being considered from a global optimum, the algorithm results in a locally optimal solution in some sense. The greedy algorithm does not yield an overall optimal solution for all problems.
Optionally, the picture adjusting unit 24 includes:
a grid dividing unit 241, configured to obtain edge coordinates of the plane space in four directions, establish a plane quadrangle based on the obtained edge coordinates, divide a grid according to the width and height of a node image corresponding to a flow chart node, traverse each flow chart node, place the node image corresponding to the flow chart node in the divided grid, and establish a corresponding relationship with the coordinates;
a node extracting subunit 242, configured to traverse all the nodes of the flowchart again, and find a previous node and a next node of the current node of the flowchart;
and a picture adjusting subunit 243, configured to search whether a space surrounded by the current flow chart node and the upper and lower nodes is unoccupied if the previous node and the next node are on the same side as the current flow chart node, and move in the direction of the upper and lower nodes if the space is unoccupied.
In implementation, the mesh partitioning subunit 241, the node extracting subunit 242, and the picture adjusting subunit 243 are configured to adjust positions of front and rear node pictures of a certain flow node, so that the adjusted node pictures can occupy the entire operation plane, and the situation that the front and rear node pictures are located on the same side is avoided as much as possible, thereby improving the clarity of the DAG at the structural level.
Based on the foregoing steps, the picture connection unit 25 involves the space between the parallel flow connection lines not less than twice the line width of the flow connection lines in the execution process. Such setting ensures that the flow connecting lines can not be arranged too densely, and especially avoids that adjacent flow connecting lines are adhered to each other and are difficult to distinguish due to too thick line width of the flow connecting lines in the printing process.
The name explanation involved in this example:
path: refers to an ordered set of all nodes that pass from the beginning to the end node
Sequential path: a double-loop data structure that refers to the path stored in the data structure being from left to right: is a variable two-dimensional array
The key coordinates of the path are as follows: the method refers to the x coordinate of the left vertex of the flow node, so that the layout of the flow graph is compact, and the intersection of connecting lines is reduced.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units. The components shown as modules or units may or may not be physical units, i.e. may be located in one place or may also be distributed over a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the wood-disclosed scheme. One of ordinary skill in the art can understand and implement it without inventive effort.
In this example embodiment, there is also provided a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method for laying out a directed acyclic graph as described in any of the above embodiments. For the specific steps of the layout method for the directed acyclic graph, reference may be made to the detailed description of the data processing steps in the foregoing embodiments, and details are not repeated here. The computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
There is also provided in this example embodiment an electronic device that may include a processor and a memory to store executable instructions for the processor. Wherein the processor is configured to perform the steps of the layout method for a directed acyclic graph of any of the above embodiments via execution of the executable instructions. The steps of the generating method can refer to the detailed description in the foregoing method embodiments, and are not described herein again.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
FIG. 3 shows a schematic diagram of an electronic device in an example embodiment according to the present disclosure. For example, the apparatus may be provided as a server or client. Referring to fig. 3, the device includes a processing component 422, which further includes one or more processors, and memory resources, represented by memory 432, for storing instructions, such as application programs, that are executable by the processing component 422. The application programs stored in memory 432 may include one or more modules that each correspond to a set of instructions. Further, the processing component 422 is configured to execute instructions to perform the above-described methods.
The apparatus 800 may also include a power component 426 configured to perform power management of the apparatus 400, a wired or wireless network interface 450 configured to connect the apparatus 400 to a network, and an input output (I/O) interface 458. The apparatus 800 may operate based on an operating system stored in the memory 432, such as Windows Server (TM), Mac OS XTM, Unix (TM), Linux (TM), FreeBSDTM, or the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This embodiment is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (12)

1. A placement method for a directed acyclic flow graph, the placement method comprising:
acquiring a logical relation among steps in a target project;
determining the steps of the nodes of the flow chart and judging conditions between the steps of the nodes of the flow chart based on the logical relationship;
generating a node map based on the flow chart node steps, and arranging the node map in an operation plane;
adjusting the position of the node picture by taking the minimum blank area in the operation plane as an optimization condition;
and adding corresponding judgment condition flow chart connecting lines between the adjusted node pictures to finish the flow chart layout.
2. The layout method for directed acyclic flow chart according to claim 1, wherein said obtaining a logical relationship between steps in a target item comprises:
traversing the data related to each step in the target project to obtain a sequential path corresponding to all data storage of the target project;
selecting the longest path from the traversed sequential paths, and screening nodes contained in the traversed sequential paths to obtain nodes with the largest path width;
determining a path key coordinate based on the selected longest path and the node with the largest path width;
and carrying out node sequencing on all paths passing through the path key coordinate, and carrying out access sequencing on the paths according to a sequencing result.
3. The layout method for directed acyclic flow chart according to claim 2, wherein said sorting all paths passing through the path key coordinate by nodes, and sorting the paths according to the sorting result, comprises:
traversing all paths to find out the longest path, and marking the sequence number of the selected path as an index;
assigning a variable to all the obtained sequential paths by taking index as a boundary, taking the value of the variable as a threshold value for dividing each sequential path into two sub-paths, and dividing all the sequential paths one by one to obtain two sub-sequential path sets;
and adopting traversal operation on the sub-paths in the sub-path set by using a greedy algorithm until only one sub-path exists in the sub-sequence path set.
4. The layout method for a directed acyclic flow chart according to claim 2, wherein said layout method further comprises:
traversing the current path and sorting coordinates of each node from top to bottom through the path key coordinates;
before the nodes are sorted, judging whether the current node is accessed and sorted or not, if so, skipping the sorting of the node, and if not, sorting and recording the record of the node as the sorted.
5. The layout method for directed acyclic flow chart according to claim 1, wherein said adjusting the position of the node map with the condition of minimum blank area in the operation plane as an optimization condition comprises:
acquiring edge coordinates of a plane space in four directions, establishing a plane quadrangle based on the acquired edge coordinates, dividing grids according to the width and height of a node picture corresponding to a flow chart node, traversing each flow chart node, placing the node picture corresponding to the flow chart node into the divided grids, and establishing a corresponding relation with the coordinates;
traversing all the nodes of the flow chart again to find the previous node and the next node of the current nodes of the flow chart;
and if the previous node and the next node are on the same side of the current flow chart node, searching whether the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied, and if not, moving in the direction of the upper and lower nodes.
6. A placement device for directed acyclic flow graph, the placement device comprising:
the logic extraction unit is used for acquiring the logic relation among all steps in the target project;
a condition judgment unit for determining the steps of the nodes of the flow chart and judgment conditions between the steps of the nodes of the flow chart based on the logical relationship;
a picture generation unit for generating a node picture based on the flow chart node steps, arranging the node picture in an operation plane;
the picture adjusting unit is used for adjusting the position of the node picture by taking the minimum blank area in the operation plane as an optimization condition;
and the picture connecting unit is used for adding corresponding judgment condition flow chart connecting lines among the adjusted node pictures to finish the flow chart layout.
7. The layout apparatus for directed acyclic flow chart of claim 6, wherein the logic extraction unit comprises:
the traversal subunit is used for traversing the data related to each step in the target project to obtain a sequential path corresponding to all data storage of the target project;
the selecting subunit is used for selecting the longest path from the traversed sequential paths and screening the nodes contained in the traversed sequential paths to obtain the nodes with the largest path width;
the coordinate determination subunit is used for determining the key coordinates of the path based on the selected longest path and the node with the largest path width;
and the sequencing subunit is used for carrying out node sequencing on all the paths passing through the path key coordinate and carrying out access sequencing on the paths according to a sequencing result.
8. The layout apparatus for a directed acyclic flow chart according to claim 7, wherein the sorting subunit is specifically configured to:
traversing all paths to find out the longest path, and marking the sequence number of the selected path as an index;
assigning a variable to all the obtained sequential paths by taking index as a boundary, taking the value of the variable as a threshold value for dividing each sequential path into two sub-paths, and dividing all the sequential paths one by one to obtain two sub-sequential path sets;
and adopting traversal operation on the sub-paths in the sub-path set by using a greedy algorithm until only one sub-path exists in the sub-sequence path set.
9. The layout apparatus for a directed acyclic flow chart according to claim 7, wherein said ordering subunit is further configured to:
traversing the current path and sorting coordinates of each node from top to bottom through the path key coordinates;
before the nodes are sorted, judging whether the current node is accessed and sorted or not, if so, skipping the sorting of the node, and if not, sorting and recording the record of the node as the sorted.
10. The layout apparatus for directed acyclic flow chart according to claim 6, wherein said picture adjusting unit comprises:
the grid dividing subunit is used for acquiring edge coordinates of the plane space in four directions, establishing a plane quadrangle based on the acquired edge coordinates, dividing grids according to the width and height of the node pictures corresponding to the flow chart nodes, traversing each flow chart node, placing the node pictures corresponding to the flow chart nodes into the divided grids, and establishing a corresponding relation with the coordinates;
the node extraction subunit is used for traversing all the nodes of the flow chart again to find the previous node and the next node of the current nodes of the flow chart;
and the picture adjusting subunit is used for searching whether the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied or not if the previous node and the next node are on the same side of the current flow chart node, and moving in the direction of the upper and lower nodes if the space surrounded by the current flow chart node and the upper and lower nodes is unoccupied.
11. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the steps of the layout method for a directed acyclic flow chart of any of claims 1 to 5 via execution of the executable instructions.
12. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program is executed by a processor for the steps of the layout method for a directed acyclic flow chart according to any of the claims 1 to 5.
CN202011454737.2A 2020-12-10 2020-12-10 Layout method and device for directed acyclic flow chart and electronic equipment Active CN113065177B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011454737.2A CN113065177B (en) 2020-12-10 2020-12-10 Layout method and device for directed acyclic flow chart and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011454737.2A CN113065177B (en) 2020-12-10 2020-12-10 Layout method and device for directed acyclic flow chart and electronic equipment

Publications (2)

Publication Number Publication Date
CN113065177A true CN113065177A (en) 2021-07-02
CN113065177B CN113065177B (en) 2023-03-24

Family

ID=76558738

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011454737.2A Active CN113065177B (en) 2020-12-10 2020-12-10 Layout method and device for directed acyclic flow chart and electronic equipment

Country Status (1)

Country Link
CN (1) CN113065177B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501386A (en) * 2023-03-31 2023-07-28 中国船舶集团有限公司第七一九研究所 Automatic calculation program solving method based on data pool and related device
CN117593406A (en) * 2024-01-18 2024-02-23 杭州同花顺数据开发有限公司 Mulberry base graph generation method, device, equipment and computer readable storage medium
CN117593406B (en) * 2024-01-18 2024-05-10 杭州同花顺数据开发有限公司 Mulberry base graph generation method, device, equipment and computer readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH064278A (en) * 1992-06-17 1994-01-14 Yaskawa Electric Corp Method for generating flow chart by minicomputer
US6295367B1 (en) * 1997-06-19 2001-09-25 Emtera Corporation System and method for tracking movement of objects in a scene using correspondence graphs
JP2001267429A (en) * 2000-03-17 2001-09-28 Nec Microsystems Ltd Layout design device and method
US20050149889A1 (en) * 2003-12-18 2005-07-07 Dmitry Messerman Reorganizing rectangular layout structures for improved extraction
US20070240088A1 (en) * 2006-04-11 2007-10-11 Xiaoping Tang Vlsi artwork legalization for hierarchical designs with multiple grid constraints
CN101876900A (en) * 2009-11-24 2010-11-03 恒生电子股份有限公司 Method for automatically adjusting and distributing flow chart and device thereof
CN103577164A (en) * 2012-07-20 2014-02-12 腾讯科技(深圳)有限公司 Flow diagram generating method and device
US20160155249A1 (en) * 2013-11-22 2016-06-02 Raytheon Company Interactive multimedia process flow chart builder
US20190065631A1 (en) * 2017-08-31 2019-02-28 Siemens Aktiengesellschaft Method, apparatus, and device for generating a visual model layout of a space

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH064278A (en) * 1992-06-17 1994-01-14 Yaskawa Electric Corp Method for generating flow chart by minicomputer
US6295367B1 (en) * 1997-06-19 2001-09-25 Emtera Corporation System and method for tracking movement of objects in a scene using correspondence graphs
JP2001267429A (en) * 2000-03-17 2001-09-28 Nec Microsystems Ltd Layout design device and method
US20050149889A1 (en) * 2003-12-18 2005-07-07 Dmitry Messerman Reorganizing rectangular layout structures for improved extraction
US20070240088A1 (en) * 2006-04-11 2007-10-11 Xiaoping Tang Vlsi artwork legalization for hierarchical designs with multiple grid constraints
CN101876900A (en) * 2009-11-24 2010-11-03 恒生电子股份有限公司 Method for automatically adjusting and distributing flow chart and device thereof
CN103577164A (en) * 2012-07-20 2014-02-12 腾讯科技(深圳)有限公司 Flow diagram generating method and device
US20160155249A1 (en) * 2013-11-22 2016-06-02 Raytheon Company Interactive multimedia process flow chart builder
US20190065631A1 (en) * 2017-08-31 2019-02-28 Siemens Aktiengesellschaft Method, apparatus, and device for generating a visual model layout of a space

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SIX J M等: "A framework and algorithms for circular drawings of graph", 《JOURNAL OF DISCRETE ALGORITHMS》 *
刘靖等: "一种基于超像素的户外建筑图像布局标定方法", 《厦门大学学报(自然科学版)》 *
边旭等: "流程图布局算法实现", 《数字技术与应用》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501386A (en) * 2023-03-31 2023-07-28 中国船舶集团有限公司第七一九研究所 Automatic calculation program solving method based on data pool and related device
CN116501386B (en) * 2023-03-31 2024-01-26 中国船舶集团有限公司第七一九研究所 Automatic calculation program solving method based on data pool and related device
CN117593406A (en) * 2024-01-18 2024-02-23 杭州同花顺数据开发有限公司 Mulberry base graph generation method, device, equipment and computer readable storage medium
CN117593406B (en) * 2024-01-18 2024-05-10 杭州同花顺数据开发有限公司 Mulberry base graph generation method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN113065177B (en) 2023-03-24

Similar Documents

Publication Publication Date Title
US11302060B2 (en) Method and system for vector-raster overlay analysis of ground surface image area based on edge clipping
CN111027294B (en) Method, device and system for summarizing table
CN112669463B (en) Method for reconstructing curved surface of three-dimensional point cloud, computer device and computer-readable storage medium
US11250250B2 (en) Pedestrian retrieval method and apparatus
US20150089355A1 (en) Graphical tile-based layout
Nouanesengsy et al. Adr visualization: A generalized framework for ranking large-scale scientific data using analysis-driven refinement
CN110163076A (en) A kind of image processing method and relevant apparatus
US20060132488A1 (en) Apparatus and method for representing multi-level LOD three-dimensional image
CN114862656A (en) Method for acquiring training cost of distributed deep learning model based on multiple GPUs
CN112668289A (en) Extraction method and device of nested table and storage medium
CN113065177B (en) Layout method and device for directed acyclic flow chart and electronic equipment
CN109766176A (en) A kind of scan progress calculation method and device based on large scale network space exploration
US9880086B2 (en) Non-overlapping visualization of data records of a scatter plot
CN105701760A (en) Histogram real-time generation method of geographic raster data optional polygon area
CN110610539A (en) Stratum curved surface construction method, device, equipment and storage medium
CN107833229A (en) Information processing method, apparatus and system
CN113867850B (en) Data processing method, device, equipment and storage medium
Camahort et al. Integrating volume data analysis and rendering on distributed memory architectures
CN106652032B (en) A kind of parallel contour lines creation method of DEM based on Linux cluster platform
CN116186819B (en) BIM model lightweight processing method, device, equipment and storage medium
CN111599015A (en) Space polygon gridding filling method and device under constraint condition
JP2019139497A (en) Image processing system and image processing method
CN112966041A (en) Data processing method, device, equipment and storage medium
CN113324537A (en) Vehicle pose acquisition method, vehicle positioning method and device, equipment and medium
CN112381715A (en) Method and device for parallelly generating map tiles by mass remote sensing images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant