CN116843857A - Compact composite graph orthogonal layout method based on grid division, computer device and computer readable storage medium - Google Patents
Compact composite graph orthogonal layout method based on grid division, computer device and computer readable storage medium Download PDFInfo
- Publication number
- CN116843857A CN116843857A CN202310583456.4A CN202310583456A CN116843857A CN 116843857 A CN116843857 A CN 116843857A CN 202310583456 A CN202310583456 A CN 202310583456A CN 116843857 A CN116843857 A CN 116843857A
- Authority
- CN
- China
- Prior art keywords
- node
- graph
- layout
- nodes
- initial
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 239000002131 composite material Substances 0.000 title claims abstract description 42
- 238000005457 optimization Methods 0.000 claims abstract description 44
- 238000004364 calculation method Methods 0.000 claims abstract description 30
- 239000011159 matrix material Substances 0.000 claims abstract description 24
- 238000007781 pre-processing Methods 0.000 claims abstract description 5
- 238000009877 rendering Methods 0.000 claims abstract description 4
- 230000006870 function Effects 0.000 claims description 57
- 238000005452 bending Methods 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 21
- 150000001875 compounds Chemical class 0.000 claims description 18
- 238000005056 compaction Methods 0.000 claims description 15
- 230000003796 beauty Effects 0.000 claims description 12
- 238000010586 diagram Methods 0.000 claims description 11
- 238000004422 calculation algorithm Methods 0.000 claims description 7
- 238000002922 simulated annealing Methods 0.000 claims description 4
- 238000011156 evaluation Methods 0.000 description 15
- 230000000694 effects Effects 0.000 description 5
- 238000013507 mapping Methods 0.000 description 4
- 238000011160 research Methods 0.000 description 4
- 239000013598 vector Substances 0.000 description 4
- 238000013461 design Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000000007 visual effect Effects 0.000 description 3
- 238000003384 imaging method Methods 0.000 description 2
- 238000002372 labelling Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 229930091051 Arenine Natural products 0.000 description 1
- 238000000137 annealing Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 238000011423 initialization method Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000013139 quantization Methods 0.000 description 1
- 230000008054 signal transmission Effects 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 238000009827 uniform distribution Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/20—Finite element generation, e.g. wire-frame surface description, tesselation
- G06T17/205—Re-meshing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/39—Circuit design at the physical level
- G06F30/392—Floor-planning or layout, e.g. partitioning or placement
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Computer Graphics (AREA)
- Software Systems (AREA)
- Architecture (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Design And Manufacture Of Integrated Circuits (AREA)
Abstract
The invention provides a compact composite graph orthogonal layout method based on grid division, a computer device and a computer readable storage medium, wherein the method comprises the steps of obtaining initial graph data; preprocessing initial data of the graph; initializing layout of each node according to the initial data of the graph, adaptively calculating the size of grids and the size of cells required to be divided for layout of the graph, and updating the information of the grid marking matrix; scoring the aesthetic degree of the initial graph after the layout is initialized, and performing iterative optimization calculation on the initial graph to obtain the position coordinate information of each node in the final optimized graph; and generating an orthogonal line plan of the edge relation among the nodes according to the position coordinate information of each node, and performing marking and rendering to obtain an orthogonal layout. The invention also provides a computer device for realizing the method and a computer readable storage medium. The invention can objectively evaluate the beautiful degree of the layout, and has lower realization cost.
Description
Technical Field
The invention relates to the technical field of computer graphics processing, in particular to a compact composite graph orthogonal layout method based on grid division, a computer device for realizing the method and a computer readable storage medium.
Background
When drawing a power equipment allocation chart, equipment nodes such as a transformer substation, a station room, a switching device, virtual nodes and the like need to be displayed in the drawing, the size of each equipment node is different, and each equipment node is usually connected with one or more other equipment nodes, for example, a power transmission line or a signal transmission line needs to be arranged between two equipment nodes. Therefore, the power plant deployment diagram also needs to embody the connection relationship between the respective nodes, and the line connecting the two plant nodes is often referred to as an "edge".
In general, a power device deployment map is considered as a data structure composed of device nodes and edges for representing association relationships between a plurality of device nodes. As the size of graphical data increases, it becomes increasingly difficult to understand and infer structures or knowledge contained in the graph. As shown in fig. 1, if the device nodes with connection relationship are simply connected directly, a large number of connection lines are staggered and overlapped, so that the reading effect is very poor, and it is difficult for people to identify the positions of the device nodes and to clearly see the specific connection lines. For this reason, it is preferred to represent the data structure using a graph of orthogonal layout, as shown in fig. 2, each device node is represented by a square of uniform size, and the lines between the device nodes are all arranged orthogonally, i.e. the lines can only be arranged in the lateral or vertical direction, and the bending of the lines is 90 °. The orthogonal layout of the graphic reading experience is better, and the data can be presented more visually friendly.
The orthogonal layout of the power equipment allocation diagram requires that the switching equipment is nested in groups, the peripheral nodes of the transformer substation and the primary equipment are close enough, the diagram of the orthogonal layout is an undirected composite diagram orthogonal layout with self-loop condition, and the equipment nodes have actual physical size.
The orthogonal layout of the composite graph is a new hot spot direction in the current graph layout research, which not only requires the aesthetic property of a general graph layout into a graph, but also requires that the size of each node block of the graph can be set, and the researched object is a composite nested graph structure, namely node pairs in the graph can be constrained into groups, and meanwhile, the routing of the graph layout must be orthogonal. Therefore, the orthogonal layout of the composite graph has a larger application prospect compared with the traditional graph layout method because the orthogonal layout of the composite graph allows flexible variation of the node from the size to the structure nesting.
At present, the research on the map layout based on the tree map structure in China is more and is mostly seen in the field of computer graphics, but the research on the orthogonal map layout is less. In addition to including general orthographic layout studies abroad, recent research interests have turned to how to target orthographic layouts of compound graphs. For small composite graphs, zaman, 2021, proposed a TSM-based method to give orthogonal layout algorithms to graphs with nodes not exceeding 4 degrees.
The orthogonal layout of the composite graph is a graph with multiple layers of nesting, and two key problems need to be solved when the power equipment allocation graph is actually drawn: the method comprises the steps of placing the positions of the nodes of the equipment and orthogonal path planning of the wiring among the equipment. The placement of the node position is the most important link, and directly influences the subsequent node intersection or the attractive appearance, so that the overall effect of the final imaging is determined. The theoretical global optimal solution of the problem is extremely difficult under the optimization objective that the composite node constraint and the graphic aesthetics are best met.
The prior evaluation of the aesthetic degree of the orthogonal layout of the composite graph is artificial subjective evaluation, and objective evaluation standards are not introduced, so that subjective evaluation components of the orthogonal layout of the composite graph are too high to influence the aesthetic property of the finally obtained orthogonal layout of the composite graph. Moreover, the mode of artificial subjective evaluation also leads to difficult realization of automatic graphic layout calculation, and the implementation efficiency of the orthogonal layout method of the composite graph is low.
Disclosure of Invention
The first object of the invention is to provide a compact composite graph orthogonal layout method based on grid division, which can objectively evaluate the beauty of the composite graph orthogonal layout.
A second object of the present invention is to provide a computer apparatus implementing the above-described compact compound graph orthogonal layout method based on meshing.
A third object of the present invention is to provide a computer readable storage medium implementing the above-described compact compound graph orthogonal layout method based on meshing.
In order to achieve the first object of the present invention, the compact composite graph orthogonal layout method based on grid division provided by the present invention includes obtaining initial graph data, the initial graph data including node number and node position limitation information of a graph; preprocessing initial data of the graph; initializing and laying out each node according to the initial data of the graph, adaptively calculating the size of grids and the size of cells required to be divided for laying out the graph, and updating the information of the grid marking matrix; grading the aesthetic degree of the initial graph after the layout is initialized, and carrying out iterative optimization calculation on the initial graph until the grade of the aesthetic degree of the initial graph is not improved any more, so as to obtain the position coordinate information of each node in the final optimized graph; and generating an orthogonal line plan of the edge relation among the nodes according to the position coordinate information of each node, and performing marking and rendering to obtain an orthogonal layout.
According to the scheme, the original pattern is scored through the arrangement, and objective attractive degree scoring calculation is carried out through setting an attractive degree scoring function, so that the problem that attractive degree evaluation is too free due to artificial attractive degree scoring is avoided. In addition, the invention also carries out iterative optimization on the layout of the nodes, ensures the global performance of the graphic layout, and the generated graphic layout is compact and orderly and has good improvement on indexes of bending number, crossing number, side length, and other aesthetic degrees.
In a preferred embodiment, scoring the aesthetic degree of the initial graphic after initializing the layout includes: and calculating the distance function value between any two nodes in the initial graph, summing the distance function values between any two nodes in all the nodes in the initial graph, and scoring the attractiveness according to the sum.
Therefore, according to the attractive degree scoring of the distance between any two nodes, the distance between each node of the calculated composite graph is not overlong, and the finally formed drawing is compact and orderly.
Further, scoring the aesthetic degree of the initial graph after initializing the layout includes: and calculating the bending function value of each node, wherein the bending function value of one node is the bending function between the node and the node which is in topological connection with the node, calculating the total bending function value of all nodes, and scoring the attractiveness by using the total bending function value.
Therefore, besides considering the distance between the nodes, the bending condition formed by the connecting lines between the nodes is considered, and the aesthetic degree is scored by the sum of the bending function values, so that the finally obtained composite graph has fewer bending quantity, and the crossing condition can be reduced as much as possible.
Further, the iterative optimization calculation for the initial graph includes: after determining the current position of a target node, selecting a better layout position of the target node, and calculating the grading value of the beauty degree of the initial graph of the target node under the better layout position.
Therefore, the position of the single node is adjusted, for example, the position of the single node is adjusted to a blank position, so that the better layout position of each node is found, and the attractiveness of the graph is improved.
Further, the iterative optimization calculation for the initial graph includes: and (3) carrying out position exchange on two nodes with the distance smaller than a preset value in the initial graph, and calculating the grading value of the beauty degree of the initial graph after the node position exchange.
Therefore, by performing iterative computation by performing position exchange on two nodes with smaller distances, more layout positions of each node can be found.
Further, the iterative optimization calculation for the initial graph includes: and constructing a quadratic compaction model function with constraint, solving the quadratic compaction model function, re-determining the position of the node according to the solving result, and scoring the beauty of the initial graph according to the re-determined node position.
In this way, by introducing a sparse solving method of a large-scale matrix, namely solving by using a quadratic compaction model function, automatic mapping of tens of thousands of nodes can be processed offline within controllable time, so that the complexity of manual mapping is greatly reduced, and the mapping efficiency is improved.
In a further scheme, when iterative optimization calculation is carried out on the initial graph, an annealing algorithm is simulated for iterative solution.
Therefore, the temperature can be gradually reduced by adopting the simulated annealing algorithm to carry out iterative solution, the iterative calculation convergence effect is good, and the iterative calculation efficiency can be ensured.
Further, the information of the grid marking matrix includes the size of the grid marking matrix, the position of each node in the grid marking matrix, the blank area of the grid marking matrix, and the visible node of each node in the transverse and longitudinal directions.
It can be seen that the size of the grid cells can be determined from the information of the grid markup matrix, and where the blank areas within the matrix are, is helpful for quickly locating the canvas blank area index, searching for multiple nodes to be swapped.
To achieve the above second object, the present invention provides a computer apparatus having a processor and a memory storing a computer program which, when executed by the processor, implements or performs each step of the above-described compact compound diagram orthogonal layout method based on meshing.
To achieve the above third object, the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements or performs the steps of the above-described compact composite orthogonal layout method based on meshing.
Drawings
Fig. 1 is a graphical example of a random layout.
Fig. 2 is a graphical example of an orthogonal layout.
FIG. 3 is a first portion of a flow chart of an embodiment of a compact compound diagram orthogonal layout method based on meshing of the present invention.
FIG. 4 is a second portion of a flow chart of an embodiment of a compact compound diagram orthogonal layout method based on meshing of the present invention.
FIG. 5 is a schematic diagram of a grid marking matrix in an embodiment of a compact compound graph orthogonal layout method based on grid partitioning of the present invention.
The invention is further described below with reference to the drawings and examples.
Detailed Description
The compact composite graph orthogonal layout method based on grid division is applied to orthogonal layout of composite graphs so as to facilitate drawing of the composite graphs such as power equipment allocation graphs. The computer device of the invention has a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to realize a compact compound diagram orthogonal layout method based on grid division.
Compact composite graph orthogonal layout method embodiment based on grid division:
in this embodiment, a plurality of devices need to be arranged in the composite graph, and this embodiment is called a node, and in the power device deployment graph, each node is an actual device, so each node cannot overlap. To improve the aesthetics of the composite graph, the connection lines between the nodes need to be orthogonal, and the overall connection lines between the nodes need to be less crossed and less bent. To accommodate the display requirements of a common display, the aspect ratio of the composite graph is approximately 16:9, the imaging is required to be attractive and the readability is good. In addition, according to the actual use requirement of the power equipment, for example, the switch equipment is best located close to and at a fixed distance, some nodes in the composite graph are required to have position group constraint, and in this case, the orthogonal layout method of the composite graph is still required to give an attractive layout.
The existing layout method is subjective in terms of aesthetic evaluation of the layout, because the aesthetic measure related to the graph is usually a very open problem, and has no unified standard. This embodiment contemplates that if the edges of the graphic intersect less, the graphic will appear to interfere with human vision much less. If one had to cross, the readability of the graph would be much better when the angle of the cross was greatest, i.e., the 90 ° orthogonal cross. Therefore, according to the embodiment, based on objective indexes for summarizing the aesthetic property evaluation of some graphs, such as the number of intersecting edges, the angle of intersection, the number of bending edges, the total length of edges, the symmetry of the graph, the degree of fullness of the graph, the proportion of the graph and the like, an objective and computable aesthetic property evaluation function is set, and the aesthetic property of the layout of the composite graph is evaluated by using the aesthetic property evaluation function, so that the aesthetic property evaluation of the graph is more objective.
The present embodiment will be described in detail with reference to fig. 3 and 4. First, step S1 is performed to acquire graphics initial data. Before the layout of the composite graph is performed, basic data of the composite graph, namely initial graph data, is required to be acquired, wherein the initial graph data comprises the number of nodes in the graph, node attributes, constraint relation of the nodes, composite nesting constraint conditions and the like, the node attributes comprise the connection relation between the nodes and other nodes, whether the nodes are actual or virtual nodes, whether the nodes can be overlapped with other nodes and the like, and if the display attribute of the nodes has requirements, the node attributes also comprise the display size of the nodes and the like. The constraint relation of the nodes comprises combined neighbors between the nodes, such as whether the current node needs to be set in a certain range of another node or the constraint relation between the current node and the positions of other nodes.
Then, step S2 is performed to preprocess the graphics initial data. In preprocessing graphics data, the size of the node needs to be processed, for example, for some node sizes, an upward rounding function is used to adjust the size of the node so that the node size is shaped. In addition, since the subsequent calculation introduces a compact global optimization of the compaction function, there is no space between nodes at all, and a certain labeling space is reserved. At the time of preprocessing, a setting parameter delta of virtual width-height operation is set. For example, the original real node has a width of 20.4 and a height of 10.7, and if the parameter δ=4 is set, the width and height of the preprocessed node are respectively: wide=21+δ=25; high=11+δ=15.
Then, step S3 is executed to initialize the layout of each node according to the graphic initialization data. When the initialization layout is carried out, the nodes are not required to be aligned, and only the condition that the nodes are not overlapped is satisfied. For example, existing force directed initialization methods may be employed, and initialization with node sizes may also be prioritized using incremental breadth, and the initialized layout may be obtained using laplace mapping that maintains as much as possible the adjacency between nodes.
After the initial layout is performed, the size of the grid to be divided and the size of the cells are adaptively calculated according to the initial position coordinates and the size of each node, and the grid marking matrix GridMark is updated.
Specifically, referring to fig. 5, assume that the size of the grid is 8×18, i.e., the number of cells is 8 rows and 18 columns, there are nine nodes in the grid, where the grid is marked with the number "1" where the first node is located, the grid is marked with the number "2" where the second node is located, and so on. Thus, by setting the grid mark matrix and acquiring the information of the grid mark matrix, it is possible to determine which areas within the grid are blank areas, that is, which areas have no nodes arranged, which is very helpful for quickly locating the blank area index in the pattern, searching for whether a plurality of nodes can be exchanged.
In addition, two broken lines are drawn in fig. 5, and these two broken lines are both drawn in the lateral direction and the longitudinal direction with the cell at the upper left corner of the first node as a reference, and it can be seen from fig. 5 that the second node, the fourth node, and the fifth node can be seen from the first node in the lateral direction, and the ninth node can be seen from the first node in the lateral direction, and these information will be recorded as information of the grid mark matrix, and the nodes that can be seen from one node in the lateral direction and the longitudinal direction are referred to as relative visual information between the nodes, and this embodiment uses this information as a global optimization obtained by constraint input compaction function, so that a better layout solution can be obtained.
Next, step S4 is executed to score the beauty of the graphic after initializing the layout. In this embodiment, two functions are used to evaluate the aesthetic appearance of the graph, namely a distance function and a bending function.
Firstly, the embodiment needs to calculate the distance function value between any two nodes in the initial graph, sum the distance function values between any two nodes in all the nodes in the initial graph, and score the aesthetic degree according to the sum value. With two nodes x i X j For example, in acquiring two nodes x i 、x j After the coordinates of (2), the distance function value between the two nodes is calculated by using the following distance function:
wherein x is i1 Representing node x i Center point abscissa, x on grid mark matrix i2 Representing node x i Is defined by the center point ordinate of the lens. w (w) i ' represents node x i The width occupied by the grid mark matrix is equal to the actual width w of the node i +δ divided by c, then rounding up to occupy an integer of the grid width, δ being the minimum spacing parameter, c being the width of one cell of the grid, preferably one cell being a square, can be adaptively adjusted according to the size of the node block input. In formula 1, h i ' represents node x i The height occupied by the grid marking matrix, alpha, is a preset super parameter used for adjusting the proportion between the Euclidean distance and the alignment function. Node x j The meaning of the representation is similar and will not be described in detail.
The larger the distance function value calculated by the formula 1 is, the worse the aesthetic degree is indicated, the smaller the calculated distance function value is, the better the aesthetic degree is indicated, because the first part of the distance function represents the Euclidean distance between two nodes with topological connection, if the Euclidean distance is too large, the discrepancy that the local adjacent in the topological structure is too far away from the actual position exists in the layout, and the discrepancy can potentially bring about subsequent bending and increase of the number of intersections; the second part is an alignment aesthetic measure designed for the grid.
For other nodes of the composite graph, the distance function value between any two other nodes is calculated by adopting the formula 1, the distance function values of all any two nodes are added to obtain the sum of the distance function values, and the attractiveness is considered according to the sum of the distance function values.
The width c of a cell can be calculated using the following formula:
where lmin=min (min (w i +δ),min(h i +δ)),Lmax=max(max(w i +δ),max(h i +δ)),w i And h i Respectively node x i Delta is the minimum spacing parameter. Further, the total area of all nodes can be limited to occupy the area of the whole network canvas, for example, 20%, on the basis of which the length and the width of the grid canvas are continuously calculated, the number of cells needed by the canvas is calculated, and the cell data of each row and each column are taken as integers.
After calculating the distance function value, the embodiment further calculates a bending function value of each node, where the bending function value of one node is a bending function between the node and a node having a topological connection with the node, and the embodiment needs to calculate a total of the bending function values of all the nodes, so as to score the aesthetic degree by using the total of the bending function values.
With set node x i And x j For example, assume node x i And x j With topological connection, node x needs to be calculated i 、x j Is a bending function value of (a). Specifically, the formula of formula 2 can be used for calculation:
wherein Degree (vi) represents node x i I.e. the number of connections to other nodes. E is the set of all sides of the graph, and beta is a preset weight. In equation 3, the sum inner division represents node x i 、x j Formed vector and node x i 、x j’ The sine value of the angle between the vectors formed, where the numerator is the modulo of the outer product calculation of the two vectors and the denominator is the product of the modulo of each of the two vectors. Node x j’ Is another and node x i Nodes with topological connections.
3 embody a plurality of points and nodes x i And calculating an included angle during connection, wherein if the joint is not bent, the result of the formula 3 is minimum and is 0.
Through the two functions, the layout of the node positions on the grid marking matrix can be aimed at currently, so that a specific aesthetic degree quantization value can be given, and the layout of each node can be continuously optimized according to the considerable score.
Then, step S5 is executed to iteratively optimize the layout of the positions of the respective nodes. Specifically, in this embodiment, two local optimization strategies and a global compaction optimization model are adopted to optimize the layout of each node.
The first local optimization strategy is single-point local optimization, namely, for a single node, searching a possibly more appropriate position and optimizing. For example, after determining the current layout position of each node, it is assumed that each node next has better positions with very large neighbor properties with those nodes that it has a topological connection to. In other words, node x i Is optimized from the current and node x i Some weighted representation of all nodes connected, while at the same time in order not to lose the last node x i Is to optimize node x in the next step i Only search in a local area is performed. In this embodiment, all local placeable nodes x are searched i And picking out the blank position corresponding to the position with the best aesthetic degree compared with the previous position.
The second local optimization strategy is local optimization of multi-point exchange, namely, if the positions of two nodes are exchanged in two nodes with the distance smaller than a preset value, whether the attractiveness is better or not after the two nodes with the exchanged positions are calculated. Specifically, search and node x i Other nodes in the local area with a relatively short distance are searched to obtain other nodes and a node x i And trying to exchange one by one, and picking out the node group of the optimal exchange to obtain the position of each new node after the multipoint exchange.
Since the individual local optimization strategy is likely to not change the quality of the obtained solution after a few operations, the present embodiment introduces a global compaction optimization model for iterative optimization. From the relative positions of the current node layouts, for example, a quadratic compaction model with multiple constraints is constructed from the visual information, taking the x-direction compaction of the horizontal axis as an example, the following formula is used for calculation:
wherein s.t is a constraint, derived from the visual information shown in FIG. 5, when node x i See node x from left to right j The minimum distance that should be kept from each other is node x i R times the width. It can be understood that the model belongs to a constrained sparse symmetric positive quadratic solution, so that the optimization cost is small, namely the calculation amount is not large.
After performing an iterative calculation, performing step S6 to score the beauty of the current layout, that is, performing scoring by adopting the two functions of step S4, and performing step S7 to determine whether the beauty score of the new layout is not improved after optimization, for example, the beauty score of the current layout is lower than the previous score, or the beauty score of the current layout is improved by not more than 3% compared with the previous beauty score, then the beauty score can be considered not to be improved. If the aesthetic degree score is obviously improved after the current iterative calculation, that is, the judgment result of the step S7 is no, the step S5 is executed again, and the optimization iterative calculation is continued. If the aesthetic degree score after the current iterative calculation is not improved, executing step S8, and determining the position coordinate information of each node under the current layout.
Preferably, in the process of loop iteration, a simulated annealing algorithm can be adopted to carry out iterative solution. In this embodiment, the simulated annealing algorithm iterative solution is performed in combination with the local optimization and the global compaction optimization at the previous layout position iterative optimization. For example, after initial position coordinates of a plurality of nodes are obtained after initializing the layout, an initial temperature T is set, and this embodiment uses force-directed initialization as an example, and sets the initial temperatureWhere N is the total number of nodes in the graph. Of course, if the initialized layout is believed to be already very effective, the initial temperature T may be set smaller.
Thereafter, during iterative optimization of layout positions, the search range of the local optimization strategy is the current node position x of the local optimization strategy i And (3) performing local layout optimization in the range of +rand (-T, T), wherein rand is a random function meeting uniform distribution, and the value is between-T and T. Meanwhile, after one layout position iteration is finished, the temperature T starts to automatically drop, and T=k×T is the coefficient of dropWhere maxiters is the maximum number of iteration steps of the iterator, it can be seen that k is a fraction greater than 0 and less than 1, and that the temperature of T decays to 0 (anneals) after multiple iterations.
At this time, the format x of the local disturbance i +rand (-0, 0) is the last step x i . Thus, when the temperature t=0, the global optimization is no longer improved in layout, the overall optimization and promotion are no longer performed for the aesthetic evaluation, the iterative calculation of the overall layout is stopped, and the node position coordinates given by the optimizer are output.
Finally, step S9 is executed, where an orthogonal routing plan of the edge relationship between the nodes is generated according to the obtained optimal node position coordinates, and an orthogonal routing connector is combined, for example, an internationally-commonly-known orthogonal routing connector may be used to perform the orthogonal routing plan, where the orthogonal routing connector is written based on c++ and the internal implementation is based on an a-x algorithm. After the orthogonal line planning is obtained, step S10 is performed to label and render the graph, for example, label each node, such as labeling the power equipment name of the node, and step S11 is performed to output the final composite graph.
By applying the method, the aesthetic degree evaluation function of the map layout with small calculation cost and easy code realization is adopted, so that the aesthetic degree of the layout can be rapidly and objectively evaluated, iterative calculation can be performed based on the evaluation result, the termination condition of the iterative calculation can be determined, the evaluation of the aesthetic degree of the layout is more objective, and the automatic realization of the iterative calculation of the layout is facilitated. In addition, the invention is based on a grid dividing method, and the grid marking matrix is adopted to rapidly position the blank area and the placement condition of the peripheral nodes of each node, thereby providing a foundation for layout optimization. In addition, the invention provides a single-point local optimization strategy and a multi-point exchange local optimization strategy of the nodes, the layout positions of iterative nodes are continuously optimized by the feedback score of the attractiveness, meanwhile, the design of a compaction function is adopted, the relative position constraint of a visible view is considered, and the compact layout is generated by optimizing the quadratic form of the compaction function.
It should be noted that, the application result of the orthogonal layout of the composite graph in this embodiment is not limited to drawing the power equipment deployment graph, but may be applied to drawing other composite graphs, such as drawing a flowchart, a UML class graph in software engineering, an ER graph in database management, a traffic network graph, a social network graph, a bioinformatics or chemical molecular bond composition graph, etc., which may be automatically generated based on the orthogonal layout. Meanwhile, the embodiment can also be used for creating VLSI (very large scale integration) design and also can be used for design layout of PCB or electronic components.
In addition, in the embodiment, more changes can be applied, for example, for meeting the constraint condition of the composite nested node, under the position search of a local blank area in the optimization process, the nested constraint condition which is not met originally is projected into the local constraint position solution space, for example, a group of switch devices are required to be of a fixed length and can only be placed horizontally or vertically at the same time, and then the switch device pair is determined to be projected into a blank grid solution in the horizontal or vertical direction during the local search.
When the orthogonal paths are connected, after the node position optimization coordinates are obtained, the orthogonal wiring operation of the edges is executed, and the final orthogonal layout drawing of the power grid is obtained through actual rendering and marking. The practical effect can be found that under the combination of global compaction optimization and local optimization strategies, the overall alignment effect, less intersection of wiring, improvement of the filling sense of canvas drawings and the like are well ensured.
Computer apparatus embodiment:
the computer device of the present embodiment may be a computer device, for example, a desktop computer, a smart phone, or the like, and preferably, the computer device is provided with a controller and a memory, in which a computer program that can be run on the controller is stored, and the controller implements the steps of the compact compound diagram orthogonal layout method based on meshing when executing the computer program.
For example, a computer program may be split into one or more modules, which are stored in memory and executed by a processor to perform the various modules of the invention. One or more of the modules may be a series of computer program instruction segments capable of performing specific functions for describing the execution of the computer program in the terminal device.
The controller may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor being a control center of the appliance, and the various interfaces and lines being used to connect various parts of the entire appliance.
The memory may be used to store computer programs and/or modules, and the processor implements various functions of the appliance by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the appliance, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
Computer-readable storage medium:
the computer program stored in the memory of the computer device may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as a stand alone product. Based on such understanding, the present invention may implement all or part of the flow in the above-described embodiment method, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and the computer program may implement the steps of the above-described compact composite graph orthogonal layout method based on grid division when executed by a processor.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable medium can be appropriately increased or decreased according to the requirements of the jurisdiction's jurisdiction and the patent practice, for example, in some jurisdictions, the computer readable medium does not include electrical carrier signals and telecommunication signals according to the jurisdiction and the patent practice.
Finally, it should be emphasized that the invention is not limited to the above-described embodiments, such as for example, iterative optimization of specific method changes, or calculation of cell width changes, etc., which are also intended to be included within the scope of the invention.
Claims (10)
1. The compact composite graph orthogonal layout method based on grid division comprises the following steps:
obtaining initial graph data, wherein the initial graph data comprises node quantity and node position limiting information of a graph;
preprocessing the initial figure data;
the method is characterized in that:
initializing layout of each node according to the initial data of the graph, adaptively calculating the size of grids and the size of cells required to be divided for layout of the graph, and updating the information of a grid marking matrix;
grading the aesthetic degree of the initial graph after the layout is initialized, and carrying out iterative optimization calculation on the initial graph until the grading of the aesthetic degree of the initial graph is not improved any more, so as to obtain the position coordinate information of each node in the final optimized graph;
and generating an orthogonal line plan of the side relationship between the nodes according to the position coordinate information of the nodes, and marking and rendering to obtain an orthogonal layout.
2. The meshing-based compact compound map orthogonal layout method of claim 1, wherein:
scoring the aesthetic degree of the initial graphic after initializing the layout includes:
and calculating the distance function value between any two nodes in the initial graph, summing the distance function values between any two nodes in all the nodes in the initial graph, and scoring the attractiveness according to the sum.
3. The meshing-based compact compound map orthogonal layout method of claim 1, wherein:
scoring the aesthetic degree of the initial graphic after initializing the layout includes:
and calculating the bending function value of each node, wherein the bending function value of one node is the bending function between the node and the node which is in topological connection with the node, calculating the total bending function value of all the nodes, and grading the attractiveness according to the total bending function value.
4. A compact compound map orthogonal layout method based on meshing as claimed in any one of claims 1 to 3, wherein:
performing iterative optimization calculation on the initial graph comprises:
after determining the current position of a target node, selecting a better layout position of the target node, and calculating the grading value of the beauty degree of the initial graph of the target node at the better layout position.
5. A compact compound map orthogonal layout method based on meshing as claimed in any one of claims 1 to 3, wherein:
performing iterative optimization calculation on the initial graph comprises:
and carrying out position exchange on the two nodes with the distance smaller than the preset value in the initial graph, and calculating the grading value of the aesthetic degree of the initial graph after the node position exchange.
6. A compact compound map orthogonal layout method based on meshing as claimed in any one of claims 1 to 3, wherein:
performing iterative optimization calculation on the initial graph comprises:
and constructing a quadratic compaction model function with constraint, solving the quadratic compaction model function, re-determining the position of the node according to the solving result, and scoring the aesthetic degree of the initial graph according to the re-determined node position.
7. A compact compound map orthogonal layout method based on meshing as claimed in any one of claims 1 to 3, wherein:
and when the initial graph is subjected to iterative optimization calculation, carrying out iterative solution by using a simulated annealing algorithm.
8. A compact compound map orthogonal layout method based on meshing as claimed in any one of claims 1 to 3, wherein:
the information of the grid marking matrix comprises the size of the grid marking matrix, the position of each node in the grid marking matrix, the blank area of the grid marking matrix and the visible node of each node in the transverse and longitudinal directions.
9. Computer arrangement, characterized in that it comprises a processor and a memory, said memory storing a computer program which, when executed by said processor, implements the respective steps of the compact compound diagram orthogonal layout method based on meshing as claimed in any one of claims 1 to 8.
10. A computer readable storage medium having stored thereon a computer program characterized by: the computer program, when executed by a processor, implements the steps of the meshing-based compact compound map orthogonal layout method of any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310583456.4A CN116843857A (en) | 2023-05-23 | 2023-05-23 | Compact composite graph orthogonal layout method based on grid division, computer device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310583456.4A CN116843857A (en) | 2023-05-23 | 2023-05-23 | Compact composite graph orthogonal layout method based on grid division, computer device and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116843857A true CN116843857A (en) | 2023-10-03 |
Family
ID=88173244
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310583456.4A Pending CN116843857A (en) | 2023-05-23 | 2023-05-23 | Compact composite graph orthogonal layout method based on grid division, computer device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116843857A (en) |
-
2023
- 2023-05-23 CN CN202310583456.4A patent/CN116843857A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112257597B (en) | Semantic segmentation method for point cloud data | |
US9177421B2 (en) | Hair meshes | |
CN106202662A (en) | A kind of distribution network structure figure draws mapping method automatically | |
CN107958484A (en) | Texture coordinate computational methods and device | |
CN103049932B (en) | A kind of plant three-dimensional shape virtual modeling method based on radial basis function | |
CN114820990B (en) | Digital twin-based river basin flood control visualization method and system | |
CN110502803A (en) | Wiring method and device based on BIM technology | |
CN112332306A (en) | Automatic cable laying method and storage medium | |
CN111241646A (en) | Layout method of power grid equipment and computer readable storage medium | |
CN114693856B (en) | Object generation method and device, computer equipment and storage medium | |
CN112070261A (en) | Method for automatically generating plant station internal wiring diagram based on CIME power grid model | |
CN105894553B (en) | A kind of Street Space form layout method based on grid selection | |
CN110853120B (en) | Network layout method, system and medium based on segmentation drawing method | |
Parent | Shape transformation by boundary representation interpolation: a recursive approach to establishing face correspondences | |
CN106934205A (en) | The methods of exhibiting and device of a kind of data correlation relation | |
CN116843857A (en) | Compact composite graph orthogonal layout method based on grid division, computer device and computer readable storage medium | |
CN109598672A (en) | A kind of map road rendering method and device | |
CN107330209A (en) | A kind of moulding wall intelligent template implementation method based on Parametric designing | |
CN115544634B (en) | Oil and gas field level digital twin model space coordinate transformation method and system | |
CN106952321A (en) | The method and device that a kind of cable passage sectional drawing is automatically generated | |
CN114254467B (en) | Method for generating power grid ring network graph | |
CN103077554B (en) | Based on the crop Interactive Design method and system of joint unit | |
CN115688341A (en) | Distribution network thematic map layout method based on multi-branch tree collision detection and storage medium | |
CN115577480A (en) | Distribution network contact graph automatic generation method | |
Lin et al. | Automatic generation of puzzle tile maps for spatial-temporal data visualization |
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 |