CN111241348B - Method for dynamically adjusting Tree spacing based on Walker's Tree - Google Patents
Method for dynamically adjusting Tree spacing based on Walker's Tree Download PDFInfo
- Publication number
- CN111241348B CN111241348B CN201911410941.1A CN201911410941A CN111241348B CN 111241348 B CN111241348 B CN 111241348B CN 201911410941 A CN201911410941 A CN 201911410941A CN 111241348 B CN111241348 B CN 111241348B
- Authority
- CN
- China
- Prior art keywords
- tree
- node
- nodes
- layer
- subtree
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 230000010365 information processing Effects 0.000 claims abstract description 4
- 238000000926 separation method Methods 0.000 claims description 12
- 230000000694 effects Effects 0.000 claims description 4
- 238000010586 diagram Methods 0.000 abstract description 5
- 238000013507 mapping Methods 0.000 abstract description 2
- 239000010410 layer Substances 0.000 description 32
- 239000003607 modifier Substances 0.000 description 3
- 239000011229 interlayer Substances 0.000 description 2
- 238000003672 processing method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9027—Trees
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Image Generation (AREA)
Abstract
The invention discloses a method for dynamically adjusting Tree spacing based on Walker's Tree, and relates to the field of automatic mapping of structural trees. The Walker's Tree algorithm effectively solves the two problems that the width of the drawn Tree is very wide and the parent node in the Tree is not the central position of all child nodes, and the only disadvantage is that the space in the Tree is not considered to be dynamically adjusted. The method comprises the following steps: 1) Performing data topology information processing; 2) Building a tree structure model; 3) Performing subsequent traversal on all nodes in the tree model, and calculating an initial value and an adjustment value of each node coordinate in the tree; 4) Performing preamble traversal, and calculating the final coordinates of each node in the tree; 5) And outputting the graph of the tree. The method not only ensures the symmetry of the father node about the child nodes, but also ensures that the distance between the tree structures can be dynamically adjusted according to the size of the nodes, can meet the different sizes of the nodes in the tree, has uncongested tree structures and is neat as a whole, and complete tree diagram output is realized.
Description
Technical Field
The invention relates to the field of automatic mapping of structural trees, in particular to a method for dynamically adjusting Tree spacing based on Walker's Tree.
Background
The key task of drawing a tree is to determine the location of each node in the tree. The tree-drawing algorithm is mainly to calculate the x and y coordinates of each node of the tree. These coordinates can then be used to draw a tree. Where the node location algorithm must address two key issues. First, the overall aesthetics of the drawn tree. Second, the node location algorithm should save space. Each of these two problems can be handled directly, but combining them together presents some challenges.
The tree drawing algorithm proposed by many researchers also has the condition that the result of drawing the tree is not satisfactory, and mainly three problems need to be solved, namely 1) the width of the drawn tree is very wide; 2) Parent nodes in the tree are not central locations of all of its child nodes; 3) Each level of spacing in the tree is fixed, a fixed constant, and this arrangement does not take into account the effect between the size and spacing of the nodes at the upper and lower levels.
The Walker's Tree algorithm effectively solves the first two problems, and the only disadvantage is that the space in the Tree is not considered in dynamic adjustment, so that the Tree structure is attractive as a whole and the hierarchical structure of the Tree is not very high in abrupt effect.
Disclosure of Invention
The invention aims to solve the technical problems and the technical task of improving the prior art scheme, and provides a method for dynamically adjusting the Tree spacing based on Walker's Tree, which aims to dynamically adjust the spacing in the Tree and realize a perfect Tree diagram. For this purpose, the present invention adopts the following technical scheme.
A method for dynamically adjusting Tree spacing based on Walker's Tree comprises the following steps:
1) Firstly, data topology information processing is carried out, tree node objects are established, and tree node attributes are initialized;
2) Establishing a tree structure model, and processing father-son relations of each node in a tree;
3) Performing subsequent traversal on all nodes in the tree model, and calculating an initial value and an adjustment value of each node coordinate in the tree;
4) Performing preamble traversal, and calculating the final coordinates of each node in the tree;
5) And outputting the graph of the tree.
The method not only ensures the symmetry of the father node about the child nodes, but also ensures that the distance between the tree structures can be dynamically adjusted according to the size of the nodes, can meet the different sizes of the nodes in the tree, has uncongested tree structures and is neat as a whole, and complete tree diagram output is realized.
As a preferable technical means: in step 3), the adjustment value is set for the following case: when the current node has a left brother node, the size of the node and the node distance between the two nodes need to be considered in order to separate the two nodes by a certain distance; when the current node is the father node of a subtree, the child nodes are considered layer by layer whether to cross with the nodes of other subtrees, if so, the distance of the subtrees is pulled.
As a preferable technical means: in step 3), the subsequent traversal starts with the smallest subtree leaf node, recursively constructs larger subtrees from left to right, wherein a certain distance Sibling Separation is ensured between sibling nodes, a certain distance Sibling Separation is ensured between adjacent subtrees, when the traversal of the tree is from the leaf node to the root node, the smaller subtrees and the root node thereof are combined together to form a larger subtree, the fixed subtree is moved from left to right one by one, the positioning is performed, when one new subtree is designed, the new subtree is placed at the left of the neighbor, the moving process starts with the root node of the subtree until the new subtree is not intersected with other nodes, the distances defined by Silbling Separation are separated by the next layer, the next layer is separated by the distances defined by Subtree Separation, and the node is continued to the next layer in sequence until the root node of the subtree is completed, and is positioned at all intermediate positions of all the child nodes at the left and right of the node. The subsequent traversal is effectively realized, whether the subtrees and the laid-out subtrees are crossed or not is considered, and the distance between the adjacent nodes is calculated according to the sizes of the adjacent nodes.
As a preferable technical means: before the preamble traversal, the tree nodes of each layer need to be traversed layer by layer, the sizes of all the nodes of the layer are judged, the layer spacing of the upper layer is set according to the largest node, and after all the layer spacing is set, the preamble traversal is performed to set the coordinates of each node. The process starts with the root node of the tree, and adds the value of the abscissa to the adjustment value of all ancestor nodes, namely the coordinate value of the node. The preamble traversal is effectively realized, and the inter-layer distance of each layer is adjusted according to the size of the layer node.
The beneficial effects are that: the method not only ensures the symmetry of the father node about the child nodes, but also ensures that the distance between the tree structures can be dynamically adjusted according to the size of the nodes, can meet the different sizes of the nodes in the tree, has uncongested tree structures and is neat as a whole, and complete tree diagram output is realized.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
FIG. 2 is an exemplary tree diagram of a subsequent traversal and a previous traversal of the present invention.
Detailed Description
The technical scheme of the invention is further described in detail below with reference to the attached drawings.
As shown in fig. 1, a method for dynamically adjusting Tree spacing based on Walker's Tree comprises the following steps:
1) Firstly, data topology information processing is carried out, tree node objects are established, and tree node attributes are initialized;
2) Establishing a tree structure model, and processing father-son relations of each node in the tree, wherein the tree in the example is a tree with only one root node;
3) Performing subsequent traversal, and calculating initial values and adjustment values of coordinates of each node in the tree, wherein the adjustment values are set for the following cases: when the current node has a left brother node, the size of the node and the node distance between the two nodes need to be considered in order to separate the two nodes by a certain distance; when the current node is a father node of a subtree, considering whether child nodes of the current node intersect with nodes of other subtrees layer by layer, and if so, pulling the distance of the subtrees;
4) Performing preamble traversal, and calculating the final coordinate of each node in the tree, wherein the direction of the tree is downward, so that the ordinate of the tree node is mainly determined by the number of layers of the tree node and the size of the upper and lower layers of nodes;
5) And outputting the graph of the tree.
The subsequent traversal and the preamble traversal embody the process of dynamically adjusting the tree spacing. The subsequent traversal process not only determines the initial value and the adjustment value of each node coordinate, but also adjusts the distance between two nodes according to neighboring nodes. The preamble traversal mainly dynamically sets the layer spacing of each layer according to the size of each layer of nodes, and then determines the coordinate value of each node.
The subsequent traversal, first recursively constructs the larger subtree starting from the smallest subtree leaf node, recursively moving from left to right, where it is ensured that there is a distance Sibling Separation between sibling nodes, and there is a distance Sibling Separation between neighboring subtrees, when traversing the tree from the leaf node to the root node, it combines the smaller subtree with its root node to form a larger subtree, for a fixed node, the subtree is moved from left to right one by one, positioned, when one new subtree has been designed, the new subtree is placed to the left of the neighbor until it is moved until it does not intersect with other nodes, the moving process begins with the root node of their subtree, separated by the distance defined by Silbling Separation, and the next layer of subtrees separated by the distance defined by Subtree Separation, such a sequential next layer continues until it goes to the root node of the subtree, and when the left and right child nodes for that node are completed, the node is in the middle of all child nodes to the left and right of that node.
The following are examples of the subsequent traversal and the preamble traversal.
As shown in fig. 2, the subsequent traversal sequence is: EIPHBCKMNQRSGDA. From this sequence, the node that needs to be accessed first is the left leaf node E. Since there are no siblings to the left of node E, the prelimrary Value of the E node is set to 0 directly, and the initial Value of modeifiervalue is also set to 0. The next node processed is the I node, which is also the leaf node, and there is no left sibling node, so the preliminaryValue of node I is set to 0 and the ModifierValue is set to 0. Further processing is a leaf node P. The P node is a leaf node, has a left sibling node I, so p.prelimnaryvalue=i.prelimnaryvalue +: sibingseparation+treenodsize=0+4+2=6. When processing node B, its refmosteno=e (leftmost child node), lightmosteno=e (rightmost child node), and node H has no left sibling node, so b.prelimnaryvalue= (epreimnaryvalue+e.prelimnaryvalue)/2; the processing of node B (processing method of node E) is then continued. Node F is also a leaf node and thus is the same as the processing method of node I. Node D and node B are already a subtree. It is necessary to determine whether or not the nodes of the lower layers overlap layer by layer. If there is a crossing and overlapping, then moving the D sub-tree a corresponding distance avoids the crossing and overlapping.
Before the preamble traversal, traversing tree nodes of each layer by layer, judging the sizes of all nodes of the layer, setting the layer spacing of the upper layer according to the largest node, and performing the preamble traversal to set the coordinates of each node after the layer spacing is set. The process starts with the root node of the tree, and adds the value of the abscissa to the adjustment value of all ancestor nodes, namely the coordinate value of the node.
As shown in fig. 2, the preamble traversal sequence is: ABEHIPCDKGMNQRS. The abscissa of each node in the graph is the prelimnaryvalue+all and modifier's modifier value. The abscissa of each node in the graph can be calculated according to the first, subsequent traversal process. For example: root node A: 13.5, B: pre limnaryvalue+a.modifier value=3+0=3; ........... The coordinate values of each node in the tree can be calculated.
The invention is mainly based on the improved algorithm proposed by Walker's Tree algorithm-dynamic adjustment of the inter-layer distance of the Tree structure. The obtained tree can meet the effects that the size of nodes in the tree is different, the structure of the tree is not crowded, and the whole tree is tidy and attractive.
The method for dynamically adjusting the Tree spacing based on the Walker's Tree shown in the above figures 1-2 is a specific embodiment of the present invention, has already demonstrated the outstanding essential characteristics and significant progress of the present invention, and can be modified in terms of shape, structure, etc. according to practical use requirements, under the teaching of the present invention, all of which are within the scope of protection of the present invention.
Claims (4)
1. A method for dynamically adjusting Tree spacing of a drawn Tree based on Walker's Tree includes calculating x and y coordinates of each node of the Tree, and then drawing the Tree using the calculated coordinates; the method is characterized by comprising the following steps of:
1) Firstly, data topology information processing is carried out, tree node objects are established, and tree node attributes are initialized;
2) Establishing a tree structure model, and processing father-son relations of each node in a tree;
3) Performing subsequent traversal on all nodes in the tree model, and calculating an initial value and an adjustment value of each node coordinate in the tree;
4) Performing preamble traversal, calculating final coordinates of each node in the tree, traversing the tree nodes of each layer by layer before the preamble traversal, judging the sizes of all the nodes of the layer, setting the layer spacing of the upper layer according to the largest node, performing the preamble traversal after all the layer spacing is set, and setting the coordinates of each node to realize the effect of dynamically adjusting the layer spacing of the tree structure, so that the output tree graph can achieve different sizes of the nodes in the tree, and the structure of the tree is not crowded and the whole is neat and attractive;
5) Outputting a graph of the tree to obtain a tree graph; the situation that the space in the Tree graph drawing is dynamically adjusted is avoided because Walker's Tree does not consider, so that the Tree graph drawing structure is attractive as a whole, and meanwhile, the hierarchical structure of the Tree is not quite high and abrupt.
2. The Tree drawing method based on Walker's Tree dynamic adjustment of Tree spacing according to claim 1, wherein the Tree drawing method is characterized in that: in step 3), the adjustment value is set for the following case: when the current node has a left brother node, the size of the node and the node distance between the two nodes need to be considered in order to separate the two nodes by a certain distance; when the current node is the father node of a subtree, the child nodes are considered layer by layer whether to cross with the nodes of other subtrees, if so, the distance of the subtrees is pulled.
3. The Tree drawing method based on Walker's Tree dynamic adjustment of Tree spacing according to claim 1, wherein the Tree drawing method is characterized in that: in step 3), the subsequent traversal starts with the smallest subtree leaf node, recursively constructs larger subtrees from left to right, wherein a certain distance Sibling Separation is ensured between sibling nodes, a certain distance Sibling Separation is ensured between adjacent subtrees, when the traversal of the tree is from the leaf node to the root node, the smaller subtrees and the root node thereof are combined together to form a larger subtree, the fixed subtree is moved from left to right one by one, the positioning is performed, when one new subtree is designed, the new subtree is placed at the left of the neighbor, the moving process starts with the root node of the subtree until the new subtree is not intersected with other nodes, the distances defined by Silbling Separation are separated by the next layer, the next layer is separated by the distances defined by Subtree Separation, and the node is continued to the next layer in sequence until the root node of the subtree is completed, and is positioned at all intermediate positions of all the child nodes at the left and right of the node.
4. The Tree drawing method based on Walker's Tree dynamic adjustment of Tree spacing according to claim 1, wherein the Tree drawing method is characterized in that: in step 4), starting from the root node of the tree, adding the value of the abscissa and the adjustment values of all ancestor nodes thereof together, namely the coordinate value of the node.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911410941.1A CN111241348B (en) | 2019-12-31 | 2019-12-31 | Method for dynamically adjusting Tree spacing based on Walker's Tree |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911410941.1A CN111241348B (en) | 2019-12-31 | 2019-12-31 | Method for dynamically adjusting Tree spacing based on Walker's Tree |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111241348A CN111241348A (en) | 2020-06-05 |
CN111241348B true CN111241348B (en) | 2024-03-01 |
Family
ID=70864914
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911410941.1A Active CN111241348B (en) | 2019-12-31 | 2019-12-31 | Method for dynamically adjusting Tree spacing based on Walker's Tree |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111241348B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342907B (en) * | 2021-06-29 | 2023-02-21 | 积成电子股份有限公司 | Energy consumption information acquisition system distribution room topology portrait drawing method and system |
CN113496358A (en) * | 2021-07-13 | 2021-10-12 | 大唐互联科技(武汉)有限公司 | Index decomposition tree layout algorithm based on intelligent performance operation platform |
CN115166186A (en) * | 2022-08-08 | 2022-10-11 | 广东长天思源环保科技股份有限公司 | Online automatic monitoring system for water quality of water inlet of sewage treatment enterprise |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6978271B1 (en) * | 2000-10-31 | 2005-12-20 | Unisys Corporation | Mechanism for continuable calls to partially traverse a dynamic general tree |
CN102413509A (en) * | 2011-11-09 | 2012-04-11 | 中国科学院上海微系统与信息技术研究所 | Construction method of time-delay-constrained energy consumption balance data acquisition tree in WSN (Wireless Sensor Network) |
CN104915952A (en) * | 2015-05-15 | 2015-09-16 | 中国科学院上海微系统与信息技术研究所 | Method for extracting local salient objects in depth image based on multi-way tree |
CN106059861A (en) * | 2016-07-26 | 2016-10-26 | 河南工程学院 | Distributed construction system and method for internet of things minimum dynamic aggregation tree |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10078801B2 (en) * | 2015-09-03 | 2018-09-18 | Ali Abbas | System, method and software for representing decision trees |
US10067966B2 (en) * | 2015-09-29 | 2018-09-04 | Vmware, Inc. | Leveraging hierarchy in a tree data structure to dynamically allocate keys |
CN113326403B (en) * | 2021-06-16 | 2024-06-18 | 北京百度网讯科技有限公司 | Flow chart rendering method and device, electronic equipment and medium |
-
2019
- 2019-12-31 CN CN201911410941.1A patent/CN111241348B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6978271B1 (en) * | 2000-10-31 | 2005-12-20 | Unisys Corporation | Mechanism for continuable calls to partially traverse a dynamic general tree |
CN102413509A (en) * | 2011-11-09 | 2012-04-11 | 中国科学院上海微系统与信息技术研究所 | Construction method of time-delay-constrained energy consumption balance data acquisition tree in WSN (Wireless Sensor Network) |
CN104915952A (en) * | 2015-05-15 | 2015-09-16 | 中国科学院上海微系统与信息技术研究所 | Method for extracting local salient objects in depth image based on multi-way tree |
CN106059861A (en) * | 2016-07-26 | 2016-10-26 | 河南工程学院 | Distributed construction system and method for internet of things minimum dynamic aggregation tree |
Non-Patent Citations (2)
Title |
---|
关于随机树上λ-随机游动速度的一个注记;陈大岳;章复熹;;中国科学:数学(第05期);全文 * |
故障树自动生成系统的树图布局算法研究;孔涛;熊毅;;中国安全科学学报(第05期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111241348A (en) | 2020-06-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111241348B (en) | Method for dynamically adjusting Tree spacing based on Walker's Tree | |
CN106484754B (en) | Knowledge forest layout method based on hierarchical data Yu diagram data visualization technique | |
US20220092094A1 (en) | Identifying and graphically representing multiple parent nodes of a child node | |
CN106294664B (en) | Method and device for generating thinking guide graph | |
US20120005608A1 (en) | Smart copy/paste of graphical nodes | |
CN110084741B (en) | Image wind channel migration method based on saliency detection and depth convolution neural network | |
CN109146946B (en) | Image non-local stereo matching method | |
US20220327148A1 (en) | Identifying Missing Nodes Within a Graphically Represented Family | |
CN110795093B (en) | Interactive view generation method and device | |
US20220083574A1 (en) | Graphically Representing Related Record Families Using a Phantom Parent Node | |
CN101075349A (en) | Method for demonstrating cartoon effect in SVG | |
CN107566875A (en) | A kind of UI flexible configurations on Intelligent set top box, the method for dynamic renewal | |
CN103853775A (en) | Method for converting data storage format based on multimedia data | |
CN111241779B (en) | Method for designing irregular parallel lines based on Cadence design software | |
CN113268241B (en) | Html 5-based flow chart automatic layout method | |
CN106527912A (en) | Voronoi tree graph-based information retrieval visualization system and method | |
CN108108430A (en) | A kind of method realized based on Unity3D knowledge forests virtual reality system | |
CN1584932A (en) | Optimizing method for image transfigure border side tracking | |
CN107436759B (en) | Multi-level list display method for android system | |
CN110995876A (en) | Method and device for IP storage and search | |
CN115563413A (en) | An Efficient Hierarchical Presentation Method for Large-Scale Networks | |
CN110838161B (en) | Method for aggregating large-batch graph nodes of OSG in three-dimensional scene | |
CN105786331A (en) | Improved focus navigation algorithm based on browser | |
CN115202553A (en) | Control method, device and electronic device for whiteboard application | |
CN107133379B (en) | Modeling system and method for extra-high voltage tower column |
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 |