A method and apparatus for node positioning
By determining the initial root node in the graph data and performing grouping processing, the node positions are calculated, solving the problems of long node calculation time and randomness of results. This achieves a fast and low-memory node location method, improving the visualization effect of the network diagram.
Patent Information
- Application Number
- CN202210552349.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-05-20
AI Technical Summary
Existing node localization algorithms lack convergence, resulting in long node computation time and highly random network graph calculation results, making it impossible to reproduce visualization effects in a regular manner.
By acquiring edge data from the graph data, the initial root node is determined, and the nodes are grouped according to the set of relation node identifiers. The position information of leaf nodes and non-leaf nodes is calculated, and adaptive sorting is performed based on the node relation objects to obtain a uniform and symmetrical node order.
It achieves rapid convergence of node localization, reduces computation and time consumption, improves the consistency of network diagram visualization, and reduces memory usage.
Smart Images

Figure CN114996503B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a node positioning method and apparatus. Background Technology
[0002] With the rapid development of industries such as social media, e-commerce, finance, retail, and the Internet of Things, a vast and complex network of relationships has emerged in the real world. The relationships between data that the big data industry needs to process are growing exponentially, creating a pressing need for a method to support massive and complex data relationship operations. Graph data has thus come into being. When network diagrams are needed to visualize graph data layouts, force-directed algorithms and their derivatives are generally used.
[0003] In developing this invention, the inventors discovered that existing technologies suffer from at least the following problems: the algorithms are non-convergent, with nodes always oscillating between two different positions, although they eventually reach a stable state. Therefore, initial configurations, such as setting a specified number of iterations based on the graph data, are typically required to determine the conditions for stopping the computation. When the number of nodes is excessive, the computation time and memory usage become enormous. Furthermore, the computation results of the network graph are random, making it impossible to recreate the visualization effects in a predictable manner. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a node positioning method and apparatus, which can at least solve the problems of lack of convergence, time-consuming layout calculation, and randomness of network diagram calculation results in the prior art.
[0005] To achieve the above objectives, according to one aspect of the present invention, a node localization method is provided, comprising:
[0006] Based on the edge data in the graph data, obtain the set of relation node identifiers for each node, and determine the initial root node according to a preset method;
[0007] For nodes in the relation node identifier set of the initial root node, if they are leaf nodes, they are grouped separately; if they are non-leaf nodes, they are grouped according to their connection characteristics to determine the new relation node order based on the sorting method of the leaf node group and the non-leaf node group.
[0008] Starting from the position of the initial root node, calculate the position information of each leaf node and each non-leaf node according to the new relation node order.
[0009] Optionally, obtaining the set of relation node identifiers for each node based on the edge data in the graph data includes:
[0010] Based on the edge data in the graph data, obtain the identifiers of the starting node and the target node;
[0011] For any starting node, based on the identifiers of other nodes with which it has an edge relationship, generate a set of relation node identifiers for that starting node; and
[0012] For any target node, and based on the identifiers of other nodes with edge relationships, generate a set of relation node identifiers for that target node.
[0013] Optionally, determining the initial root node according to a preset method includes:
[0014] The number of edge relationships for each node is determined based on the edge data, and the node with the largest number of edge relationships is determined as the initial root node.
[0015] Before the step of grouping leaf nodes into a single group and non-leaf nodes into groups based on connection characteristics, the following steps are also included:
[0016] If the number of edge relationships of a single node is 1, then the single node is determined to be a leaf node because it only has an edge relationship with the initial root node; otherwise, it is a non-leaf node.
[0017] Optionally, determining the initial root node according to a preset method includes:
[0018] In response to a selection operation on any node, the selected node is used as the initial root node.
[0019] Optionally, if the node is not a leaf node, then grouping it according to its connection characteristics includes:
[0020] For the first non-leaf node and the second non-leaf node, if a direct connection is determined based on the set of relation node identifiers of the first non-leaf node and / or the second non-leaf node, then the first non-leaf node and the second non-leaf node are grouped together; or
[0021] If, based on the set of relation node identifiers of the first and second non-leaf nodes, it is determined that both have direct connections to the third non-leaf node, then the first, second, and third non-leaf nodes are grouped together; or
[0022] If, based on the set of relation node identifiers of the first and second non-leaf nodes, it is determined that both are non-leaf nodes that have direct connections with other nodes and that are not the initial root node, then the first and second non-leaf nodes are grouped together.
[0023] Optionally, determining the new relation node order based on the sorting method of leaf node groups and non-leaf node groups includes:
[0024] Count the first number of leaf node groups and the second number of non-leaf node groups;
[0025] Compare the size relationship between the first quantity and the second quantity, and take the first quantity or the second quantity with the larger value as the dividend, and take the remaining second quantity or the first quantity as the divisor;
[0026] The results of calculating the dividend and divisor are rounded up to determine the sorting method of the leaf node group and the non-leaf node group, thereby obtaining the order in which the position information of each node is calculated.
[0027] Optionally, after calculating the position information of each leaf node and each non-leaf node respectively, the method further includes:
[0028] Clear all located node identifiers from the set of all relation node identifiers, and determine whether there are one or more non-leaf nodes in the non-leaf nodes of the initial root node whose set of relation node identifiers is not empty;
[0029] For any one of the one or more non-leaf nodes, take that non-leaf node as the reference root node;
[0030] Starting from the position of any non-leaf node, repeat the above operations of node grouping, calculating node positions, and clearing the located nodes in the set to obtain the position information of each node in the relation node identifier set of any non-leaf node.
[0031] Optionally, before calculating the node positions, the following may also be included:
[0032] Determine one or more nodes that have been located in the set of relation node identifiers of any non-leaf node, and calculate the angle between each of the one or more nodes and any non-leaf node.
[0033] Calculate the difference between the maximum and minimum angles, and subtract the difference from 360 as the effective spatial range of the relation node layout for any non-leaf node; where the maximum included angle is the starting angle of the layout.
[0034] Optionally, clearing the located node identifiers in the set of all relation node identifiers includes:
[0035] After locating the position information of the leaf node, clear the set of relation node identifiers for the leaf node; and
[0036] After locating the position information of any non-leaf node, delete the identifier of any non-leaf node from the set of identifiers of all relation nodes containing the non-leaf node.
[0037] Optionally, it also includes a master node relationship object, used to store a set of relationship node identifiers for all nodes, and the method further includes:
[0038] If there are still unlocated node identifiers in the total node relationship object, repeat the above steps of determining the initial root node, calculating the node position, and determining the reference root node to determine the position information of each remaining node in the graph data.
[0039] Optionally, the total node relationship object does not contain information about nodes without relationships, and the method further includes:
[0040] If there are no unlocated node identifiers in the total node relationship object, determine the maximum value of the located nodes in the horizontal axis direction and the maximum value in the vertical axis direction.
[0041] The maximum value on the vertical axis is used as the value of the unrelated node in the vertical direction, and the sum of the maximum value on the horizontal axis and the preset offset is used as the value of the unrelated node in the horizontal direction.
[0042] Based on the edge data in the graph data, obtain the identifiers of the starting node and the target node, taking the position of any non-leaf node as the starting point.
[0043] To achieve the above objectives, according to another aspect of the present invention, a node positioning device is provided, comprising:
[0044] The acquisition module is used to obtain the set of relation node identifiers for each node based on the edge data in the graph data, and determine the initial root node according to a preset method;
[0045] The sorting module is used to sort the nodes in the relation node identifier set of the initial root node. If they are leaf nodes, they are grouped separately; if they are non-leaf nodes, they are grouped according to their connection characteristics to determine the new relation node order based on the sorting method of the leaf node group and the non-leaf node group.
[0046] The calculation module is used to calculate the position information of each leaf node and each non-leaf node, starting from the position of the initial root node and following the new relation node order.
[0047] Optionally, the acquisition module is used for:
[0048] Based on the edge data in the graph data, obtain the identifiers of the starting node and the target node;
[0049] For any starting node, based on the identifiers of other nodes with which it has an edge relationship, generate a set of relation node identifiers for that starting node; and
[0050] For any target node, and based on the identifiers of other nodes with edge relationships, generate a set of relation node identifiers for that target node.
[0051] Optionally, the acquisition module is used for:
[0052] The number of edge relationships for each node is determined based on the edge data, and the node with the largest number of edge relationships is determined as the initial root node.
[0053] Before the step of grouping leaf nodes into a single group and non-leaf nodes into groups based on connection characteristics, the following steps are also included:
[0054] If the number of edge relationships of a single node is 1, then the single node is determined to be a leaf node because it only has an edge relationship with the initial root node; otherwise, it is a non-leaf node.
[0055] Optionally, the acquisition module is configured to: in response to a selection operation on any node, use the selected node as the initial root node.
[0056] Optionally, the sorting module is used for:
[0057] For the first non-leaf node and the second non-leaf node, if a direct connection is determined based on the set of relation node identifiers of the first non-leaf node and / or the second non-leaf node, then the first non-leaf node and the second non-leaf node are grouped together; or
[0058] If, based on the set of relation node identifiers of the first and second non-leaf nodes, it is determined that both have direct connections to the third non-leaf node, then the first, second, and third non-leaf nodes are grouped together; or
[0059] If, based on the set of relation node identifiers of the first and second non-leaf nodes, it is determined that both are non-leaf nodes that have direct connections with other nodes and that are not the initial root node, then the first and second non-leaf nodes are grouped together.
[0060] Optionally, the sorting module is used for:
[0061] Count the first number of leaf node groups and the second number of non-leaf node groups;
[0062] Compare the size relationship between the first quantity and the second quantity, and take the first quantity or the second quantity with the larger value as the dividend, and take the remaining second quantity or the first quantity as the divisor;
[0063] The results of calculating the dividend and divisor are rounded up to determine the sorting method of the leaf node group and the non-leaf node group, thereby obtaining the order in which the position information of each node is calculated.
[0064] Optionally, a recursive module is also included for:
[0065] Clear all located node identifiers from the set of all relation node identifiers, and determine whether there are one or more non-leaf nodes in the non-leaf nodes of the initial root node whose set of relation node identifiers is not empty;
[0066] For any one of the one or more non-leaf nodes, take that non-leaf node as the reference root node;
[0067] Starting from the position of any non-leaf node, repeat the above operations of node grouping, calculating node positions, and clearing the located nodes in the set to obtain the position information of each node in the relation node identifier set of any non-leaf node.
[0068] Optionally, the recursive module is further configured to:
[0069] Determine one or more nodes that have been located in the set of relation node identifiers of any non-leaf node, and calculate the angle between each of the one or more nodes and any non-leaf node.
[0070] Calculate the difference between the maximum and minimum angles, and subtract the difference from 360 as the effective spatial range of the relation node layout for any non-leaf node; where the maximum included angle is the starting angle of the layout.
[0071] Optionally, the recursive module is used for:
[0072] After locating the position information of the leaf node, clear the set of relation node identifiers for the leaf node; and
[0073] After locating the position information of any non-leaf node, delete the identifier of any non-leaf node from the set of identifiers of all relation nodes containing the non-leaf node.
[0074] Optionally, it also includes a master node relationship object, used to store a set of relationship node identifiers for all nodes, and the method further includes:
[0075] If there are still unlocated node identifiers in the total node relationship object, repeat the above steps of determining the initial root node, calculating the node position, and determining the reference root node to determine the position information of each remaining node in the graph data.
[0076] Optionally, the total node relationship object does not contain information about nodes without relationships, and the method further includes:
[0077] If there are no unlocated node identifiers in the total node relationship object, determine the maximum value of the located nodes in the horizontal axis direction and the maximum value in the vertical axis direction.
[0078] The maximum value on the vertical axis is used as the value of the unrelated node in the vertical direction, and the sum of the maximum value on the horizontal axis and the preset offset is used as the value of the unrelated node in the horizontal direction.
[0079] Based on the edge data in the graph data, obtain the identifiers of the starting node and the target node, taking the position of any non-leaf node as the starting point.
[0080] To achieve the above objectives, according to another aspect of the present invention, a node positioning electronic device is provided.
[0081] The electronic device of this invention includes: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement any of the node positioning methods described above.
[0082] To achieve the above objectives, according to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements any of the node localization methods described above.
[0083] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: based on the node relationship object, according to the connection characteristics between nodes in the relationship node identifier set of the root node, non-leaf nodes with association relationships are grouped together, and an adaptive sorting is performed according to the grouping of non-leaf nodes and the number of leaf nodes, thereby calculating a uniform and symmetrical node order. Starting from the position of the root node, the position of each node is calculated according to this order, resulting in a smaller overall computational load and shorter time consumption.
[0084] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0085] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0086] Figure 1 This is a schematic diagram of the main process of a node positioning method according to an embodiment of the present invention;
[0087] Figure 2(a) is a schematic diagram of the graph layout before sorting;
[0088] Figure 2(b) is a schematic diagram of the layout of the graph after sorting;
[0089] Figure 3 This is a diagram illustrating the order of grouping leaf nodes and non-leaf nodes.
[0090] Figure 4A flowchart illustrating an optional node localization method according to an embodiment of the present invention;
[0091] Figure 5 This is a diagram illustrating the calculation of the maximum and minimum angles;
[0092] Figure 6 This is a flowchart illustrating a specific node positioning method according to an embodiment of the present invention;
[0093] Figure 7 This is a schematic diagram of the main modules of a node positioning device according to an embodiment of the present invention;
[0094] Figure 8 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0095] Figure 9 This is a schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present invention, such as a mobile device or server. Detailed Implementation
[0096] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0097] The following are explanations of the terms used in this plan:
[0098] Force-oriented algorithms calculate the combined attractive and repulsive forces between nodes by analyzing each node. This combined force is then used to move the nodes. After each iteration, a new energy value is calculated based on the new node positions. Similar to mechanics, a smaller energy value indicates a more stable network. Generally, a smaller energy value results in a clearer network configuration. Therefore, when the energy value reaches its minimum, the network configuration is the desired outcome.
[0099] Root node: The node with the most relationships with other nodes.
[0100] target: A set of node identifiers that have an edge relationship with the current node.
[0101] Included angle: The smallest positive angle formed by the intersection of a straight line connecting two nodes and the right side of a horizontal line passing through the root node.
[0102] See Figure 1 The diagram shows the main flowchart of a node localization method provided by an embodiment of the present invention, which includes the following steps:
[0103] S101: Based on the edge data in the graph data, obtain the set of relation node identifiers for each node, and determine the initial root node according to a preset method;
[0104] S102: For nodes in the relation node identifier set of the initial root node, if they are leaf nodes, they are grouped separately; if they are non-leaf nodes, they are grouped according to connection characteristics to determine the new relation node order based on the sorting method of the leaf node group and the non-leaf node group.
[0105] S103: Starting from the position of the initial root node, calculate the position information of each leaf node and each non-leaf node according to the new relation node order.
[0106] In the above implementation, for step S101, graph data is a data structure used to store and query data. It consists of two elements: nodes and relationships, with relationships taking precedence. Each node represents an entity (person, place, thing, category, or other data), and each relationship represents the way two nodes are associated. This general structure can model various scenarios—from road systems to device networks, to population medical histories, or anything else defined by relationships. Therefore, this solution is applicable to many scenarios, such as person-to-person relationship analysis, address relationship analysis in an address database, virtual identity relationship analysis, and other scenarios where data has relationships.
[0107] The edge data code structure in the graph data is shown below:
[0108]
[0109] Here, `id` is used to distinguish different edges, `source` represents the identifier of the starting node, and `target` represents the identifier of the target node. The `edges` array is traversed, and `source` and `target` are retrieved as keys. If the key exists, its count is incremented by 1; otherwise, it is set to 1. This determines the edge relationships between each node and other nodes. For example:
[0110]
[0111]
[0112] As shown above, node 'a' has 2 edges connecting it to other nodes. This means that there are two elements in the target (here, the set of relation node identifiers) that represent the relation nodes that have edges connecting to node 'a'. Here, we also need to consider the target node's number and target, which are determined in the same way as node 'a'.
[0113] By following the traversal steps described above, and recording the number of edge relationships for each node and the set of relationship node identifiers, we obtain the node relationship object for each node, as shown above.
[0114] "a":{
[0115] "number":2
[0116] "target":["b","c"]
[0117] The node relationship objects of all nodes are combined to form a complete node relationship object, namely the total node relationship object, which is the basis for all subsequent calculations.
[0118] This step also includes determining the initial root node and unrelated nodes. The node with the most relationships with other nodes, i.e., the largest number of edge relationships (number), is determined as the initial root node, as shown by point 1 in Figure 2(a). The largest number of edge relationships indicates that this node has the greatest correlation with other nodes in the entire graph data. Using it as the initial root node makes the final graph data visually more consistent with the data logic. Nodes that exist in the graph data but have zero edge relationships are considered unrelated nodes, as shown by point 3 in Figure 2(a). In practice, the initial root node can also be selected randomly, and this selection is usually performed by staff.
[0119] For step S102, the set of relation node identifiers target of the initial root node is traversed to determine all nodes that have edge relationships with the initial root node. For each node, it is divided into leaf nodes or non-leaf nodes according to the number of its edge relationships. As shown in Figure 2(a), the set of relation node identifiers target of point 1 is "target":["A","B","C","D","E","F","G","H","I"]. For node A, its "number" is 1, which means that it only has an edge relationship with point 1 and is a leaf node. However, for node C, its "number" is 2, which means that it has an edge relationship with both point 1 and another node and is a non-leaf node.
[0120] Each leaf node is grouped separately, as shown in Figure 2(a), where nodes H and I are grouped separately. However, for non-leaf nodes, connection characteristics need to be considered for grouping, specifically: directly connected, indirectly connected, overlapping and non-root nodes, etc., again using Figure 2(a) as an example:
[0121] Example 1: Node A and Node B
[0122] The target set of relation node identifiers for node A is ["point 1", "B"], and the target set of relation node identifiers for node B is ["point 1", "A"]. By using the target of at least one of node A and node B, it can be determined that there is a direct connection between the two, and node A and node B are grouped together.
[0123] Example 2: Node G and Node F
[0124] The target set of relation node identifiers for node G is ["point 1", "E"], and the target set of relation node identifiers for node F is ["point 1", "E"]. Based on the targets of nodes G and F, it is determined that both have a direct connection relationship with node E, and node E is a non-leaf node of "point 1". Therefore, nodes E, F and G are grouped together.
[0125] Alternatively, if node G's target contains node E, and node E is a non-leaf node of node 1, then node G and node E are grouped together. The same applies to node F; since node E is grouped with both node G and node F, nodes E, F, and G must be grouped together.
[0126] Alternatively, if the set of relation node identifiers for node E is ["point1", "F", "G"], and nodes F and G are non-leaf nodes of "point1", then nodes E, F, and G are grouped together.
[0127] Example 3: Nodes C and D
[0128] The target set of relation node identifiers for node C is ["point 1", "point 2"], and the target set of relation node identifiers for node D is ["point 1", "point 2"]. Based on the targets of nodes C and D, it is determined that both have a direct connection relationship with "point 2". However, "point 2" is not a non-leaf node of "point 1", so only nodes C and D are grouped together.
[0129] The above steps can avoid overlapping lines between nodes with edge relationships in the graph data. In practice, graph data does not have only one root node. Therefore, a node of a certain root node may have edge relationships with other root nodes / nodes, as shown in Figure 2(a), where nodes C and D have edge relationships with point 2. To further reduce the probability of line overlap, leaf nodes and non-leaf nodes can be grouped and sorted. Specifically:
[0130] S301: Count the first number of leaf node groups and the second number of non-leaf node groups;
[0131] S302: Compare the size relationship between the first quantity and the second quantity, and take the first quantity or the second quantity with the larger value as the dividend, and take the remaining second quantity or the first quantity as the divisor;
[0132] S303: Round up the results of the calculation of the dividend and divisor to determine the sorting method of the leaf node group and the non-leaf node group, and then obtain the order of calculating the position information of each node.
[0133] Taking Figure 2(a) as an example, the initial root node "point 1" has 2 leaf nodes and 3 non-leaf node groups. Therefore, the second number is larger and is used as the dividend. The number of leaf nodes (2) is used as the divisor. Dividing the two yields a result of 1.5, which is rounded up to 2. The sorting method is: 2 non-leaf node groups - 1 leaf node - 1 non-leaf node group - 1 leaf node, as shown in Figure 2(b). However, in some cases, the number of leaf nodes is larger. The calculation process is the same as above, to group related nodes together, allowing users to better observe the relationships and achieve a uniform and symmetrical distribution.
[0134] For step S103, when calculating the position of a node, there is a reference position, which is the position of the root node. As shown in Figure 2(b), when calculating the positions of the three nodes X, Y, and Z, the root node is point 2. This is a depth-first recursion, and each recursive calculation has its own root node.
[0135] After obtaining the new order of relational nodes, using the position of the initial root node as the initial coordinates (usually coordinates randomly assigned by the canvas), calculate the relative position of each node with respect to the initial root node according to the new order. After calculation, clear the identified node identifiers from the set of all relational node identifiers. For example, after calculating the position information of node A, the target of point 1 is updated to ["B","C","D","E","F","G","H","I"], and the target of node B is updated to ["point 1"] or [NULL]. For leaf nodes, they are simply cleared.
[0136] If the target of a node is empty, it means that the positions of all nodes with edge relationships to that node have been calculated, and the node needs to be removed from the overall node relationship object. Specifically, its key needs to be cleared. When the overall node relationship object is empty, it means that the positions of all nodes have been calculated.
[0137] The method provided in the above embodiments uses the node relationship object of the node as the calculation basis to obtain a simple, orderly and efficient network diagram layout calculation effect. According to the connection characteristics between nodes in the relationship node identifier set of the root node, non-leaf nodes with association relationships are grouped together, and an adaptive sorting is performed based on the grouping of non-leaf nodes and the number of leaf nodes to calculate a uniform and symmetrical node order.
[0138] See Figure 4 The diagram illustrates an optional node localization method according to an embodiment of the present invention, comprising the following steps:
[0139] S401: Based on the edge data in the graph data, obtain the set of relation node identifiers for each node, and determine the initial root node according to a preset method;
[0140] S402: For nodes in the relation node identifier set of the initial root node, if they are leaf nodes, they are grouped separately; if they are non-leaf nodes, they are grouped according to connection characteristics to determine the new relation node order based on the sorting method of the leaf node group and the non-leaf node group.
[0141] S403: Starting from the position of the initial root node, calculate the position information of each leaf node and each non-leaf node according to the new relation node order;
[0142] S404: Clear all located node identifiers in the set of all relation node identifiers, and determine whether there are one or more non-leaf nodes in the non-leaf nodes of the initial root node whose set of relation node identifiers is not empty;
[0143] S405: For any non-leaf node among the one or more non-leaf nodes, take that non-leaf node as the reference root node;
[0144] S406: Determine one or more nodes that have been located in the set of relation node identifiers of any non-leaf node, and calculate the angle between each of the one or more nodes and any non-leaf node.
[0145] S407: Calculate the difference between the maximum and minimum angles, and subtract the difference from 360 as the effective spatial range of the relation node layout for any non-leaf node; where the maximum included angle is the starting angle of the layout.
[0146] S408: Starting from the position of any non-leaf node, repeat the above operations of node grouping, calculating node positions, and clearing the located nodes in the set to obtain the position information of each node in the relation node identifier set of any non-leaf node.
[0147] In the above embodiments, for steps S401 to S403, please refer to... Figures 1-3 The description shown will not be repeated here.
[0148] In the above implementation, for steps S404 to S408, taking Figure 2(b) as an example, the target set of relational node identifiers of node 1 is ["A","B","C","D","E","F","G","H","I"]. After calculating the node position information and clearing the identified nodes through the aforementioned steps, the target set of relational node identifiers of some non-leaf nodes is still not empty, such as target["point1","point2"] of node C and target["point1","point2"] of node D.
[0149] For node C, since its position is fixed, node C is taken as the reference root node (i.e., not the first root node). However, when calculating the positions of the related nodes of the reference root node, some of these related nodes have already been located through the previous root node. To reduce subsequent calculations, the current process needs to calculate the angle between the located nodes and the reference root node based on the positions of these located nodes, and extract the maximum and minimum angles. The maximum angle is the starting angle for obtaining the layout, and 360 – (maximum angle – minimum angle) is the effective spatial range of the layout. See [link to relevant documentation]. Figure 5 As shown.
[0150] Taking Figure 2(b) as an example, in the calculation process with point C as the reference root node, the position of its relation node "point 1" is known. It cannot be directly distributed around node C in a 360-degree manner. Instead, it is necessary to subtract the angle occupied by point 1 to calculate the available space, thereby minimizing the visual overlap of the relation lines. Continue to repeat the aforementioned steps of node grouping, calculating node positions, and removing the markers of already located nodes to determine the position information of point 2.
[0151] For node D, the node position information in its target["point1","point2"] is known at present. This is only a special case. Both node C and node D are connected to point 2. In actual operation, node D may be connected to other nodes. Therefore, the above steps need to be repeated to determine the position information of the related nodes of node D.
[0152] Recursively using the above steps, after determining the location information of point 2, the location information of X, Y, and Z is determined through point 2. By default, these three nodes will be evenly distributed around point 2, and the relationship lines of the three nodes will overlap with other relationship lines of point 2. Real business data is extremely complex, and it is extremely difficult to visually distinguish these relationships. Among the relationship nodes of point 2, nodes C and D have already been located in the process of using point 1 as the root node, so the positions of nodes C and D can be calculated. The angles between them and point 2 are 250 degrees and 280 degrees, respectively. Therefore, the space range around point 2 where nodes can be placed is calculated to be 360 - (280 - 250) = 330 degrees, in order to minimize the visual overlap of relationship lines.
[0153] The method provided in the above embodiments, for non-first root nodes, traverses its already located nodes, calculates the angles between these nodes and non-first root nodes, and then calculates the starting angle and effective layout range of non-first root nodes based on the maximum and minimum angles; and uses a recursive traversal method to calculate the position of each node in sequence.
[0154] See Figure 6 The diagram illustrates a specific node localization method according to an embodiment of the present invention, including the following steps:
[0155] S601: Based on the edge data in the graph data, obtain the set of relation node identifiers for each node, and determine the initial root node according to a preset method; wherein, the total node relation object is used to store the set of relation node identifiers for all nodes, and does not contain information about nodes without relations;
[0156] S602: For nodes in the relation node identifier set of the initial root node, if they are leaf nodes, they are grouped separately; if they are non-leaf nodes, they are grouped according to their connection characteristics to determine the new relation node order based on the sorting method of the leaf node group and the non-leaf node group.
[0157] S603: Starting from the position of the initial root node, calculate the position information of each leaf node and each non-leaf node according to the new relation node order;
[0158] S604: Clear all located node identifiers in the set of all relation node identifiers, and determine whether there are one or more non-leaf nodes in the non-leaf nodes of the initial root node whose set of relation node identifiers is not empty;
[0159] S605: For any non-leaf node among the one or more non-leaf nodes, take that non-leaf node as the reference root node;
[0160] S606: Determine one or more nodes that have been located in the set of relation node identifiers of any non-leaf node, and calculate the angle between each of the one or more nodes and any non-leaf node.
[0161] S607: Calculate the difference between the maximum angle and the minimum angle, and subtract the difference from 360 as the effective spatial range of the relation node layout for any non-leaf node; where the maximum included angle is the starting angle of the layout.
[0162] S608: Starting from the position of any non-leaf node, repeat the above operations of node grouping, calculating node positions, and clearing the located nodes in the set to obtain the position information of each node in the relation node identifier set of any non-leaf node.
[0163] S609: If there are still unlocated node identifiers in the total node relationship object, repeat the above steps of determining the initial root node, calculating the node position, and determining the reference root node to determine the position information of each remaining node in the graph data;
[0164] S610: If there are no unlocated node identifiers in the total node relationship object, determine the maximum value of the located nodes in the horizontal axis direction and the maximum value in the vertical axis direction.
[0165] S611: Use the maximum value of the vertical axis as the value of the unrelated node in the vertical direction, and use the sum of the maximum value of the horizontal axis and the preset offset as the value of the unrelated node in the horizontal direction.
[0166] In the above embodiments, steps S601 to S603 can be found in [reference needed]. Figure 1 As described, steps S604 to S608 can be found in [reference needed]. Figure 4 The description shown will not be repeated here.
[0167] In the above implementation, for steps S609 to S611, as shown in Figure 2(b), since point 1 has the largest number of edge relationships, it is taken as the initial root node, and the position information of its relation nodes is determined first. Since the relation node identifier set target of nodes C and D is not empty, the position information of their relation nodes is recursively determined using nodes C and D as reference root nodes, which is point 2 in this case. After determining the position information of point 2, the relation node identifier set target of point 2 is also not empty, so the position information of its relation nodes is determined again using point 2 as the reference root node.
[0168] As described above, the total node relationship object stores the number of edge relationships and the set of relationship node identifiers for all nodes, but does not contain information about nodes without relationships. Therefore, we first need to determine whether the total node relationship object still contains node information. For Figure 2(b), it still contains point 4, node J, and node K. Therefore, we need to repeat the steps of determining the initial root node, calculating the node positions, and determining the reference root node to determine the position information of each remaining node in the graph data, excluding nodes without relationships. Here, the new root node is point 4.
[0169] Point 3 is a node without relationships, meaning it is not found in any of the relationship arrays and has no edge relationships with other nodes. Typically, the position information of the unrelated nodes is determined only after all node position information has been determined (i.e., the total node relationship object has no node information). See Figure 2(b), which calculates the position information of each node except point 3 before calculating the position information of point 3.
[0170] To avoid unrelated nodes affecting the remaining nodes, the maximum values of the located nodes in the horizontal and vertical directions are determined. The maximum value in the vertical direction is used as the value of the unrelated node in the vertical direction. The sum of the maximum value in the horizontal direction and a preset offset (e.g., 100) is used as the value of the unrelated node in the horizontal direction, so as to keep the unrelated node as far away from other nodes as possible.
[0171] The method provided in the above embodiments includes four core logics: node relationship object calculation, relationship node sequence calculation, root node angle calculation, and calculation stopping condition. Compared with the prior art, it has at least the following beneficial effects:
[0172] 1. Based on the connection characteristics between nodes in the root node's relation node identifier set, non-leaf nodes with related relationships are grouped together, and an adaptive sort is performed based on the number of non-leaf node groups and leaf node groups to calculate a uniform and symmetrical node order.
[0173] 2. For non-first root nodes, traverse the nodes that have been located, calculate the angles between these nodes and the non-first root nodes, and then calculate the starting angle and effective layout range of the non-first root nodes based on the maximum and minimum angles.
[0174] 3. Using this solution, only one layout effect will be calculated for the same graph data, thereby improving the user experience; the entire process relies on node relationship objects and the amount of calculation is small, so the memory consumption and time consumption are relatively small; compared with the existing force-oriented algorithm, there is no need to set initial configuration or conduct multiple trials to quickly obtain the final layout effect.
[0175] See Figure 7The diagram shows the main modules of a node positioning device 700 provided in an embodiment of the present invention, including:
[0176] The acquisition module 701 is used to acquire the set of relation node identifiers for each node based on the edge data in the graph data, and determine the initial root node according to a preset method;
[0177] The sorting module 702 is used to sort the nodes in the relation node identifier set of the initial root node. If they are leaf nodes, they are grouped separately; if they are non-leaf nodes, they are grouped according to their connection characteristics to determine the new relation node order based on the sorting method of the leaf node group and the non-leaf node group.
[0178] The calculation module 703 is used to calculate the position information of each leaf node and each non-leaf node respectively, starting from the position of the initial root node and according to the new relation node order.
[0179] In the apparatus of this invention, the acquisition module 701 is used for:
[0180] Based on the edge data in the graph data, obtain the identifiers of the starting node and the target node;
[0181] For any starting node, based on the identifiers of other nodes with which it has an edge relationship, generate a set of relation node identifiers for that starting node; and
[0182] For any target node, and based on the identifiers of other nodes with edge relationships, generate a set of relation node identifiers for that target node.
[0183] In the apparatus of this invention, the acquisition module 701 is used for:
[0184] The number of edge relationships for each node is determined based on the edge data, and the node with the largest number of edge relationships is determined as the initial root node.
[0185] Before the step of grouping leaf nodes into a single group and non-leaf nodes into groups based on connection characteristics, the following steps are also included:
[0186] If the number of edge relationships of a single node is 1, then the single node is determined to be a leaf node because it only has an edge relationship with the initial root node; otherwise, it is a non-leaf node.
[0187] In the apparatus of this invention, the acquisition module 701 is used for:
[0188] In response to a selection operation on any node, the selected node is used as the initial root node.
[0189] In the apparatus of this invention, the sorting module 702 is used for:
[0190] For the first non-leaf node and the second non-leaf node, if a direct connection is determined based on the set of relation node identifiers of the first non-leaf node and / or the second non-leaf node, then the first non-leaf node and the second non-leaf node are grouped together; or
[0191] If, based on the set of relation node identifiers of the first and second non-leaf nodes, it is determined that both have direct connections to the third non-leaf node, then the first, second, and third non-leaf nodes are grouped together; or
[0192] If, based on the set of relation node identifiers of the first and second non-leaf nodes, it is determined that both are non-leaf nodes that have direct connections with other nodes and that are not the initial root node, then the first and second non-leaf nodes are grouped together.
[0193] In the apparatus of this invention, the sorting module 702 is used for:
[0194] Count the first number of leaf node groups and the second number of non-leaf node groups;
[0195] Compare the size relationship between the first quantity and the second quantity, and take the first quantity or the second quantity with the larger value as the dividend, and take the remaining second quantity or the first quantity as the divisor;
[0196] The results of calculating the dividend and divisor are rounded up to determine the sorting method of the leaf node group and the non-leaf node group, thereby obtaining the order in which the position information of each node is calculated.
[0197] The apparatus for implementing this invention further includes a recursive module, used for:
[0198] Clear all located node identifiers from the set of all relation node identifiers, and determine whether there are one or more non-leaf nodes in the non-leaf nodes of the initial root node whose set of relation node identifiers is not empty;
[0199] For any one of the one or more non-leaf nodes, take that non-leaf node as the reference root node;
[0200] Starting from the position of any non-leaf node, repeat the above operations of node grouping, calculating node positions, and clearing the located nodes in the set to obtain the position information of each node in the relation node identifier set of any non-leaf node.
[0201] In the apparatus of this invention, the recursive module is further configured to:
[0202] Determine one or more nodes that have been located in the set of relation node identifiers of any non-leaf node, and calculate the angle between each of the one or more nodes and any non-leaf node.
[0203] Calculate the difference between the maximum and minimum angles, and subtract the difference from 360 as the effective spatial range of the relation node layout for any non-leaf node; where the maximum included angle is the starting angle of the layout.
[0204] In the apparatus of this invention, the recursive module is used for:
[0205] After locating the position information of the leaf node, clear the set of relation node identifiers for the leaf node; and
[0206] After locating the position information of any non-leaf node, delete the identifier of any non-leaf node from the set of identifiers of all relation nodes containing the non-leaf node.
[0207] The apparatus for implementing this invention further includes a master node relationship object, used to store a set of relationship node identifiers for all nodes, and the method further includes:
[0208] If there are still unlocated node identifiers in the total node relationship object, repeat the above steps of determining the initial root node, calculating the node position, and determining the reference root node to determine the position information of each remaining node in the graph data.
[0209] In the implementation device of the present invention, the total node relationship object does not contain information about unrelated nodes, and the method further includes:
[0210] If there are no unlocated node identifiers in the total node relationship object, determine the maximum value of the located nodes in the horizontal axis direction and the maximum value in the vertical axis direction.
[0211] The maximum value on the vertical axis is used as the value of the unrelated node in the vertical direction, and the sum of the maximum value on the horizontal axis and the preset offset is used as the value of the unrelated node in the horizontal direction.
[0212] Based on the edge data in the graph data, obtain the identifiers of the starting node and the target node, taking the position of any non-leaf node as the starting point.
[0213] Furthermore, the specific implementation details of the device described in the embodiments of the present invention have been described in detail in the above-described method, so the details will not be repeated here.
[0214] Figure 8 An exemplary system architecture 800 to which embodiments of the present invention can be applied is shown, including terminal devices 801, 802, 803, network 804, and server 805 (only an example).
[0215] Terminal devices 801, 802, and 803 can be various electronic devices with displays and web browsing capabilities, and can be equipped with various communication client applications. Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc.
[0216] Network 804 is a medium used to provide a communication link between terminal devices 801, 802, 803 and server 805. Network 804 can include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0217] Server 805 can be a server that provides various services. It should be noted that the methods provided in the embodiments of the present invention are generally executed by server 805, and correspondingly, the devices are generally set in server 805.
[0218] It should be understood that Figure 8 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0219] The following is for reference. Figure 9 It shows a schematic diagram of the structure of a computer system 900 suitable for implementing a terminal device of the present invention. Figure 9 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0220] like Figure 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 902 or programs loaded from storage section 908 into random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the system 900. The CPU 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0221] The following components are connected to I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to I / O interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 910 as needed so that computer programs read from it can be installed into storage section 908 as needed.
[0222] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 909, and / or installed from removable medium 911. When the computer program is executed by central processing unit (CPU) 901, it performs the functions defined above in the system of this invention.
[0223] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0224] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0225] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a traversal module, a sorting module, and a calculation module. The names of these modules do not necessarily limit the module itself; for example, the calculation module can also be described as a "position calculation module".
[0226] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to perform a node positioning method.
[0227] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of node positioning, characterized by, The method is performed by a server and applied to a scenario with an association relationship between data, the scenario being one of a character relationship analysis, an address relationship analysis in an address library, and a virtual identity relationship analysis, and the method comprises the following steps: According to the edge data in the graph data, a relationship node identifier set of each node is obtained, and an initial root node is determined in a preset manner; wherein the graph data includes multiple root nodes, and there is an edge relationship between the nodes of different root nodes; For the nodes in the relationship node identifier set of the initial root node, if they are leaf nodes, they are individually grouped, and if they are non-leaf nodes, they are grouped according to connection characteristics, so as to determine a new relationship node order according to the ordering manner of the leaf node group and the non-leaf node group; wherein if it is determined according to the relationship node identifier sets of a first non-leaf node and a second non-leaf node that both of them have a direct connection relationship with other nodes, and the other nodes are not non-leaf nodes of the initial root node, the first non-leaf node and the second non-leaf node are grouped into one group; Taking the position of the initial root node as a starting point, the position information of each leaf node and each non-leaf node is calculated in the new relationship node order; All positioned node identifiers in the relationship node identifier set are cleared, and it is determined whether there is one or more non-leaf nodes with a non-empty relationship node identifier set among the non-leaf nodes of the initial root node; For any non-leaf node in the one or more non-leaf nodes, the any non-leaf node is taken as a reference root node; Taking the position of the any non-leaf node as a starting point, the operations of node grouping, node position calculation and positioned node clearing in the set are repeated to obtain the position information of each node in the relationship node identifier set of the any non-leaf node.
2. The method of claim 1, wherein, The method of obtaining the relationship node identifier set of each node according to the edge data in the graph data comprises the following steps: According to the edge data in the graph data, the identifier of a starting node and the identifier of a target node are obtained; For any starting node, the relationship node identifier set of the starting node is generated based on the identifiers of other nodes having an edge relationship; and For any target node, the relationship node identifier set of the target node is generated based on the identifiers of other nodes having an edge relationship.
3. The method according to claim 1 or 2, characterized in that, The method of determining the initial root node in a preset manner comprises the following steps: The number of edge relationships of each node is determined according to the edge data, and the node with the largest number of edge relationships is determined as the initial root node; Before the step of if the nodes are leaf nodes, they are individually grouped, and if the nodes are non-leaf nodes, they are grouped according to connection characteristics, the method further comprises the following steps: If the number of edge relationships of a single node is 1, it is determined that the single node only has an edge relationship with the initial root node, and the single node is determined to be a leaf node, otherwise, the single node is determined to be a non-leaf node.
4. The method according to claim 1 or 2, characterized in that, The method of determining the initial root node in a preset manner comprises the following steps: In response to a selection operation on any node, the selected node is taken as the initial root node.
5. The method of claim 1, wherein, The method of grouping the non-leaf nodes according to connection characteristics comprises the following steps: For the first non-leaf node and the second non-leaf node, if it is determined according to the relationship node identifier set of the first non-leaf node and / or the second non-leaf node that the two exist a direct connection relationship, the first non-leaf node and the second non-leaf node are divided into a group; or If it is determined according to the relationship node identifier set of the first non-leaf node and the second non-leaf node that the two exist a direct connection relationship with the third non-leaf node, the first non-leaf node, the second non-leaf node and the third non-leaf node are divided into a group.
6. The method according to claim 1 or 5, characterized in that, The determining of the new relationship node sequence according to the ordering mode of the leaf node group and the non-leaf node group comprises: Counting a first quantity of the leaf node group and a second quantity of the non-leaf node group; Comparing the size relationship of the first quantity and the second quantity, taking the larger one as the dividend and the remaining one as the divisor; Taking the upward integer of the calculation result of the dividend and the divisor to determine the ordering mode of the leaf node group and the non-leaf node group, and then obtaining the sequence for calculating the position information of each node.
7. The method of claim 1, wherein, Before calculating the node position, it further comprises: Determining one or more nodes in the relationship node identifier set of the any non-leaf node that have been positioned to calculate the included angle between each node in the one or more nodes and the any non-leaf node; Calculating the difference between the maximum angle and the minimum angle, and taking the result of subtracting the difference from 360 as the effective space range of the relationship node layout of the any non-leaf node; wherein the maximum angle is the starting angle of the layout.
8. The method of claim 1, wherein, The clearing of all the node identifiers in the relationship node identifier set that have been positioned comprises: After positioning the position information of the leaf node, clearing the relationship node identifier set of the leaf node; and After positioning the position information of the any non-leaf node, deleting the identifier of the any non-leaf node from all the relationship node identifier sets containing the any non-leaf node.
9. The method according to claim 7 or 8, characterized in that, It further comprises a total node relationship object for storing the relationship node identifier set of all nodes, and the method further comprises: If there are still unpositioned node identifiers in the total node relationship object, repeating the above steps of determining the initial root node, calculating the node position and determining the reference root node to determine the position information of each node remaining in the graph data.
10. The method of claim 9, wherein, The total node relationship object does not contain information of the non-relationship node, and the method further comprises: In the case that there is no unpositioned node identifier in the total node relationship object, determining the maximum value of the positioned nodes in the horizontal axis direction and the maximum value in the vertical axis direction; Taking the vertical axis maximum value as the value of the non-relationship node in the vertical axis direction, and taking the sum of the horizontal axis maximum value and a preset offset as the value of the non-relationship node in the horizontal axis direction.
11. A node positioning apparatus, characterized by, Executed by a server, applied to a scenario with an associated relationship between data, the data being one of character relationship data, address relationship data in an address library, and virtual identity relationship data, comprising: An acquisition module is configured to acquire a relationship node identifier set of each node according to edge data in graph data, and determine an initial root node according to a preset mode; wherein the graph data comprises a plurality of root nodes, and there is an edge relationship between nodes of different root nodes; An acquisition module is configured to acquire a relationship node identifier set of each node according to edge data in graph data, and determine an initial root node according to a preset mode; wherein the graph data comprises a plurality of root nodes, and there is an edge relationship between nodes of different root nodes; The sorting module is configured to, for the nodes in the set of relation node identifiers of the initial root node, if the nodes are leaf nodes, the nodes are individually in a group, if the nodes are non-leaf nodes, the nodes are grouped according to connection characteristics, and a new relation node sequence is determined according to the sorting manner of the leaf node group and the non-leaf node group; if, according to the set of relation node identifiers of a first non-leaf node and a second non-leaf node, it is determined that the first non-leaf node and the second non-leaf node have a direct connection relationship with other nodes, and the other nodes are not non-leaf nodes of the initial root node, the first non-leaf node and the second non-leaf node are grouped into one group; The calculation module is configured to, taking the position of the initial root node as a starting point, calculate the position information of each leaf node and each non-leaf node according to the new relation node sequence; The recursion module is configured to clear the positioned node identifiers in all the sets of relation node identifiers, and determine whether one or more non-leaf nodes exist in the non-leaf nodes of the initial root node, and the set of relation node identifiers of the one or more non-leaf nodes is not empty; For any non-leaf node in the one or more non-leaf nodes, the any non-leaf node is taken as a reference root node; Taking the position of the any non-leaf node as a starting point, the operations of node grouping, node position calculation, and clearing the positioned nodes in the set are repeated to obtain the position information of each node in the set of relation node identifiers of the any non-leaf node.
12. An electronic device, comprising: One or more processors; A storage device configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method in any one of claims 1-10. The program is executed by the processor to implement the method in any one of claims 1-10.
13. A computer readable medium having stored thereon a computer program, characterized in that
Citation Information
Patent Citations
Relational network graph layout method and device
CN112100289A
Network topological graph generation method and device, electronic equipment and storage medium
CN112583620A