Method and device for generating tree structure, electronic equipment and storage medium
Through the spanning tree structure method, the association relationship between multiple nodes is obtained and displayed, and the problem of unvisible association relationships in the existing technology is solved, and the clear display of task relationships and the improvement of production efficiency is achieved.
Patent Information
- Application Number
- CN202411847596.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-11
AI Technical Summary
There are a large number of things that have relationships in real life, but they only have theoretical relationships and no visual relationships.
By obtaining the association relationship between multiple nodes, traversing these nodes, configuring a coordinate for each node, and determining a tree structure based on these coordinates, finally displaying the tree structure.
Clearly demonstrate the relationship between tasks, improve production efficiency, reduce production costs, and quickly locate the problem and reduce investment in non-critical factors.
Smart Images

Figure CN119807199A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating a tree structure. Background Art
[0002] Computers are media for storing data. More precisely, computers store data through pre-designed data structures. For example, in an office system, colleague A submits a reimbursement application. Colleague A needs to enter the amount of the expense, the time when the expense occurred, the type of consumption, the reimbursement description, the uploaded invoice, etc. At this time, it is necessary to use the fields in the pre-designed data structure (called data structure A) to receive these reimbursement data for storage. This results in this data structure being able to only store reimbursement data.
[0003] However, the reimbursement data submitted by colleague A is the expenses incurred in completing the company's task (this task is called Task A). Therefore, it is necessary to record the Task A that colleague A is doing. Since data structure A can only store reimbursement data, another data structure (called data structure B) can only be built to store Task A data. In this way, the association relationship between data structure B and data structure A is generated.
[0004] After colleague A submits the reimbursement application, it needs to be reviewed by relevant colleagues (the level-by-level review is not discussed in detail), and the reviewed data needs to be recorded (called data structure C). Then, there will be an association between data structure A and data structure C. Finally, the data that has passed the review will be collected into the daily task of financial colleague B (this task is called task B), so the association between task A and task B is created.
[0005] In fact, there are a lot of such related things in real life. However, they exist independently, and there is only a theoretical relationship, not a visual relationship. Summary of the invention
[0006] The embodiments of the present invention provide a method, device, electronic device and storage medium for generating a tree structure, which are used to solve the problem that there are a large number of things with association relationships in real life, but they only have theoretical association relationships but no visual association relationships.
[0007] In a first aspect, an embodiment of the present invention provides a method for generating a tree structure, comprising:
[0008] Acquire association relationships between multiple nodes, wherein the multiple nodes include data primitive nodes and multi-level sub-nodes, the data primitive nodes are used to represent primitive tasks, and the multi-level sub-nodes are used to represent multi-level sub-tasks under the primitive tasks;
[0009] Traversing the plurality of nodes according to the association relationship, respectively configuring a coordinate for the plurality of nodes, and determining a tree structure according to the coordinates of the plurality of nodes;
[0010] The tree structure is displayed.
[0011] In a possible implementation, the data primitive node, the first first child node associated with the data primitive node, the first second child node associated with the first first child node, and so on, until the first Mth child node associated with the first M-1th child node constitute a trunk association chain, where M is an integer greater than 1.
[0012] In a possible implementation, traversing the multiple nodes according to the association relationship, configuring a coordinate for each of the multiple nodes, and determining a tree structure according to the coordinates of the multiple nodes includes:
[0013] Query each node on the backbone association chain in sequence to form an array A; wherein the abscissa and ordinate of the data primitive node in the array A are initial abscissa values and initial ordinate values respectively, the abscissas of the remaining nodes in the array A are initial abscissa values, and the ordinates of the remaining nodes are incremented in sequence from the initial ordinate values at first preset intervals, and the child nodes of the nodes of the layers with odd sequence numbers in the array A are arranged on the first side of the backbone association chain, and the child nodes of the nodes of the layers with non-odd sequence numbers are arranged on the second side of the backbone association chain;
[0014] Reverse the array A to obtain an array A';
[0015] Query the remaining child nodes of each node in the array A' except the first child node to obtain an array B; wherein the ordinate of each node in the array B is the ordinate of the parent node of the node plus a first preset interval value;
[0016] Determine whether each node in array B has a degree;
[0017] Determine the horizontal coordinate of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the backbone association chain;
[0018] Combine the horizontal coordinate and the vertical coordinate of each node in the array B into a string as the key and the data corresponding to each node in the array B as the value, and add them to the tree structure;
[0019] Recursively execute the above steps.
[0020] In a possible implementation, determining the horizontal coordinate of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the backbone association chain includes:
[0021] According to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the trunk association chain, the horizontal coordinate, the updated second side boundary, and the updated first side boundary of each node in the array B are determined.
[0022] In a possible implementation, determining the horizontal coordinate, the updated second side boundary, and the updated first side boundary of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the trunk association chain includes:
[0023] If the target node in the array B has a degree and the parent node of the target node is located on the first side of the trunk association chain, at this time, if the first side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the second preset interval value; if the first side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the third preset interval value; wherein the updated first side boundary is the horizontal coordinate of the target node;
[0024] If the target node in the array B has a degree and the parent node of the target node is located on the second side of the trunk association chain, at this time, if the second side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fourth preset interval value; if the second side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fifth preset interval value; wherein the updated second side boundary is the horizontal coordinate of the target node;
[0025] If the target node in the array B has no degree and the parent node of the target node is located on the first side of the trunk association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the second preset interval value, and the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the third preset interval value; wherein, the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node;
[0026] If the target node in the array B has no degree and the parent node of the target node is located on the second side of the trunk association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fourth preset interval value, and the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fifth preset interval value; wherein, the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node.
[0027] In a second aspect, an embodiment of the present invention provides a device for generating a tree structure, including:
[0028] An acquisition unit, used for acquiring the inclusion relationship between each node, wherein each node includes a data primitive node and a multi-level sub-node, wherein the data primitive node is used to represent the primitive task, and the multi-level sub-node is used to represent the multi-level sub-task under the primitive task;
[0029] A determination unit, configured to traverse the nodes according to the inclusion relationship, respectively configure a coordinate for each node, and determine a tree structure according to the coordinates of each node;
[0030] A display unit is used to display the tree structure.
[0031] In a possible implementation, the data primitive node, the first first child node associated with the data primitive node, the first second child node associated with the first first child node, and so on, until the first Mth child node associated with the first M-1th child node constitute a trunk association chain, where M is an integer greater than 1.
[0032] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0033] A memory and a processor, wherein the processor and the memory communicate with each other via a bus; the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method described in the first aspect and each step in various possible implementations.
[0034] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect and each step in various possible implementations.
[0035] In a fifth aspect, an embodiment of the present invention provides a computer program product comprising instructions, and when the computer program product is run on a computer, each step in the method described in the first aspect and its various possible implementations is executed by the computer.
[0036] The embodiments of the present invention disclose the following technical effects:
[0037] The embodiment of the present invention can clearly display the relationship between tasks through a tree structure; the tree structure clearly displays the relationship and degree of mutual cooperation among departments; the development trend of things can be intuitively understood; the tree structure displays the advantages of the association relationship in production efficiency, and when a change occurs in one place, the impact on another place associated with it can be seen, which greatly improves production efficiency; it can reduce production costs, and when a problem occurs, it can quickly locate the problem and reduce investment in non-critical factors.
[0038] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A system architecture diagram applicable to the embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of a method for generating a tree structure provided by an embodiment of the present invention;
[0042] Figure 3 A schematic diagram of a tree structure generated according to an embodiment of the present invention;
[0043] Figure 4 Another schematic diagram of a generated tree structure provided by an embodiment of the present invention;
[0044] Figure 5 A schematic diagram of a sequence chain matrix provided by an embodiment of the present invention;
[0045] Figure 6 A schematic diagram showing a positioning function provided by an embodiment of the present invention;
[0046] Figure 7 A schematic block diagram of a device for generating a tree structure provided by an embodiment of the present invention;
[0047] Figure 8 A schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0050] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0051] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if determining" or "if monitoring (stated condition or event)" may be interpreted as "when determining" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0052] In real life, there are a large number of things that have relationships. However, they exist independently and only have theoretical relationships, not visual relationships.
[0053] In view of this, the embodiment of the present invention provides a new idea. In order to facilitate the understanding of the present application, the system architecture based on the embodiment of the present invention is first described. Figure 1 An exemplary system architecture to which the present invention can be applied is shown. Figure 1 As shown in , the system architecture may include a terminal device and a device for generating a tree structure at a server end.
[0054] The terminal devices may include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, PCs (Personal Computers), etc. Smart mobile terminals may include mobile phones, tablet computers, laptop computers, PDAs (Personal Digital Assistants), Internet cars, etc. Smart home devices may include smart TVs, smart refrigerators, etc. Wearable devices may include smart watches, smart glasses, virtual reality devices, augmented reality devices, mixed reality devices (i.e., devices that can support virtual reality and augmented reality), etc.
[0055] The device for generating a tree structure may use the method for generating a tree structure provided in the embodiment of the present invention to generate a tree structure.
[0056] The device for generating a tree structure can be set in a single server, a server group consisting of multiple servers, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in the cloud computing service system to solve the problems of difficult management and weak service scalability in traditional physical hosts and virtual private servers (VPS). Figure 1 In addition to the illustrated architecture, the device for generating a tree structure may also be disposed in a computer terminal with strong computing capability.
[0057] The following is a brief introduction to the terms involved in the embodiments of the present invention.
[0058] Data primitive (also called data primitive node): defines the root (source) as the data primitive. There can be multiple primitives in the system. A data primitive can be associated with one or more child nodes.
[0059] Child node: The node associated with a data primitive node / node itself is called the child node of the data primitive node / node.
[0060] Parent Node: If a node has one or more child nodes, then this node is called the parent node of its child nodes.
[0061] Brother nodes: The child nodes of the same node are called brother nodes.
[0062] Node degree: the number of child nodes a node has.
[0063] Main association chain: The data primitive node, the first first child node associated with the data primitive node, the first second child node associated with the first first child node, and so on, until the first M-1 child node associated with the first M-th child node constitutes the main association chain, where M is an integer greater than 1. There is only one main association chain.
[0064] Association chain: The child nodes associated with the data primitive node, and the child nodes continue to associate until the final chain is called an association chain. There can be multiple association chains.
[0065] Association direction: The original data node is at the bottom, and the trunk association chain is arranged vertically upward. The child node is one layer above the parent node. If the sequence number of the parent node on the trunk association chain is an odd number, the child node of the parent node is arranged on the first side of the trunk association chain. If it is an odd number, the child node of the parent node is arranged on the second side of the trunk association chain. Brother nodes are arranged horizontally in order.
[0066] Coordinates: The tree structure arrangement produces vertical and horizontal development, and thus coordinates. The horizontal coordinate can be expressed as...71, 69, 67, 65, 66, 68, 70... (i.e., the ascii code is...G, E, C, A, B, D, F...) with the trunk association chain as the center and the two sides alternately increasing in the way, and the vertical coordinate is expressed as 0, 1, 2..., based on the data primitive node, and increasing every 1. The horizontal coordinate can also be expressed as...-3, -2, -1, 0, 1, 2, 3..., and the vertical coordinate is expressed as S0, S1, S2... in sequence.
[0067] Block: Data primitive nodes, child nodes, sibling nodes, node degrees, trunk association chains, association chains, association directions, and coordinates are combined into blocks.
[0068] Block Matrix: All blocks are grouped together in order to form a block matrix. Double-clicking a block in the block matrix will open the tree structure.
[0069] In an embodiment of the present invention, the association relationship between each node can be the association relationship between different industries in the economic field, which can promote the prosperity of the entire economic system. For example, with the development of the science and technology industry, it provides technical support and innovation power for emerging industries such as artificial intelligence and big data, and the development of these emerging industries in turn promotes the progress of the science and technology industry, forming a virtuous circle. It can also be the association relationship between teachers and students in the field of education. The teaching level and enthusiasm of teachers can stimulate students' interest in learning and potential, and the progress and achievements of students can motivate teachers to continuously improve their teaching ability. This association relationship plays a key role in improving the quality of education and cultivating outstanding talents.
[0070] Figure 2A flowchart of a method for generating a tree structure provided by an embodiment of the present invention, the method can be Figure 1 The device for generating a tree structure in the system shown is executed. Figure 2 As shown in , the method may include the following steps:
[0071] Step 201: Acquire association relationships between multiple nodes, where the multiple nodes include data primitive nodes and multi-level sub-nodes. The data primitive nodes are used to represent primitive tasks, and the multi-level sub-nodes are used to represent multi-level sub-tasks under the primitive tasks.
[0072] Step 202: traverse multiple nodes according to the association relationship, configure a coordinate for each of the multiple nodes, and determine a tree structure according to the coordinates of the multiple nodes.
[0073] Step 203: Display the tree structure.
[0074] The following is a detailed description of each step in the above process and the effects that can be further produced in conjunction with the embodiments of the present invention. It should be noted that the "first" and "second" limitations involved in the embodiments of the present invention do not have limitations in terms of size, order, and quantity, and are only used to distinguish them in name, for example, "first preset interval value" and "second preset interval value" are used to distinguish two different preset interval values.
[0075] First, in combination with an embodiment of the present invention, the above step 201, i.e., "obtaining the association relationship between multiple nodes, the multiple nodes including data primitive nodes and multi-level sub-nodes, the data primitive nodes are used to represent the primitive tasks, and the multi-level sub-nodes are used to represent the multi-level sub-tasks under the primitive tasks" is described in detail.
[0076] First of all, it should be noted that the association relationship between multiple nodes can be an association relationship in any field, such as the economic field, the education field, etc.
[0077] Exemplarily, in an embodiment of the present invention, improvements are made to the assembly line of electronic products. Taking the assembly line of a smart phone as an example, the overall assembly task (data primitive D1, hereinafter referred to as data primitive node D1) includes tasks such as mainboard installation (task D2, hereinafter referred to as subnode D2), screen assembly (task E1, hereinafter referred to as subnode E1), and camera adjustment (task F1, hereinafter referred to as subnode F1). In other words, the overall assembly task (data primitive D1) is associated with tasks such as mainboard installation (task D2), screen assembly (task E1), and camera adjustment (task F1). Mainboard installation (task D2) includes subtasks such as chip welding (task D3, hereinafter referred to as subnode D3), circuit connection detection (task D4, hereinafter referred to as subnode D4), and heat dissipation module installation (task D5, hereinafter referred to as subnode D5). In other words, mainboard installation (task D2) is associated with subtasks such as chip welding (task D3), circuit connection detection (task D4), and heat dissipation module installation (task D5). Screen assembly (task E1) includes subtasks such as display screen lamination (task E1', hereinafter referred to as subnode E1'), touch screen calibration (task E2', hereinafter referred to as subnode E2'), etc. In other words, screen assembly (task E1) is associated with subtasks such as display screen lamination (task E1') and touch screen calibration (task E2'). When quality problems occur during the assembly process, production managers can quickly determine the task level and associated subtasks of the problem through the association relationship displayed in the tree structure. For example, screen display abnormalities may be related to tasks such as display screen lamination (task E1') or touch screen calibration (task E2'). When upgrading production lines or introducing new products, resources can also be reasonably arranged based on this relationship to improve production efficiency and reduce costs.
[0078] It should be noted that after step 201, a backbone association chain is determined. Specifically, the data primitive node, the first first child node associated with the data primitive node, and then the first second child node associated with the first first child node, and so on, until the first M-1 child node is associated with the first M-1 child node to form a backbone association chain, where M is an integer greater than 1.
[0079] The above step 202, namely, "traversing the multiple nodes according to the association relationship, respectively configuring a coordinate for the multiple nodes, and determining a tree structure according to the coordinates of the multiple nodes" is described in detail below in conjunction with an embodiment of the present invention.
[0080] In the embodiment of the present invention, as a possible implementation, step 202 may be implemented by the following steps:
[0081] Query each node on the trunk association chain in sequence to form an array A; wherein the horizontal coordinate and vertical coordinate of the data primitive node in array A are the initial horizontal coordinate value and the initial vertical coordinate value respectively. The horizontal coordinates of the remaining nodes in array A are the initial horizontal coordinate values, and the vertical coordinates of the remaining nodes increase in sequence from the initial vertical coordinate value every first preset interval value. The sequence of the serial numbers of each node in array A is 0, 1, 2, and so on, increasing every 1. The child nodes of the nodes of the layers with odd serial numbers in array A are arranged on the first side of the trunk association chain, and the child nodes of the nodes of the layers with non-odd serial numbers are arranged on the second side of the trunk association chain. Combine the horizontal coordinate and vertical coordinate of each node in array A into a string as the key and the data corresponding to each node in array A as the value, and add them to the tree structure.
[0082] Reverse array A to obtain array A'.
[0083] Query each node in array A' except the remaining child nodes of the first child node to obtain array B; wherein the ordinate of each node in array B is the ordinate of the parent node of the node plus the first preset interval value.
[0084] Determine whether each node in array B has a degree. Determine the horizontal coordinate of each node in array B based on whether each node in array B has a degree and the direction in which the parent node of each node in array B is located in the backbone association chain. As a possible implementation, determine the horizontal coordinate, the updated second side boundary, and the updated first side boundary of each node in array B based on whether each node in array B has a degree and the direction in which the parent node of each node in array B is located in the backbone association chain. Specifically, if the target node in array B has a degree and the parent node of the target node is located on the first side of the backbone association chain, at this time, if the first side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the second preset interval value; if the first side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the third preset interval value; wherein the updated first side boundary is the horizontal coordinate of the target node. If the target node in array B has a degree and the parent node of the target node is located on the second side of the backbone association chain, at this time, if the second side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fourth preset interval value; if the second side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fifth preset interval value; wherein the updated second side boundary is the horizontal coordinate of the target node. If the target node in array B has no degree and the parent node of the target node is located on the first side of the backbone association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the second preset interval value, and the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the third preset interval value; wherein the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node. If the target node in array B has no degree and the parent node of the target node is located on the second side of the trunk association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fourth preset interval value, and the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fifth preset interval value; wherein, the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node. Combine the horizontal coordinate and vertical coordinate of each node in array B into a string as the key and the data corresponding to each node in array B as the value, and add them to the tree structure.
[0085] Step 301 to step 304 are executed recursively.
[0086] It should be noted that, in the embodiment of the present invention, the horizontal coordinate is expressed by...71, 69, 67, 65, 66, 68, 70... (that is, the ASCII code is...G, E, C, A, B, D, F...) in an alternating and increasing manner on both sides with the trunk association chain as the center, and the vertical coordinate is expressed by 0, 1, 2..., with the vertical coordinate of the data primitive node as 0 as the basis, and is expressed in sequence by increasing every 1.
[0087] It can be seen from step 201 that the trunk association chain is the data primitive node D1, the child node D2, and the child node D3. Each node on the trunk association chain is queried in sequence to form an array A. The horizontal coordinate and the vertical coordinate of the data primitive node D1 in array A are the initial horizontal coordinate value, that is, A and the initial vertical coordinate value in the embodiment of the present invention, that is, 0. The horizontal coordinates of the child nodes D2 and D3 are the initial horizontal coordinate values, that is, A. The vertical coordinates of the child nodes D2 and D3 increase in sequence every first preset interval value, that is, 1 and 2 respectively. The horizontal coordinate and the vertical coordinate of each node in array A are combined into a string as the key and the data corresponding to each node in array A as the value, and added to the tree structure. Reverse the array A to obtain array A', which includes child nodes D3, child nodes D2, and data primitive node D1. Child node D3 has no child nodes. Subnode D2 has subnode D4 and subnode D5 except the first subnode D3. Subnode D4 and subnode D5 form array B. Since the ordinate of each node in array B is the ordinate of the parent node of the node plus the first preset interval value, the ordinates of subnode D4 and subnode D5 are the ordinate of their parent node D2 plus the first preset interval value (in the embodiment of the present invention, 1), that is, 2. Since subnode D4 has no degree, because the abscissa of its previous sibling node is the initial abscissa value, its abscissa is the abscissa of its previous sibling node (i.e., subnode D3) plus the second preset interval value (in the embodiment of the present invention, 1), that is, 66 (ASCII code is B). The updated right side boundary is the larger value of the right side boundary (the initial right side boundary is A) and the abscissa of subnode D4, that is, B. Since child node D5 has no degree, and because the horizontal coordinate of its previous sibling node is not the initial horizontal coordinate value, its horizontal coordinate is the horizontal coordinate of its previous sibling node (i.e., child node D4) plus the third preset interval value (in the embodiment of the present invention, i.e., 2), i.e., 68 (ascii code is D). The updated right side boundary is the larger value of the right side boundary (i.e., B) and the horizontal coordinate of child node D5, i.e., D. The horizontal coordinate and vertical coordinate of each node in array B (i.e., child node D4 and child node D5) are merged into a string as the key and the data corresponding to each node in array B as the value, and added to the tree structure. Next, child node D1 has child node E1 and child node F1 except the first child node D2. Child node E1 and child node F1 constitute array B. Since the vertical coordinate of each node in array B is the vertical coordinate of the parent node of the node plus the first preset interval value, the vertical coordinates of child node E1 and child node F1 are the vertical coordinates of their parent node D1 plus the first preset interval value (in the embodiment of the present invention, that is, 1), that is, 1.Since child node E1 has a degree and the direction of its parent node is 1, it means that it is located on the left side of the trunk mutual generation chain. Therefore, the left boundary is the initial left boundary, that is, A, so its horizontal coordinate is the left boundary plus the fourth preset interval value (in the embodiment of the present invention, it is 2), that is, 67 (ASCII code is C). The updated left boundary is the horizontal coordinate of child node E1, that is, C. Next, query the association chain formed by child node E1 and child node E1' to form array A. Combine the horizontal coordinate and vertical coordinate of each node in array A into a string as the key and the data corresponding to each node in array A as the value, and add them to the tree structure. Reverse array A to obtain array A', including child node E1' and child node E1. Child node E1' has no child nodes. Child node E1 has child node E2' in addition to the first child node E1'. Child node E2' constitutes array B. The ordinate of child node E2' is the ordinate of its parent node E1 plus the first preset interval value. Since child node E2' has no degree, because the left boundary at this time is C, the abscissa of child node E2' is the left boundary at this time plus the fourth preset interval value (i.e. 2), which is 69 (ASCII code is E). The updated left boundary is the larger value of the left boundary and the abscissa of child node E2', which is E. The abscissa and ordinate of each node in array B (i.e. child node E2') are combined into a string as the key and the data corresponding to each node in array B as the value, and added to the tree structure. Next, query child node F1 and find that it has no degree. Therefore, its abscissa is the abscissa of the previous sibling node, i.e. child node E1, plus the fourth preset interval value, which is 69 (ASCII code is E). The updated left boundary is the larger value of the left boundary at this time and the abscissa of child node F1, which is E. Combine the horizontal and vertical coordinates of each node in array B (subnode E1 and subnode F1) into a string as the key and the data corresponding to each node in array B as the value, and add them to the tree structure.
[0088] Figure 3 The schematic diagram is an example provided according to the above method embodiment.
[0089] According to the above method embodiment, the embodiment of the present invention provides the following further example.
[0090] Exemplarily, in the embodiment of the present invention, the association relationship between the nodes obtained in step 201 is as follows: the order of the child nodes associated with data primitive node 1389 is child node 1544 and child node 1610. The order of the child nodes associated with child node 1544 is child node 1693, child node 1456, child node 1714, and child node 1720. The order of the child nodes associated with child node 1610 is 1653. Child node 1653 is associated with child node 1655. Child node 1456 is associated with child node 1712. The order of the child nodes associated with child node 1714 is child node 1716 and child node 1718. Child node 1718 is associated with child node 1736. Child node 1736 is associated with child node 1738. It can be known from the association relationship between each node obtained in step 201 that the backbone association chain is composed of the data primitive node 1389, the child node 1544, and the child node 1693. Therefore, array A includes the data primitive node 1389, the child node 1544, and the child node 1693. Since the horizontal coordinates in the embodiment of the present application are represented by 71, 69, 67, 65, 66, 68, 70... (i.e., the ascii code is G, E, C, A, B, D, F...) with the backbone association chain as the center, the vertical coordinates are represented by 0, 1, 2... in sequence. Therefore, the horizontal coordinate of the data primitive node 1389 is 65 (the ascii code is A), and the vertical coordinate is 0. The horizontal coordinate of the child node 1544 is 65 (the ascii code is A), and the vertical coordinate is 1. The horizontal coordinate of the child node 1693 is 65 (the ascii code is A), and the vertical coordinate is 2. The obtained array A is inverted to obtain an array A′, which includes the child node 1693, the child node 1544 and the data primitive node 1389.
[0091] Exemplarily, query the child node 1693 in array A', its horizontal coordinate is the horizontal coordinate of the data primitive node 1389, that is, 65 (ASCII code is A). Since the vertical coordinate is represented by 0, 1, 2... in sequence, the vertical coordinate of the data primitive node is 0, so the vertical coordinate of the child node 1693 is 2. Query the child node 1544 in data A', there are child nodes 1693, child nodes 1456, child nodes 1714, and child nodes 1720. Remove the first child node, that is, child node 1693, to form array B. At this time, array B includes child nodes 1456, child nodes 1714, and child nodes 1720. Since child node 1456 has a degree, and its parent node 1544 is an odd-numbered node on the trunk association chain, the direction is 0. 0 represents the right side of the trunk association chain. The right side boundary at this time is the initial right side boundary, that is, 65. Therefore, the horizontal coordinate of the child node 1456 is the right side boundary plus 1, that is, 66 (the ascii code is B). At this time, the updated right side boundary is the horizontal coordinate of the child node 1456, that is, 66 (the ascii code is B).
[0092] Exemplarily, query the association chain of child node 1456 and its associated child node 1712. At this time, array A includes child node 1456 and child node 1712. Reverse array A to obtain array A', that is, child node 1712 and child node 1456. The horizontal coordinate of child node 1712 is the horizontal coordinate of its parent node, that is, the horizontal coordinate of child node 1456, and the vertical coordinate is the vertical coordinate of its parent node plus the first preset interval value, that is, 3. After removing the first child node 1712, child node 1456 has no child nodes, so jump to child node 1714. Child node 1714 has a degree, that is, it has child node 1716 and child node 1718. Since the right side boundary at this time is 66, the horizontal coordinate of the child node 1714 is the right side boundary plus the third preset interval value (in the embodiment of the present invention, 2), that is, 68 (the ascii code is D), and its vertical coordinate is the vertical coordinate of its parent node 1544 plus the first preset interval value (in the embodiment of the present invention, that is, 1), that is, 2. At this time, the updated right side boundary is the horizontal coordinate of the child node 1714, that is, 68 (the ascii code is D).
[0093] Exemplarily, the query includes the association chain of child node 1714 and child node 1716. At this time, array A includes child node 1714 and child node 1716. Array A is reversed to obtain array A', namely child node 1716 and child node 1714. The abscissa of child node 1716 is the abscissa of its parent node, namely the abscissa of child node 1714, and the ordinate is the ordinate of its parent node plus the first preset interval value, namely 3. After removing the first child node 1716 from child node 1714, there is another child node 1718. Therefore, array B at this time includes child node 1718, and its ordinate is the ordinate of its parent node plus the first preset interval value. Since child node 1718 has a degree, that is, it has child node 1736, the right side boundary at this time is 68 (ASCII code is D). Therefore, its horizontal coordinate is the right side boundary plus the third preset interval value (ie 2), that is, its horizontal coordinate is 70 (ASCII code is F), and its vertical coordinate is the vertical coordinate of its parent node plus the first preset interval value (ie 1), that is, S3.
[0094] Exemplarily, query the association chain of child node 1718, child node 1736 associated with child node 1718, and child node 1738 associated with child node 1736. At this time, array A includes child node 1718, child node 1736, and child node 1738. The ordinate of child node 1736 is the ordinate of its parent node plus the first preset interval value, that is, S4. The ordinate of child node 1738 is the ordinate of its parent node plus the first preset interval value, that is, S5. The abscissa of child node 1738 and the abscissa of child node 1736 are the abscissa of child node 1718, that is, 70 (ascii code is F). Reverse array A to obtain array A', that is, child node 1738, child node 1736, and child node 1718. Child node 1738 has no associated child nodes. Child node 1736 has no other child nodes except the first child node 1738. Therefore, we jump to child node 1720, whose ordinate is the ordinate of its parent node 1544 plus the first preset interval value, which is 2. Since child node 1720 has no degree, its abscissa is the abscissa of its previous sibling node, child node 1714 (not the initial abscissa) plus the third preset interval value, which is 68 (ascii code is F).
[0095] Exemplarily, data primitive node 1389 has a child node 1610 in addition to the first child node 1544. At this time, array B includes child node 1610, and the ordinate of child node 1610 is the ordinate of its parent node plus the first preset interval value, that is, 1. The left boundary at this time is the initial left boundary, that is, 65. Child node 1610 is associated with child node 1653, and the sequence number of its parent node is a non-odd node, and the direction is 1, which means that the parent node is located on the left side of the trunk association chain. Therefore, the horizontal coordinate of child node 1610 is the left boundary plus the fourth preset interval value (in the embodiment of the present invention, that is, 2), that is, 67 (ASCII code is C). The updated left boundary is the horizontal coordinate of child node 1610.
[0096] Exemplarily, the association chain of child node 1610, child node 1653 associated with child node 1610, and child node 1655 associated with child node 1653 is queried. At this time, array A includes child node 1610, child node 1653, and child node 1655. The ordinate of child node 1653 is the ordinate of its parent node plus the first preset interval value, which is 2. The ordinate of child node 1655 is the ordinate of its parent node plus the first preset interval value, which is 3. The abscissa of child node 1653 and child node 1655 is the same as the abscissa of child node 1610, which is 67 (ascii code is C).
[0097] It should be noted that the tree structure generated by the above method has the functions of data search, positioning, dragging, scaling, double-clicking to enter the sequence chain and restoring.
[0098] The above step 203, namely "displaying the tree structure", is described in detail below in conjunction with an embodiment of the present invention.
[0099] In the embodiment of the present invention, another example of the tree structure generated in step 202 is as follows: Figure 4 shown.
[0100] It should be noted that Figure 5 shows the sequence chain matrix, Figure 6 The resulting tree structure shows the positioning function. Figure 6 It can be seen that the child node 1544 has been located (there is a gray shadow around the child node 1544 in the figure).
[0101] It is understandable that the application of tree structure to display relational data is very wide, not only can it be applied to daily tasks, it mainly expresses a way of data distribution so that it can be displayed intuitively.
[0102] For industrial drawings, their improvement is achieved by solving difficulties one by one and finally reaching perfection. Then the big task of industrial drawings will be associated with many small tasks to solve each problem; when I optimize the drawings, I can know which problems to optimize.
[0103] For large-scale software project management. A large enterprise-level software project (data origin), such as e-commerce platform development, includes front-end development (task G), back-end development (task H), database construction (task I) and other main tasks. Front-end development (task G) is associated with subtasks such as page layout design (task G1), user interaction function implementation (task G2), and interface style optimization (task G3). Back-end development (task H) is associated with subtasks such as server architecture construction (task H1), interface development (task H2), and data processing logic writing (task H3). The development team can clearly understand the collaboration requirements between different tasks by using the association relationship displayed in the tree structure. For example, when the front-end user interaction function is implemented (task G2), the back-end interface development (task H2) may be required to provide corresponding data support. Through the tree structure, this cross-departmental (front-end and back-end development teams can be regarded as different departments) cooperation relationship and degree of cooperation can be intuitively seen. In the process of project iteration, it is possible to quickly determine the tasks that need to be adjusted or added and their scope of influence, improve development efficiency, and ensure the smooth progress of the project.
[0104] With respect to engineering management, the above method embodiments can also be applied to the distribution of process relationships in manufacturing plants, the nodes and distribution of financial cost generation, the distribution relationships of industrial product parts and materials, etc.
[0105] From the above content, it can be seen that the embodiment of the present invention can clearly display the relationship between tasks through the tree structure; the tree structure clearly displays the relationship and degree of mutual cooperation between departments; it can intuitively understand the development trend of things; the tree structure displays the advantages of association relationships in production efficiency. If a change occurs in one place, the impact on another place associated with it can be seen, which greatly improves production efficiency; it can reduce production costs, and when a problem occurs, it can quickly locate the problem and reduce investment in non-critical factors.
[0106] According to an embodiment of another aspect, a device for generating a tree structure is provided. Figure 7 A schematic block diagram of a device for generating a tree structure according to an embodiment is shown. The device can be arranged in Figure 1 The server side of the architecture shown in Figure 1. Figure 7 As shown, the device 700 may include: an acquisition unit 701, a determination unit 702, and a display unit 703. The main functions of each component unit are as follows:
[0107] An acquisition unit 701 is used to acquire the inclusion relationship between each node, wherein each node includes a data primitive node and a multi-level sub-node, wherein the data primitive node is used to represent the primitive task, and the multi-level sub-node is used to represent the multi-level sub-task under the primitive task;
[0108] A determination unit 702, configured to traverse the nodes according to the inclusion relationship, configure a coordinate for each node, and determine a tree structure according to the coordinates of each node;
[0109] The display unit 703 is used to display the tree structure.
[0110] As a possible implementation method, the first first child node associated with the data primitive node, the first second child node associated with the first first child node, and so on, until the first Mth child node associated with the first M-1th child node constitute a trunk association chain, where M is an integer greater than 1.
[0111] As a possible implementation, the determination unit 702 is specifically used to query each node on the backbone association chain in sequence to form an array A; wherein the horizontal coordinate and the vertical coordinate of the data primitive node in the array A are the initial horizontal coordinate value and the initial vertical coordinate value respectively, the horizontal coordinate of the remaining nodes in the array A is the initial horizontal coordinate value, and the vertical coordinate of the remaining nodes increases in sequence from the initial vertical coordinate value every first preset interval value, the child nodes of the nodes of the layers with odd serial numbers in the array A are arranged on the first side of the backbone association chain, and the child nodes of the nodes of the layers with non-odd serial numbers are arranged on the second side of the backbone association chain; the array A is reversed to obtain the array A'; query Query the remaining child nodes of each node in the array A' except the first child node to obtain an array B; wherein the ordinate of each node in the array B is the ordinate of the parent node of the node plus a first preset interval value; determine whether each node in the array B has a degree; determine the abscissa of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the trunk association chain; merge the abscissa and ordinate of each node in the array B into a string as a key and the data corresponding to each node in the array B as a value, and add them to the tree structure; recursively execute the above steps.
[0112] As a possible implementation method, the determination unit 702 is specifically used to determine the horizontal coordinate, the updated second side boundary, and the updated first side boundary of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the trunk association chain.
[0113] As a possible implementation method, the determination unit 702 is specifically used to determine that if the target node in the array B has a degree and the parent node of the target node is located on the first side of the trunk association chain, at this time, if the first side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the second preset interval value; if the first side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the third preset interval value; wherein the updated first side boundary is the horizontal coordinate of the target node; if the target node in the array B has a degree and the parent node of the target node is located on the first side of the trunk association chain, then if the first side boundary is not the initial horizontal coordinate value, then the horizontal coordinate of the target node is the first side boundary plus the third preset interval value; wherein, the updated first side boundary is the horizontal coordinate of the target node; The node is located on the second side of the trunk association chain. At this time, if the second side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fourth preset interval value; if the second side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fifth preset interval value; wherein the updated second side boundary is the horizontal coordinate of the target node; if the target node in the array B has no degree and the parent node of the target node is located on the first side of the trunk association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, then the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value. The horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the second preset interval value, and the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the third preset interval value; wherein, the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node; if the target node in the array B has no degree and the parent node of the target node is located in the trunk association chain on the second side of the target node, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fourth preset interval value, and the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fifth preset interval value; wherein, the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node.
[0114] As a possible implementation, the tree structure has data search, positioning, dragging, zooming, double-clicking to enter the sequence chain and restoration functions.
[0115] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0116] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of any one of the methods in the aforementioned method embodiments are implemented.
[0117] And an electronic device, comprising:
[0118] one or more processors; and
[0119] A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the aforementioned method embodiments.
[0120] An embodiment of the present invention further provides a computer program product, including a computer program, which implements the steps of any one of the methods in the aforementioned method embodiments when executed by a processor.
[0121] in, Figure 8 The architecture of the electronic device is exemplarily shown, which may include a processor 810, a video display adapter 811, a disk drive 812, an input / output interface 813, a network interface 814, and a memory 820. The processor 810, the video display adapter 811, the disk drive 812, the input / output interface 813, the network interface 814, and the memory 820 may be communicatively connected via a communication bus 830.
[0122] The processor 810 may be implemented by a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided by the embodiments of the present invention.
[0123] The memory 820 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 820 can store an operating system 821 for controlling the operation of the electronic device 800, and a basic input and output system (BIOS) 822 for controlling the low-level operation of the electronic device 800. In addition, a web browser 823, a data storage management system 824, and a device 825 for generating a tree structure, etc. can also be stored. The device 825 for generating a tree structure can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present invention. In short, when the technical solution provided by the embodiment of the present invention is implemented by software or firmware, the relevant program code is stored in the memory 820 and is called and executed by the processor 810.
[0124] The input / output interface 813 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. Among them, the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0125] The network interface 814 is used to connect to a communication module (not shown) to achieve communication interaction between the device and other devices. The communication module can achieve communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0126] The bus 830 comprises a pathway for transmitting information between the various components of the device (eg, the processor 810, the video display adapter 811, the disk drive 812, the input / output interface 813, the network interface 814, and the memory 820).
[0127] It should be noted that, although the above device only shows a processor 810, a video display adapter 811, a disk drive 812, an input / output interface 813, a network interface 814, a memory 820, a bus 830, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the embodiments of the present invention have been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a tree structure, characterized in that: include: Acquire association relationships between multiple nodes, wherein the multiple nodes include data primitive nodes and multi-level sub-nodes, the data primitive nodes are used to represent primitive tasks, and the multi-level sub-nodes are used to represent multi-level sub-tasks under the primitive tasks; Traversing the plurality of nodes according to the association relationship, respectively configuring a coordinate for the plurality of nodes, and determining a tree structure according to the coordinates of the plurality of nodes; The tree structure is displayed.
2. The method according to claim 1, characterized in that The data primitive node, the first first child node of the first level associated with the data primitive node, the first second child node of the second level associated with the first first child node of the first level, and so on, until the first M-1 child node of the M-1 level associated with the first M-1 child node constitutes a backbone association chain, where M is an integer greater than 1.
3. The method according to claim 2, characterized in that The traversing the plurality of nodes according to the association relationship, respectively configuring a coordinate for the plurality of nodes, and determining a tree structure according to the coordinates of the plurality of nodes, includes: Query each node on the backbone association chain in sequence to form an array A; wherein the abscissa and ordinate of the data primitive node in the array A are initial abscissa values and initial ordinate values respectively, the abscissas of the remaining nodes in the array A are initial abscissa values, and the ordinates of the remaining nodes are incremented in sequence from the initial ordinate values at first preset intervals, and the child nodes of the nodes of the layers with odd sequence numbers in the array A are arranged on the first side of the backbone association chain, and the child nodes of the nodes of the layers with non-odd sequence numbers are arranged on the second side of the backbone association chain; Reverse the array A to obtain an array A'; Query the remaining child nodes of each node in the array A' except the first child node to obtain an array B; wherein the ordinate of each node in the array B is the ordinate of the parent node of the node plus a first preset interval value; Determine whether each node in array B has a degree; Determine the horizontal coordinate of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the backbone association chain; Combine the horizontal coordinate and the vertical coordinate of each node in the array B into a string as the key and the data corresponding to each node in the array B as the value, and add them to the tree structure; Recursively execute the above steps.
4. The method according to claim 3, characterized in that The step of determining the horizontal coordinate of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the backbone association chain includes: According to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the trunk association chain, the horizontal coordinate, the updated second side boundary, and the updated first side boundary of each node in the array B are determined.
5. The method according to claim 4, characterized in that The step of determining the horizontal coordinate, the updated second side boundary, and the updated first side boundary of each node in the array B according to whether each node in the array B has a degree and the direction in which the parent node of each node in the array B is located in the trunk association chain includes: If the target node in the array B has a degree and the parent node of the target node is located on the first side of the trunk association chain, at this time, if the first side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the second preset interval value; if the first side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the first side boundary plus the third preset interval value; wherein the updated first side boundary is the horizontal coordinate of the target node; If the target node in the array B has a degree and the parent node of the target node is located on the second side of the trunk association chain, at this time, if the second side boundary is the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fourth preset interval value; if the second side boundary is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the second side boundary plus the fifth preset interval value; wherein the updated second side boundary is the horizontal coordinate of the target node; If the target node in the array B has no degree and the parent node of the target node is located on the first side of the trunk association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the second preset interval value, and the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the third preset interval value; wherein, the updated first side boundary is the larger value of the first side boundary and the horizontal coordinate of the target node; If the target node in the array B has no degree and the parent node of the target node is located on the second side of the trunk association chain, at this time, if the horizontal coordinate of the previous sibling node of the target node is the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fourth preset interval value, and the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node; if the horizontal coordinate of the previous sibling node of the target node is not the initial horizontal coordinate value, then the horizontal coordinate of the target node is the horizontal coordinate of its previous sibling node plus the fifth preset interval value; wherein, the updated second side boundary is the larger value of the second side boundary and the horizontal coordinate of the target node.
6. The method according to any one of claims 1 to 5, characterized in that: The tree structure has data search, positioning, dragging, scaling and restoration functions.
7. A device for generating a tree structure, characterized in that: include: An acquisition unit, used for acquiring the inclusion relationship between each node, wherein each node includes a data primitive node and a multi-level sub-node, wherein the data primitive node is used to represent the primitive task, and the multi-level sub-node is used to represent the multi-level sub-task under the primitive task; A determination unit, configured to traverse the nodes according to the inclusion relationship, respectively configure a coordinate for each node, and determine a tree structure according to the coordinates of each node; A display unit is used to display the tree structure.
8. The device according to claim 7, characterized in that The data primitive node, the first first child node associated with the data primitive node, the first second child node associated with the first first child node, and so on, until the first Mth child node associated with the first M-1th child node constitutes a trunk association chain, where M is an integer greater than 1.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the processor and the memory communicate with each other via a bus; The memory stores program instructions executable by the processor, and the processor can execute the method according to any one of claims 1 to 6 by calling the program instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.