A hierarchical rectangular graph layout method and apparatus
By constructing a tree-like data structure and a rectangular association graph layout method with added weight attributes, the problem of node hierarchical and grouping difficulties in the existing technology is solved, achieving consistency of node positions and the effect of quickly finding unknown types of data.
Patent Information
- Application Number
- CN202211042064.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-29
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-08-29
AI Technical Summary
Existing association graph layout algorithms cannot classify and group nodes according to their attributes and weights, resulting in the inability to clearly distinguish different types of nodes when displaying the layout. Furthermore, the positions of nodes with the same data are inconsistent, making it difficult to quickly find and highlight data of unknown types.
A hierarchical grouping rectangular association graph layout method is adopted. By constructing a tree data structure, the nodes are hierarchically grouped according to their attributes and weights. The position of the nodes is calculated, and weight attributes are attached to control the display position of the nodes in the layout.
It enables hierarchical and grouped classification based on node attributes and weights, clearly distinguishing different types of nodes. The same data remains in the same position after multiple layouts, facilitating quick retrieval and highlighting of unknown data types.
Smart Images

Figure CN115408585B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer data visualization, and in particular to a method and device for laying out a hierarchically groupable rectangular association graph. Background Art
[0002] With the explosive growth of data, analyzing data and presenting analysis results through visualization can make information more intuitive and user-friendly. Users can observe data from different dimensions, thereby conducting more in-depth observation and analysis. Association graphs are often used to express entity association relationships. Current association graph layout algorithms, such as network layout, circular layout, and symmetric layout, primarily aim to achieve an even distribution of specified shapes with random node positions. For example, in the following scenarios, current layout algorithms are slightly insufficient:
[0003] Scenario 1: The layout can quickly locate the top three most frequently used instant messaging apps
[0004] The traditional layout algorithm has random node positions and evenly distributed nodes. It needs to be combined and filtered by other methods for display. The operation is cumbersome, and if you want to know multiple types, the implementation complexity increases.
[0005] Scenario 2: The layout can quickly locate uncollected data categories and display known types normally
[0006] Similar to scenario 1, simply displaying the known or unknown information can meet the requirement, but displaying and highlighting the information at the same time cannot meet the requirement.
[0007] In view of this, the present invention proposes a rectangular association graph layout method and device that can be hierarchically grouped, which can support the grading and grouping of nodes according to the required attributes and weights, and can clearly identify which group and which level they belong to when supporting layout display, and the node positions remain the same after the same data is laid out. Summary of the Invention
[0008] In order to solve the problems that the existing layout algorithm cannot classify and group nodes according to different attributes and weights, cannot clearly distinguish them during layout display, the same data cannot be displayed in the same position on the nodes after layout, and cannot meet the requirements of finding and highlighting unknown types of data, the present application provides a hierarchical and groupable rectangular association graph layout method and device to solve the above technical defects.
[0009] According to one aspect of the present invention, a method for laying out a hierarchically groupable rectangular association graph is provided, the method comprising the following steps:
[0010] S1. Build a tree data structure, preset the classification level of the tree data structure, the spacing between different levels, and the aspect ratio of the layout rectangle;
[0011] S2. Acquire data, hierarchically group the data according to attributes, and store the hierarchically grouped data in the tree data structure constructed in step S1, wherein the leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the grading results of the data;
[0012] S3, traversing all nodes to determine whether there are only leaf nodes. If there are only leaf nodes, the leaf nodes are placed after calculating the position according to the predetermined spacing and rectangle aspect ratio. If there are more than only leaf nodes, executing step S4; and
[0013] S4. Determine whether the non-leaf node is a root node. If it is not a root node, use the non-leaf node as a new leaf node and return to step S3. If it is a root node, end the operation.
[0014] Through the above technical solution, it is possible to achieve classification and sorting of any number of association relationships, and then layout and display them in a rectangular or hierarchical manner according to the classification level.
[0015] In a specific embodiment, weight attributes are added to the grouping results and the grading results, and the display positions of leaf nodes and non-leaf nodes in the graded data are controlled by the size and order of the weights.
[0016] Through the above technical solution, adding weights to nodes can control the node layout position to a certain extent, and the specific type of content can be intuitively searched from a visual perspective. The node position is the same after layout for the same data and the same algorithm parameters.
[0017] In a specific embodiment, step S3 includes the following sub-steps:
[0018] S31, traverse all nodes and determine whether there are only leaf nodes. If there are only leaf nodes, execute step S32; if there are not only leaf nodes, execute step S4;
[0019] S32, calculating the width of the block, calculating the offset coordinates of the upper left corner of the block, and traversing all leaf nodes of the block and placing them; and
[0020] S33: Update the result of the placement position in step S32, and return to continue executing step S31.
[0021] Through the above calculation scheme, the offset coordinates are calculated to place the leaf node.
[0022] In a specific embodiment, step S4 includes the following sub-steps:
[0023] S41. If all nodes are not leaf nodes, determine whether all nodes have been processed. If so, execute step S42. If not, return to step S3; and
[0024] S42. Determine whether the non-leaf node is a root node. If it is not a root node, use the non-leaf node as a new leaf node and return to step S3. If it is, end the operation.
[0025] The above technical solution is used to implement a cyclic operation until there are no more nodes to process.
[0026] In a specific embodiment, step S2 includes the following sub-steps:
[0027] S21. Acquire data, classify and group the data according to attributes, and sort and organize the data;
[0028] S22, storing the hierarchically grouped data in the tree data structure constructed in step S1, and adding a virtual root node of the tree data structure; and
[0029] S23. The leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the grading results of the data.
[0030] The above technical solution can improve the efficiency of data storage and reading.
[0031] In a specific embodiment, the aspect ratio of the layout rectangle in step S1 is 3:2.
[0032] In a second aspect, the present application provides a hierarchically groupable rectangular association graph layout device, the device comprising:
[0033] A tree data structure construction module is used to construct a tree data structure, preset the classification level of the tree data structure, the spacing between different levels, and the aspect ratio of the layout rectangle; and
[0034] A data hierarchical grouping module is used to obtain data, hierarchically group the data according to attributes, and store the hierarchically grouped data in a tree data structure constructed by the tree data structure construction module, wherein the leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the hierarchical results of the data; and
[0035] A position placement module is used to traverse all nodes and determine whether there are only leaf nodes. If there are only leaf nodes, the leaf nodes are placed according to the predetermined spacing and rectangular aspect ratio. If there are not only leaf nodes, the operations in the non-leaf node processing module are executed; and
[0036] The non-leaf node processing module is used to determine whether the non-leaf node is a root node. If it is not a root node, the non-leaf node is used as a new leaf node and the operation of the execution position placement module is returned. If it is a root node, the operation is ended.
[0037] In a specific embodiment, the device further includes a weight addition module for adding weight attributes to the grouping results and grading results, and controlling the display positions of leaf nodes and non-leaf nodes in the graded data by the size and order of the weights.
[0038] In a specific embodiment, the location placement module includes the following units:
[0039] The judgment unit traverses all nodes to determine whether there are only leaf nodes. If so, it executes the operation of the calculation unit; if not, it executes the operation of the non-leaf node processing module;
[0040] The calculation unit, if there is only a leaf node, calculates the width of the block, calculates the offset coordinates of the upper left corner of the block, and traverses all leaf nodes in the block and places them; and
[0041] The update unit updates the result of the placement position in the calculation unit and returns to continue executing the operation of the judgment unit.
[0042] In a third aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, any of the above methods is implemented.
[0043] Compared with the prior art, the present invention has the following advantages:
[0044] This invention can be applied to control node location requirements based on specified policies, supporting the display of data in hierarchical grouping layouts at any level. Weights can be used to control the display position of hierarchical groups in the layout, ensuring consistent node position across multiple layouts of the same data. Furthermore, through grouping and weighting, unknown data types can be quickly found and highlighted, facilitating data expansion and collection. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Other features, objects and advantages of the present application will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0046] Figure 1 is a flow chart of a method for laying out a hierarchically groupable rectangular association graph according to the present application;
[0047] Figure 2 This is a schematic diagram of the main framework of the hierarchically groupable rectangular association graph layout method according to the present application;
[0048] Figure 3This is a schematic diagram of tree data structure storage according to an embodiment of the present application;
[0049] Figure 4 is a schematic diagram of a block layout according to an embodiment of the present application;
[0050] Figure 5 This is a schematic diagram of the classification hierarchy / rectangular distribution of the layout method of this application;
[0051] Figure 6 It is a visual diagram of other layout methods;
[0052] Figure 7 is a schematic diagram of a hierarchically groupable rectangular association graph layout device according to the present application;
[0053] Figure 8 It is a structural diagram of a computer system suitable for implementing the electronic device of the embodiment of the present application. DETAILED DESCRIPTION
[0054] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0055] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0056] Figure 1 A flowchart of the hierarchically groupable rectangular association graph layout method of the present application is shown; Figure 2 The main framework diagram of the layout method of the hierarchically grouped rectangular association graph according to the present application is shown. Figure 1 and Figure 2 , the method comprises the following steps:
[0057] S1. Construct a tree data structure, preset the classification level of the tree data structure, the spacing between different levels, and the aspect ratio of the layout rectangle.
[0058] S2. Obtain data, hierarchically group the data according to attributes, and store the hierarchically grouped data in the tree data structure constructed in step S1. Leaf nodes of the tree data structure represent the data grouping results, and non-leaf nodes of the tree data structure represent the data grading results. It should be understood that grading and grouping can be based on any attributes.
[0059] In this embodiment, the following sub-steps are included:
[0060] S21. Acquire data, classify and group the data according to attributes, and sort and organize the data;
[0061] S22, storing the hierarchically grouped data in the tree data structure constructed in step S1, and adding a virtual root node of the tree data structure; and
[0062] S23. The leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the grading results of the data.
[0063] S3. Traverse all nodes and determine whether there are only leaf nodes. If there are only leaf nodes, calculate the position of the leaf nodes according to the predetermined spacing and rectangle aspect ratio and place them. If there are not only leaf nodes, execute step S4.
[0064] In this embodiment, the following sub-steps are included:
[0065] S31, traverse all nodes and determine whether there are only leaf nodes. If there are only leaf nodes, execute step S32; if there are not only leaf nodes, execute step S4;
[0066] S32, calculating the width of the block, calculating the offset coordinates of the upper left corner of the block, and traversing all leaf nodes of the block and placing them; and
[0067] S33: Update the result of the placement position in step S32, and return to continue executing step S31.
[0068] S4. Determine whether the non-leaf node is a root node. If it is not a root node, use the non-leaf node as a new leaf node and return to step S3. If it is a root node, end the operation.
[0069] In this embodiment, the following sub-steps are included:
[0070] S41. If all nodes are not leaf nodes, determine whether all nodes have been processed. If so, execute step S42. If not, return to step S3; and
[0071] S42. Determine whether the non-leaf node is a root node. If it is not a root node, use the non-leaf node as a new leaf node and return to step S3. If it is, end the operation.
[0072] In a specific embodiment, weight attributes are added to the grouping results and the grading results, and the display positions of leaf nodes and non-leaf nodes in the graded data are controlled by the size and order of the weights.
[0073] Specifically, after the data is hierarchically grouped, weight attributes are added, and the same set of weights is used for the same level. In this way, users can control the display position of the node in the hierarchy by the size of the weight and the sort. Similarly, the display position of nodes at the same level can also be controlled by weight. If you want to put a node at the front, just set the node weight to infinite. If some categories such as App types: QX, WeiX, DingX, TaoX, etc. are displayed by priority: WeiX>DingX>QX>TaoX, you can preset the weight of WeiX to 4, DingX to 3, QX to 2, and TaoX to 1. In this way, the front part of the layout is WeiX, and so on.
[0074] The above technical solution can achieve arbitrary classification and sorting of association relationships, and then display them in a rectangular or hierarchical layout according to the classification level. All nodes can be displayed simultaneously, and the weight size strategy can be used to control the most frequently used apps to be displayed at the front or back for quick location. It also supports grading and grouping nodes according to the required attributes and weights, and supports clear identification of which group and level the nodes belong to during layout display, and the position of nodes remains the same after the same data layout.
[0075] The following takes the application App as an example to explain in detail the hierarchical groupable rectangular association graph layout method proposed by the present invention.
[0076] Assume there are three analysis subjects, and their app usage is being analyzed. If subject A uses QX, it means that subject A has communication with QX. The analysis is presented using the number of communication connections as the first category and the type of communication app as the second category.
[0077] Step 1: Pre-set the spacing between different categories and the hierarchy of categories. For example, "Number of Contacts" is the first level and "App Type" is the second level. The layout has a rectangular aspect ratio, such as 3:2. The height of the hierarchical layout can be 1, and the width is not limited.
[0078] Step 2: Classify, sort, and organize data according to needs, and store it in a tree data structure. Different layers represent different categories (for example, the leaf layer below is classified by "App type", and only leaf nodes actually need to be placed, and non-leaf nodes are used for auxiliary layout; the upper layer is classified by "number of connections"), and add a virtual root node. Figure 3 A tree data structure storage diagram is shown, please refer to Figure 3 .
[0079] Step 3: The leaf node is the grouping result, such as Figure 3 As shown, there are two types of apps: QX and MicroX; non-leaf nodes are classification results. Figure 3 There are two levels: App type and communication with the analysis object;
[0080] Step 4: Traverse the tree and calculate and place the leaf nodes according to the predetermined aspect ratio and spacing. Figure 4 Shows a schematic diagram of the block layout, please refer to Figure 4 .
[0081] Step 5: For non-leaf nodes, for a subtree with the non-leaf node as its root, treat the new leaf nodes of the subtree with the same level as the same group and perform calculation and placement in the same way as step 4.
[0082] Step 6: Repeat steps 4 and 5 until there are no more nodes to process.
[0083] Figure 5 The schematic diagram of the classification hierarchy / rectangular distribution of the layout method of the present application is shown. Figure 6 A visual diagram showing other layout methods. Figure 5 The three blocks correspond to Figure 3 First level: the number of items associated with the analysis object; each large block has a small rectangular layout, corresponding to Figure 3 The second level in: grouping by the number of contacts with the analysis object. Figure 6 Other layouts display data that cannot be clearly distinguished between levels and groups.
[0084] Further references Figure 7 As an implementation of the above method, the present application provides an embodiment of a hierarchically groupable rectangular association diagram layout device. Figure 1 Corresponding to the method embodiment shown, the system can be specifically applied to various electronic devices. The apparatus 700 includes the following modules:
[0085] A tree data structure construction module 710 is used to construct a tree data structure, preset the classification levels of the tree data structure, the spacing between different levels, and the aspect ratio of the layout rectangle; and
[0086] The data hierarchical grouping module 720 is used to obtain data, hierarchically group the data according to attributes, and store the hierarchically grouped data in the tree data structure constructed by the tree data structure construction module 710, wherein the leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the hierarchical results of the data; and
[0087] Position placement module 730, configured to traverse all nodes and determine whether there are only leaf nodes. If there are only leaf nodes, the leaf nodes are placed after calculating the positions according to the predetermined spacing and rectangle aspect ratio. If there are not only leaf nodes, operation 740 in the non-leaf node processing module is executed; and
[0088] The non-leaf node processing module 740 is used to determine whether the non-leaf node is a root node. If it is not a root node, the non-leaf node is used as a new leaf node and the operation of the execution position placement module 730 is returned. If it is a root node, the operation is terminated.
[0089] The weight adding module 750 is used to add weight attributes to the grouping results and the grading results, and to control the display positions of leaf nodes and non-leaf nodes in the graded data by the size and order of the weights.
[0090] The location placement module 730 includes the following units:
[0091] The judgment unit traverses all nodes to determine whether there are only leaf nodes. If so, it executes the operation of the calculation unit; if not, it executes the operation of the non-leaf node processing module;
[0092] The calculation unit, if there is only a leaf node, calculates the width of the block, calculates the offset coordinates of the upper left corner of the block, and traverses all leaf nodes in the block and places them; and
[0093] The update unit updates the result of the placement position in the calculation unit and returns to continue executing the operation of the judgment unit.
[0094] The present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements any of the above methods.
[0095] Reference below Figure 8 , which shows a structural diagram of a computer system 800 suitable for implementing an electronic device of an embodiment of the present application. Figure 8 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0096] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage unit 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the system 800 are also stored in the RAM 803. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0097] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, and the like; an output section 807 including a liquid crystal display (LCD) and speakers; a storage section 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card or a modem. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 810 as needed, so that a computer program read therefrom can be installed in the storage section 808 as needed.
[0098] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 809, and / or installed from a removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the method of the present application are performed.
[0099] It should be noted that the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable medium, or any combination of the two. Computer-readable media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination thereof. More specific examples of computer-readable media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0100] Computer program code for performing the operations of the present application can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0101] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0102] The modules involved in the embodiments of the present application may be implemented in software or in hardware. The units described may also be provided in a processor. For example, they may be described as follows: a processor includes a receiving module, an acquisition module, a determination module, a calculation module, and a generation module. The names of these units do not, in some cases, constitute limitations on the units themselves. For example, the receiving unit may also be described as a "module that obtains preset, target user configuration information in response to determining that the verification request information includes a user name, a request time, a user signature code, and a client application code."
[0103] As another aspect, the present application also provides a computer-readable medium, which may be included in the server described in the above embodiment; or may exist independently and not be assembled into the server. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the server, the server: receives a verification request message sent by a client of a target user; in response to determining that the verification request message includes a user name, a request time, a user signature code, and a client application code, obtains preset configuration information of the target user, wherein the configuration information includes a preset user password corresponding to the user name; determines whether the verification request message is valid based on the request time, and in response to determining that it is valid, determines whether a preset storage area includes a user signature code; in response to determining that it is not included, stores the user signature code in a preset storage area, and calculates a server application code based on the user password, the request time, and the user signature code; in response to determining that the server application code matches the client application code, generates verification success information for indicating that the verification request is a legitimate request.
[0104] In addition, the computer-readable medium may be included in the terminal device described in the above embodiment, or may exist independently without being incorporated into the terminal device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the terminal device, the terminal device: obtains user information input by the target user, wherein the user information includes a user name and a user password; generates a user signature code representing the target user based on the user information; determines a request time; calculates a client application code based on the user password, the request time, and the user signature code; generates verification request information including the user name, the request time, the user signature code, and the client application code; and sends the verification request information to the server.
[0105] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned inventive concept. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A method for laying out a hierarchically groupable rectangular association graph, characterized in that: The following steps are involved: S1. Constructing a tree data structure, presetting the classification levels, spacing between different levels, and aspect ratio of the layout rectangle of the tree data structure; S2. Acquire data, hierarchically group the data according to attributes, and store the hierarchically grouped data in the tree data structure constructed in step S1, wherein the leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the grading results of the data; S3, traversing all nodes to determine whether there are only leaf nodes. If there are only leaf nodes, the leaf nodes are placed after calculating the positions according to the predetermined spacing and rectangular aspect ratio. If there are more than only leaf nodes, executing step S4; and Step S3 includes the following sub-steps: S31, traversing all nodes to determine whether there are only leaf nodes; if there are only leaf nodes, executing step S32; if there are not only leaf nodes, executing step S4; S32, calculating the width of the block, calculating the offset coordinates of the upper left corner of the block, and traversing all leaf nodes of the block and placing them; and S33, updating the result of the placement position in step S32, returning to continue executing step S31; S4. Determine whether the non-leaf node is a root node. If it is not a root node, use the non-leaf node as a new leaf node and return to step S3. If it is a root node, end the operation.
2. The layout method of a hierarchically groupable rectangular association graph according to claim 1, characterized in that: A weight attribute is added to the grouping result and the grading result, and the display positions of the leaf nodes and the non-leaf nodes in the graded data are controlled by the size and order of the weight.
3. The layout method of a hierarchically groupable rectangular association graph according to claim 1, characterized in that: Step S4 includes the following sub-steps: S41. If all the nodes are not just leaf nodes, determine whether all the nodes have been processed. If so, execute step S42. If not, return to step S3; and S42. Determine whether the non-leaf node is a root node. If it is not a root node, use the non-leaf node as a new leaf node and return to step S3. If it is, end the operation.
4. The layout method of a hierarchically groupable rectangular association graph according to claim 1, characterized in that: Step S2 includes the following sub-steps: S21. Acquire data, classify and group the data according to attributes, and sort and organize the data; S22, storing the hierarchically grouped data in the tree data structure constructed in step S1, and adding a virtual root node of the tree data structure; as well as S23. The leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the grading results of the data.
5. The layout method of a hierarchically groupable rectangular association graph according to claim 1, characterized in that: The aspect ratio of the layout rectangle in step S1 is 3:
2.
6. A hierarchically groupable rectangular association diagram layout device, characterized in that: The device comprises: A tree data structure construction module is used to construct a tree data structure, preset the classification level of the tree data structure, the spacing between different levels, and the aspect ratio of the layout rectangle; and a data hierarchical grouping module, configured to acquire data, hierarchically group the data according to attributes, and store the hierarchically grouped data in a tree data structure constructed by the tree data structure construction module, wherein the leaf nodes of the tree data structure are the grouping results of the data, and the non-leaf nodes of the tree data structure are the hierarchical results of the data; and a position placement module for traversing all nodes to determine whether there are only leaf nodes; if there are only leaf nodes, the leaf nodes are placed after calculating the position according to a predetermined spacing and rectangular aspect ratio; if there are not only leaf nodes, the operations in the non-leaf node processing module are executed; and a non-leaf node processing module for determining whether the non-leaf node is a root node; if not, the non-leaf node is used as a new leaf node and the operation of the position placement module is returned to be executed; if it is a root node, the operation is terminated; The location placement module includes the following units: A judgment unit, traversing all nodes to determine whether there are only leaf nodes, if so, executing the operation of the calculation unit, if not, executing the operation of the non-leaf node processing module; A calculation unit, if there is only the leaf node, calculates the width of the block, calculates the offset coordinates of the upper left corner of the block, and traverses all leaf nodes of the block and places them; and The updating unit updates the result of the placement position in the calculating unit and returns to continue executing the operation of the judging unit.
7. The hierarchically groupable rectangular association diagram layout device according to claim 6, characterized in that: It also includes an additional weight module for adding weight attributes to the grouping results and the grading results, and controlling the display positions of the leaf nodes and the non-leaf nodes in the graded data through the size and order of the weights.
8. A computer-readable storage medium, wherein a computer program is stored in the medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Complex type data automatic generation method and apparatus, electronic device and storage medium
CN108549531A
Shared parking space tree index construction and distribution method, equipment and storage medium
CN114241808A