A method for extending the layout of a graph
By calculating the calculation of the border between the graph and the expansion node, the problem of the unclear expansion layout of the graphic expansion in the existing technologies is solved, and the reasonable and beautiful expansion layout of the map is realized. Essence
Patent Information
- Application Number
- CN202111133579.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2041-09-27
AI Technical Summary
The existing map layout method cannot effectively expand the map, especially when it involves the relationship between two maps, which cannot be applied, resulting in unclear map display.
By obtaining the orderly coordinate set of the existing map boundary, the nodes are arranged according to the distance between the extension node and these coordinates, and the coverage of the coverage and its original position is calculated. Circle to complete the expansion layout of the graph.
When the expansion graph is realized, the new node is located in a reasonable canvas, make full use of the blank space, so that the graphic layout is reasonable and beautiful as a whole, and the levels of each part are clear and clear. At the same time, the stability of the layout is guaranteed to avoid stuttering.
Smart Images

Figure CN113886597B_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method, which relates to the field of data visualization analysis, and in particular to a method for graph expansion layout. Background Art
[0002] With the continuous development of computer technology and the continuous improvement of informatization, society has entered an era of interconnectedness and intelligence, generating massive amounts of data. Knowledge graphs are tools for describing and analyzing these data. Knowledge graphs are used to describe various entities and overviews as well as the relationships between them. They can be applied to chatbots, search intent recognition, knowledge storage and other fields. Graphs are a means of displaying knowledge graphs.
[0003] Expanding nodes is the basic function of a graph. The core of a graph display effect is the layout. A good layout can make the graph clearer and easier to find key points. However, the current existing layouts are all separate and do not involve the relationship between two graphs, so they cannot be applied when expanding a graph. Summary of the invention
[0004] In view of the problems of the prior art, the present invention provides a method for expanding the layout of a knowledge graph, which can better display the characteristics of the graph, make the positions of the expanded nodes reasonable, and make the overall graph clear and layered.
[0005] The specific scheme proposed by the present invention is:
[0006] A method for extending a graph layout, obtaining an existing graph boundary, and forming an ordered coordinate set of the boundary,
[0007] Arrange the nodes in positive order according to the distance between the extended node and the node coordinates in the ordered coordinate set to obtain a sorting result.
[0008] For the newly added nodes that are not in the existing graph and are associated with the extended nodes, the coverage circle and the original position of the coverage circle are calculated, and the moving route of the coverage circle in the existing graph is obtained according to the sorting result.
[0009] The layout positioning circle is determined by moving the covering circle according to the moving route, and the layout expansion of the atlas is completed by adjusting the layout positioning circle.
[0010] Furthermore, the step of obtaining the existing graph boundary in the graph expansion layout method includes:
[0011] The coordinates of all nodes in the existing graph are obtained, and the concaveman algorithm is used to obtain the boundary of the existing graph through the coordinates of all nodes.
[0012] Furthermore, the calculation of the coverage circle and the original position of the coverage circle in the method for extending the layout of the graph includes:
[0013] The maximum and minimum values of the coordinates of the newly added nodes are obtained to form a rectangular bounding box, and the diameter and center of the covering circle are calculated using the rectangular bounding box.
[0014] Furthermore, the step of obtaining a moving route in the method for extending a map layout includes:
[0015] The order in which the nodes at the boundary of the existing graph in the sorting result are arranged is used as the moving order of the moving route.
[0016] Furthermore, in the method for extending the layout of a graph, the step of determining the layout positioning circle by moving the covering circle according to the moving route includes:
[0017] Traverse the nodes on the existing graph boundary on the moving route, use the straight line formed by the current node and its adjacent nodes as the tangent of the covering circle, and then determine the moving position of the covering circle according to the radius of the covering circle.
[0018] The position where the covering circle moves is screened, and the covering circle at the position that meets the conditions is determined as the layout positioning circle.
[0019] Furthermore, in the method for extending the layout of a graph, the step of adjusting the layout positioning circle includes:
[0020] The center of the layout positioning circle is offset by an appropriate distance, and all nodes are translated according to the offset.
[0021] A system for extending the layout of a graph includes an analysis and calculation module and an extension module.
[0022] The analysis and calculation module obtains the existing atlas boundary and forms an ordered coordinate set of the boundary.
[0023] Arrange the nodes in positive order according to the distance between the extended node and the node coordinates in the ordered coordinate set to obtain a sorting result.
[0024] For the newly added nodes that are not in the existing graph and are associated with the extended nodes, the coverage circle and the original position of the coverage circle are calculated, and the moving route of the coverage circle in the existing graph is obtained according to the sorting result.
[0025] The expansion module determines the layout positioning circle by moving the covering circle according to the moving route, and completes the layout expansion of the atlas by adjusting the layout positioning circle.
[0026] A device for extending a graph layout, comprising: at least one memory and at least one processor;
[0027] The at least one memory is used to store a machine-readable program;
[0028] The at least one processor is used to call the machine-readable program to execute the method of graph expansion layout.
[0029] The benefits of the present invention are:
[0030] The present invention provides a method for extending the layout of a graph, and constructs a graph extension layout mode, which can better display the characteristics of the graph, make the graph as a whole clear and layered, and can perform extended layout in the place with the best visual effect. At the same time, the layout stability of the existing graph during the extended layout is guaranteed. Considering the problem of layout calculation of a large number of nodes, the calculation method is optimized, the layout speed is accelerated, and jamming is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is a schematic diagram of an example of the effect of applying the spectrum expansion method of the present invention.
[0032] Figure 2 This is a schematic diagram of Example 2 of the effect of applying the spectrum expansion method of the present invention.
[0033] Figure 3 It is a schematic diagram of an example of a moving covering circle in the method of the present invention.
[0034] Figure 4 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0035] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0036] The present invention provides a method for extending the layout of a graph, obtaining an existing graph boundary, and forming an ordered coordinate set of the boundary.
[0037] Arrange the nodes in positive order according to the distance between the extended node and the node coordinates in the ordered coordinate set to obtain a sorting result.
[0038] For the newly added nodes that are not in the existing graph and are associated with the extended nodes, the coverage circle and the original position of the coverage circle are calculated, and the moving route of the coverage circle in the existing graph is obtained according to the sorting result.
[0039] The layout positioning circle is determined by moving the covering circle according to the moving route, and the layout expansion of the atlas is completed by adjusting the layout positioning circle.
[0040] The method of the present invention can achieve the goal of locating newly added nodes at reasonable places on the canvas when expanding a graph, making full use of blank space, making the overall layout of the graph reasonable and beautiful, and making each part clearly layered.
[0041] In specific applications, when performing graph expansion layout in some embodiments of the method of the present invention, the specific process is as follows:
[0042] For the existing graph, obtain the coordinates of all nodes, use the concaveman algorithm on the coordinates, calculate the boundary of the existing graph, and construct an ordered coordinate set of the boundary, denoted as B;
[0043] After obtaining the boundary, the expanded nodes N are sorted in positive order according to the distance between the coordinates in the boundary B. The sorting result is recorded as C. The boundary nodes are sorted for the layout and positioning of the subsequent expansion graph.
[0044] Query the knowledge graph of the extended node and perform layout:
[0045] Exclude the nodes associated with the extended nodes in the existing graph, only calculate the newly added nodes, and calculate the minimum coverage circle for the newly added nodes. When the amount of data is small, use the incremental method to calculate. When the amount of data is large, in order to speed up the calculation, obtain the maximum and minimum values of the Y coordinates and X coordinates of all newly added nodes to form a rectangular bounding box of the extended graph, take the diagonal as its coverage circle diameter O, and the center of the coverage circle is R2. Calculate the coverage circle and the original position of the coverage circle. The formula is as follows:
[0046]
[0047]
[0048] According to the sorting result, the moving route of the covering circle in the existing graph is obtained, and the arrangement order of the nodes at the boundary of the existing graph in the sorting result is used as the moving order of the moving route.
[0049] Traverse the nodes on the existing graph boundary on the moving route, use the straight line formed by the current node and its adjacent nodes as the tangent of the covering circle, and then determine the moving position of the covering circle according to the radius of the covering circle.
[0050] Screen the position where the covering circle moves, and determine the covering circle at the position that meets the conditions as the layout positioning circle. According to the property theorem of the circle: the tangent and the radius can determine the center of the circle, and two centers can be obtained by calculation. For the two centers, first exclude the center of the circle inside the boundary, and then calculate whether the covering circle and the boundary intersect. The judgment is made by comparing the shortest distance between all line segments of the boundary and the center of the circle. The vector method is used for calculation. The distance formula is as follows:
[0051] Let P be the center of the circle, A and B be the two points of the line segment, and C be the projection of P on the line segment AB.
[0052]
[0053] The calculation formula of r is:
[0054]
[0055] The calculation formula is:
[0056]
[0057] By comparing the distance d and the radius of the covering circle, we can determine whether the line segment and the circle intersect. The non-intersecting circle is the required layout positioning circle. The center of the circle is R1. Because the boundary coordinate set C is in positive order, the first one found is the optimal solution.
[0058] The center of the layout positioning circle is offset by a small distance in the vertical tangent direction to achieve better results. After the adjustment is completed, all nodes are translated using the offset of the center R1 obtained by the algorithm and the initial center R2 of the covering circle to complete the layout expansion.
[0059] The covering circle moving process of some embodiments can be referred to Figure 3 For other embodiments, please refer to the extended layout Figure 1-2 .
[0060] The method of the present invention calculates the boundary of the existing map, adopts any layout method with better effect according to the extended map, obtains the positioning coordinates and calculates the minimum circle coverage, sorts the points on the boundary by distance by the position of the extended node in the existing map, locates the center of the covering circle by the line segment between the two points on the boundary as the tangent of the covering circle, checks whether the boundary does not intersect with the circle, and the first center of the circle that meets the conditions is the required one, and makes appropriate distance fine-tuning to complete the extended layout of the map. When the map is extended, the newly added nodes can be located in a reasonable place on the canvas, and the blank space can be fully utilized, so that the overall layout of the map is reasonable and beautiful, and the layers of each part are clear.
[0061] At the same time, the present invention also provides a system for extending the layout of a graph, including an analysis and calculation module and an extension module.
[0062] The analysis and calculation module obtains the existing atlas boundary and forms an ordered coordinate set of the boundary.
[0063] Arrange the nodes in positive order according to the distance between the extended node and the node coordinates in the ordered coordinate set to obtain a sorting result.
[0064] For the newly added nodes that are not in the existing graph and are associated with the extended nodes, the coverage circle and the original position of the coverage circle are calculated, and the moving route of the coverage circle in the existing graph is obtained according to the sorting result.
[0065] The expansion module determines the layout positioning circle by moving the covering circle according to the moving route, and completes the layout expansion of the atlas by adjusting the layout positioning circle.
[0066] The information interaction, execution process and other contents between the modules in the above-mentioned system are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.
[0067] Similarly, the system of the present invention can achieve that when expanding a graph, newly added nodes are located at reasonable places on the canvas, making full use of blank space, making the overall layout of the graph reasonable and beautiful, and the levels of each part clear and distinct.
[0068] And the present invention provides a device for extending the layout of a graph, comprising: at least one memory and at least one processor;
[0069] The at least one memory is used to store a machine-readable program;
[0070] The at least one processor is used to call the machine-readable program to execute the method of graph expansion layout.
[0071] As the information interaction, execution of readable program process and other contents of the processor in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0072] Similarly, the device of the present invention can achieve the goal of placing newly added nodes at reasonable places on the canvas when expanding the graph, making full use of blank space, making the overall layout of the graph reasonable and beautiful, and making the levels of each part clear and distinct.
[0073] It should be noted that not all steps and modules in each process and each system structure in the above preferred embodiments are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0074] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for extending a graph layout, characterized in that Get the existing atlas boundary, and the ordered set of coordinates constituting the boundary, Arrange the nodes in positive order according to the distance between the extended node and the node coordinates in the ordered coordinate set to obtain a sorting result. Query the knowledge graph of the expanded nodes and perform layout: Exclude the nodes associated with the expanded nodes in the existing graph and only calculate the coverage circle of the newly added nodes. When the amount of data is small, use the incremental method to calculate the coverage circle. When the amount of data is large, obtain the coverage circle of all newly added nodes. Y Coordinates and X The maximum and minimum values of the coordinates form a rectangular bounding box of the extended map. The diagonal is taken as the diameter O of the covering circle, and the center of the covering circle is R2. The covering circle and the original position of the covering circle are calculated. The formula is as follows: , Obtaining a moving route of the covering circle in the existing graph according to the sorting result, including: using the order of arranging nodes at the boundary of the existing graph in the sorting result as the moving order of the moving route, Determining the layout positioning circle by moving the covering circle according to the moving route, including: traversing the nodes at the boundary of the existing graph on the moving route, taking the straight line formed by the current node and its adjacent nodes as the tangent of the covering circle, and then determining the position of the covering circle according to the radius of the covering circle, screening the position of the covering circle, and determining the covering circle at the position that meets the conditions as the layout positioning circle, The layout positioning circle is adjusted, including: offsetting the center of the layout positioning circle by an appropriate distance, and translating all nodes according to the offset, Complete the layout expansion of the graph.
2. The method for expanding the layout of a graph according to claim 1, characterized in that The obtaining of the existing atlas boundary includes: The coordinates of all nodes in the existing graph are obtained, and the concaveman algorithm is used to obtain the boundary of the existing graph through the coordinates of all nodes.
3. A system for extending the layout of a graph, characterized in that Including analysis and calculation modules and extension modules, The analysis and calculation module obtains the existing atlas boundary and forms an ordered coordinate set of the boundary. Arrange the nodes in positive order according to the distance between the extended node and the node coordinates in the ordered coordinate set to obtain a sorting result. Query the knowledge graph of the expanded nodes and perform layout: Exclude the nodes associated with the expanded nodes in the existing graph and only calculate the coverage circle of the newly added nodes. When the amount of data is small, use the incremental method to calculate the coverage circle. When the amount of data is large, obtain the coverage circle of all newly added nodes. Y Coordinates and X The maximum and minimum values of the coordinates form a rectangular bounding box of the extended map. The diagonal is taken as the diameter O of the covering circle, and the center of the covering circle is R2. The covering circle and the original position of the covering circle are calculated. The formula is as follows: , Obtaining a moving route of the covering circle in the existing graph according to the sorting result, including: using the order of arranging nodes at the boundary of the existing graph in the sorting result as the moving order of the moving route, The expansion module determines the layout positioning circle by moving the covering circle according to the moving route, including: traversing the nodes at the boundary of the existing graph on the moving route, taking the straight line formed by the current node and its adjacent nodes as the tangent of the covering circle, and then determining the position of the covering circle according to the radius of the covering circle, screening the position of the covering circle, and determining the covering circle at the position that meets the conditions as the layout positioning circle, The layout positioning circle is adjusted, including: offsetting the center of the layout positioning circle by an appropriate distance, and translating all nodes according to the offset, Complete the layout expansion of the graph.
4. A device for expanding the layout of a graph, characterized in that include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to execute the method for graph expansion layout described in claim 1.
Citation Information
Patent Citations
Method of seaming and expanding amorphous patterns
CN101254732A
Graph layout implementation method and device
CN109981311A