Cluster-based topology structure generation method, device, and electronic device

By dividing Kubernetes cluster nodes into two categories, determining the number of rows and columns based on connection relationships and layout requirements, and using a sorting strategy to arrange the nodes, the target topology structure is generated. This solves the problem of unclear relationship display between cluster nodes and achieves a clearer and more beautiful topology display.

CN115390994BActive Publication Date: 2025-09-26HILLSTONE NETWORKS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211152599.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-21
Publication Date
2025-09-26
Estimated Expiration
2042-09-21

AI Technical Summary

Technical Problem

In the prior art, when a Kubernetes cluster topology diagram contains too many nodes and connections, the connections become disorganized, making it impossible to correctly distinguish the endpoints of the connections, thus affecting the appearance and clarity of the topology diagram.

Method used

The nodes are divided into two categories. The number of rows and columns is determined based on the connection relationship and layout requirements. The first category of nodes is arranged using a sorting strategy to generate an initial topological structure. The second category of nodes is then arranged on the initial topological structure to generate a target topological structure, thereby reducing line overlap and improving display clarity.

Benefits of technology

By staggering the nodes, the overlap of connections in the topology structure is effectively reduced, and the relationship between cluster nodes can be displayed more clearly and intuitively, improving the beauty and visibility of the topology diagram.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115390994B_ABST
    Figure CN115390994B_ABST
Patent Text Reader

Abstract

The present invention discloses a cluster-based topology generation method, apparatus, and electronic device. The method comprises: receiving a topology generation request; determining the number of rows and columns of a target topology based on layout requirements; arranging first-category nodes according to a first sorting strategy to generate an initial topology; and arranging second-category nodes on the initial topology based on the connection relationship between the first-category nodes and the second-category nodes to generate a target topology. The present invention solves the technical problem in related arts of being unable to generate a topology that clearly displays the relationships between cluster nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a cluster-based topology structure generation method, a device thereof, and an electronic device. Background Art

[0002] A pod is the smallest unit for running and deploying applications or services in a Kubernetes cluster. Currently, pods are not accessible externally in Kubernetes projects and require services as the entry point. The front-end interface typically provides a topology diagram, using points to represent pods and services and lines to represent the access relationships between pods and services. This combination of points and lines depicts the overall system structure.

[0003] However, a Kubernetes project often contains a large number of Pods and services. When a large number of nodes and connections are displayed on the page, how to make the topology diagram clear and intuitive is a crucial issue.

[0004] In related technologies, front-end visualization frameworks (e.g., Cytoscape.js, a front-end visualization library used for graph analysis and visualization) provide layout solutions to solve this problem, such as geometric layout, force-directed layout, hierarchical layout, etc. However, when there are too many nodes and connections, a large number of connections are interspersed in the topology graph, and the connections are disorganized. A line may pass through multiple nodes, and even connections may overlap, making it impossible to correctly distinguish the endpoints of the connections, resulting in misunderstandings. Taking the Grid mode (i.e., grid layout) of the geometric layout provided by Cytoscape.js as an example, Figure 1 This is a schematic diagram of an optional layout using a Grid mode according to the prior art, such as Figure 1 As shown, the line passes through multiple nodes, and the starting point and end point of the line cannot be determined.

[0005] In order to make the topology map more intuitive and clear, frameworks such as Cytoscape.js mainly use the method of modifying the connection style to optimize the topology display, but some problems still exist.

[0006] For example, Figure 2 This is a schematic diagram of an optional layout using a curve style according to the prior art, such as Figure 2 As shown in the figure, by increasing the curvature of the lines, curves are used instead of straight lines to layout and show the relationship between nodes. When using a curve style, when there are fewer points and lines, it can improve the visual error caused by the connection penetrating the nodes and improve the visibility and clarity of the topology. However, Figure 3 This is a schematic diagram showing the effect of using a curve style for layout according to an optional method in the prior art, such as Figure 3As shown in the figure, when the connection is more complicated, a large number of curves are intertwined with each other, which makes the visual more confusing than in the straight line mode. It is still impossible to clearly distinguish the endpoints of the connection, and a large number of curves are intertwined in the topology diagram, which will seriously affect the beauty of the topology diagram.

[0007] Figure 4 This is a schematic diagram of adding style marks to the starting point and end point of a line according to an optional method in the prior art, such as Figure 4 As shown in the figure, there are five styles of tags, including circle-triangle tag, triangle-backcurve tag, tee tag, circle tag, and none tag. When lines overlap or pass through other nodes, the endpoints of the lines can be distinguished based on their styles. However, Figure 5 This is a schematic diagram showing the effect of layout after using style markup according to an optional method in the prior art, such as Figure 5 As shown in the figure, this method only distinguishes the source and destination of a connection. However, when multiple connections overlap, it is also unable to effectively distinguish the relationship between connections between nodes. At the same time, this method still cannot improve the problem of a disorganized topology when a large number of connections are interspersed.

[0008] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0009] The embodiments of the present invention provide a cluster-based topology structure generation method, device, and electronic device thereof, to at least solve the technical problem in related technologies that a topology structure that can clearly display the relationship between cluster nodes cannot be generated.

[0010] According to one aspect of an embodiment of the present invention, a cluster-based topology structure generation method is provided, comprising: receiving a topology structure generation request, wherein the topology structure generation request includes at least: layout requirements, a connection relationship between a first type of node and a second type of node, the first type of node being a starting node, and the second type of node being a destination node; determining the number of rows and columns of a target topology structure based on the layout requirements; arranging the first type of nodes according to a first sorting strategy to generate an initial topology structure; arranging the second type of nodes on the initial topology structure according to the connection relationship between the first type of node and the second type of node to generate the target topology structure.

[0011] Optionally, before receiving the topology structure generation request, it also includes: based on the correspondence between nodes, dividing all nodes into two categories of nodes, wherein the two categories of nodes are: first category nodes and second category nodes; characterizing the first category nodes as the starting nodes, and characterizing the second category nodes as the destination nodes; based on the correspondence between the nodes, determining the connection relationship between the first category nodes and the second category nodes; determining the layout requirements based on the display size of the display interface, the number of nodes of the first category nodes and the number of nodes of the second category nodes; generating the topology structure generation request based on the connection relationship between the first category nodes and the second category nodes and the layout requirements.

[0012] Optionally, the step of arranging the first type of nodes according to a first sorting strategy includes: determining the number of connections of the second type of nodes connected to each first type of node based on the connection relationship between the first type of nodes and the second type of nodes; sorting the number of connections of the second type of nodes connected to each first type of node to obtain a sorting result; based on the sorting result, adopting the first sorting strategy, arranging the first type of nodes in sequence from the first column of the last row to the last column of the first row, wherein the first sorting strategy is to arrange the first type of nodes indicated by the maximum number of connections in the first column of the last row, and arrange the first type of nodes in sequence according to the horizontal direction from left to right, and after the last row is full, according to the vertical direction from bottom to top, starting from the first column of the previous row, and continue to arrange the first type of nodes according to the horizontal direction until the arrangement of the last column of the first row is completed.

[0013] Optionally, after arranging the first type of nodes according to the first sorting strategy and generating an initial topological structure, it also includes: determining the column identifier connected to each second type of node based on the arranged first type of nodes and the connection relationship between the first type of nodes and the second type of nodes; classifying the second type of nodes connected to each column into a fully connected node set; classifying the second type of nodes that are not connected to each column into an independent node set; generating two sets for each column, wherein one set is a to-be-processed set and the other set is a processed set, the to-be-processed set is used to store the second type of nodes that have connected columns but the column identifier of the connected columns is inconsistent with the column identifier of the current column, and the processed set is used to store the second type of nodes that are only not connected to the current column.

[0014] Optionally, after generating two sets for each column, the method further includes: after processing each column, if there are second-type nodes that are connected to the columns but not connected to every column, reclassifying the second-type nodes into the fully-connected node set.

[0015] Optionally, the step of arranging the second-type nodes on the initial topological structure based on the connection relationship between the first-type nodes and the second-type nodes to generate the target topological structure includes: on the initial topological structure, adopting a second sorting strategy, starting from the first row and first column under the arranged first-type nodes, and arranging the second-type nodes in sequence according to the horizontal direction from left to right and the vertical direction from bottom to top until the arrangement is completed in the last row and last column, thereby generating the target topological structure, wherein the second sorting strategy is: if the current column is not full of second-type nodes and there are still unarranged second-type nodes in the fully-connected node set, any second-type node in the fully-connected node set is arranged to the current position; if there are no unarranged second-type nodes in the fully-connected node set, but there are still unarranged second-type nodes in the processed set of the current column, any second-type node from the processed set of the current column is arranged to the current position; if there are no unarranged second-type nodes in the processed set of the current column and the fully-connected node set, any second-type node in the independent node set is arranged to the current position.

[0016] Optionally, after generating the target topological structure, the method further includes: determining the coordinate attributes of each node based on the row identifier and column identifier of the node; and displaying the coordinate attributes of each node on a display interface.

[0017] According to another aspect of an embodiment of the present invention, a cluster-based topology structure generation device is also provided, including: a receiving unit for receiving a topology structure generation request, wherein the topology structure generation request includes at least: layout requirements, a connection relationship between a first type of node and a second type of node, the first type of node is a starting node, and the second type of node is a destination node; a determination unit for determining the number of rows and columns of a target topology structure based on the layout requirements; an arrangement unit for arranging the first type of nodes according to a first sorting strategy to generate an initial topology structure; a generation unit for arranging the second type of nodes on the initial topology structure according to the connection relationship between the first type of node and the second type of node to generate the target topology structure.

[0018] Optionally, the generating device further includes: a first division module, used to divide all nodes into two categories of nodes based on the correspondence between nodes before receiving the topology structure generation request, wherein the two categories of nodes are: first category nodes and second category nodes; a first characterization module, used to characterize the first category nodes as the starting nodes and the second category nodes as the destination nodes; a first determination module, used to determine the connection relationship between the first category nodes and the second category nodes based on the correspondence between the nodes; a second determination module, used to determine the layout requirements based on the display size of the display interface, the number of nodes of the first category nodes and the number of nodes of the second category nodes; a first generation module, used to generate the topology structure generation request based on the connection relationship between the first category nodes and the second category nodes and the layout requirements.

[0019] Optionally, the arrangement unit includes: a third determination module, used to determine the number of connections of the second-type nodes connected to each first-type node based on the connection relationship between the first-type nodes and the second-type nodes; a first sorting module, used to sort the number of connections of the second-type nodes connected to each first-type node to obtain a sorting result; a first arrangement module, used to arrange the first-type nodes in sequence from the first column of the last row to the last column of the first row based on the sorting result, adopting the first sorting strategy, wherein the first sorting strategy is to arrange the first-type nodes indicated by the maximum number of connections in the first column of the last row, and arrange the first-type nodes in sequence according to the horizontal direction from left to right, and after the last row is full, according to the vertical direction from bottom to top, starting from the first column of the previous row, and continue to arrange the first-type nodes according to the horizontal direction until the arrangement of the last column of the first row is completed.

[0020] Optionally, the generating device further includes: a fourth determining module for determining the column identifier to which each second-category node is connected based on the arranged first-category nodes and the connection relationship between the first-category nodes and the second-category nodes after arranging the first-category nodes according to the first sorting strategy and generating an initial topological structure; a first classifying module for classifying the second-category nodes connected to each column into a fully connected node set; a second classifying module for classifying the second-category nodes not connected to each column into an independent node set; a second generating module for generating two sets for each column, wherein one set is a set to be processed and the other set is a processed set, the set to be processed is used to store the second-category nodes that have connected columns but whose column identifiers of the connected columns are inconsistent with the column identifier of the current column, and the processed set is used to store the second-category nodes that are only not connected to the current column.

[0021] Optionally, the generating device further includes: a third classification module, which is used to, after generating two sets for each column, reclassify the second-type nodes into the fully connected node set if there are second-type nodes that are connected to the columns but are not connected to each column after processing of each column is completed.

[0022] Optionally, the generation unit includes: a third generation module, which is used to adopt a second sorting strategy on the initial topological structure, starting from the first row and first column under the arranged first-type nodes, and arrange the second-type nodes in sequence according to the horizontal direction from left to right and the vertical direction from bottom to top, until the arrangement is completed in the last row and last column, to generate the target topological structure, wherein the second sorting strategy is: if the current column is not full of second-type nodes and there are still unarranged second-type nodes in the fully-connected node set, any second-type node in the fully-connected node set is arranged to the current position; if there are no unarranged second-type nodes in the fully-connected node set, but there are still unarranged second-type nodes in the processed set of the current column, any second-type node is selected from the processed set of the current column and arranged to the current position; if there are no unarranged second-type nodes in the processed set of the current column and the fully-connected node set, any second-type node in the independent node set is arranged to the current position.

[0023] Optionally, the generating device further includes: a fifth determination module for determining the coordinate attributes of each of the nodes based on the row identifier and column identifier of the node after generating the target topological structure; and a first display module for displaying the coordinate attributes of each of the nodes on a display interface.

[0024] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which includes a stored computer program. When the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned cluster-based topology structure generation method.

[0025] According to another aspect of an embodiment of the present invention, an electronic device is also provided, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned cluster-based topology structure generation method.

[0026] In the present disclosure, a topology generation request is received, and based on layout requirements, the number of rows and columns of a target topology is determined. According to a first sorting strategy, first-class nodes are arranged to generate an initial topology. According to the connection relationship between the first-class nodes and the second-class nodes, the second-class nodes are arranged on the initial topology to generate a target topology. In the present disclosure, the number of rows and columns can be determined according to the layout requirements, and then the first-class nodes and the second-class nodes can be arranged according to the sorting strategy to generate a target topology. This can stagger the connected nodes, effectively reduce the problem of overlapping lines in the topology, and more clearly and intuitively display the relationship between nodes, thereby solving the technical problem in related technologies of being unable to generate a topology that can clearly display the relationship between cluster nodes. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0028] Figure 1 This is a schematic diagram of an optional layout using a Grid mode according to the prior art;

[0029] Figure 2 This is a schematic diagram of an optional layout using a curved style according to the prior art;

[0030] Figure 3 This is a schematic diagram showing the effect of using a curve style for layout according to an optional method in the prior art;

[0031] Figure 4 This is a schematic diagram of adding style marks to the starting point and end point of a line according to an optional method in the prior art;

[0032] Figure 5 This is a schematic diagram showing the effect of layout after using style markup according to an optional method in the prior art;

[0033] Figure 6 is a flow chart of an optional cluster-based topology structure generation method according to an embodiment of the present invention;

[0034] Figure 7 is a schematic diagram of an optional arrangement according to an embodiment of the present invention;

[0035] Figure 8 is a schematic diagram of an optional layout process according to an embodiment of the present invention;

[0036] Figure 9is a schematic diagram of an optional topological structure generated according to an embodiment of the present invention without using the layout method proposed in this embodiment;

[0037] Figure 10 This is a schematic diagram of a topological structure generated by using an optional layout method proposed in this embodiment according to an embodiment of the present invention;

[0038] Figure 11 is a schematic diagram of an optional cluster-based topology structure generation device according to an embodiment of the present invention;

[0039] Figure 12 The figure is a hardware structure block diagram of an electronic device (or mobile device) for a cluster-based topology structure generation method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0041] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0042] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0043] The present invention is applicable to the topological structure with the same access relationship between services and Pods in Kubernetes, that is, there are two different types of nodes, there is no association between nodes of the same type, and there is a many-to-many relationship between different nodes.

[0044] Under the above-mentioned topological structure, the present invention can realize a layout method that distinguishes nodes with connections from those without connections based on the connection relationship between nodes, and makes the connections as non-overlapping as possible. This optimized layout method can make the connections as non-overlapping as possible. The number of rows and columns is determined according to the layout requirements. Nodes without connections are displayed in the top row or bottom row, nodes connected to nodes in each column are displayed in the middle row, and the remaining nodes are arranged in a manner that is staggered according to the connected nodes and not placed in the same column. This can center the topological map connections as much as possible, can intuitively distinguish nodes without any connection relationship, and at the same time, try to make the connections not overlap, so as to facilitate the distinction between the starting node and the destination node of the connection, and can effectively ensure the beauty and clarity of the topological map.

[0045] The present invention will be described in detail below with reference to various embodiments.

[0046] Example 1

[0047] According to an embodiment of the present invention, an embodiment of a cluster-based topology structure generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0048] Figure 6 is a flow chart of an optional cluster-based topology structure generation method according to an embodiment of the present invention, such as Figure 6 As shown, the method includes the following steps:

[0049] Step S601: receiving a topology structure generation request, wherein the topology structure generation request at least includes: layout requirements, connection relationships between first-type nodes and second-type nodes, where the first-type nodes are start nodes and the second-type nodes are destination nodes.

[0050] Step S602: Determine the number of rows and columns of the target topological structure based on layout requirements.

[0051] Step S603: Arrange the first type of nodes according to the first sorting strategy to generate an initial topology structure.

[0052] Step S604 : Arrange the second type of nodes on the initial topology structure according to the connection relationship between the first type of nodes and the second type of nodes to generate a target topology structure.

[0053] Through the above steps, a topology generation request can be received, and based on the layout requirements, the number of rows and columns of the target topology can be determined. According to the first sorting strategy, the first type of nodes are arranged to generate an initial topology. According to the connection relationship between the first type of nodes and the second type of nodes, the second type of nodes are arranged on the initial topology to generate a target topology. In an embodiment of the present invention, the number of rows and columns can be determined according to the layout requirements, and then the first type of nodes and the second type of nodes can be arranged according to the sorting strategy to generate a target topology. This can stagger the connected nodes, effectively reduce the problem of overlapping lines in the topology, and more clearly and intuitively display the relationship between nodes, thereby solving the technical problem in the related art of being unable to generate a topology that can clearly display the relationship between cluster nodes.

[0054] The embodiment of the present invention is described in detail below in conjunction with the above steps.

[0055] In an embodiment of the present invention, Pods cannot be directly accessed externally in a Kubernetes cluster; instead, a Service is used as the entry point to access the Pods. Services are used to define logical groupings of Pods and a policy for accessing them. Based on Kubernetes, a topological structure can be established and maintained to illustrate the relationship between Pods and Services, with points representing Pods and Services and lines representing the access relationship between Pods and Services. This combination of points and lines describes the Kubernetes structure.

[0056] In an embodiment of the present invention, optionally, before receiving a topology structure generation request, it also includes: based on the correspondence between nodes, dividing all nodes into two categories of nodes, wherein the two categories of nodes are: first category nodes and second category nodes; characterizing the first category nodes as starting nodes, and characterizing the second category nodes as destination nodes; based on the correspondence between nodes, determining the connection relationship between the first category nodes and the second category nodes; determining the layout requirements based on the display size of the display interface, the number of nodes of the first category nodes, and the number of nodes of the second category nodes; generating a topology structure generation request based on the connection relationship between the first category nodes and the second category nodes and the layout requirements.

[0057] In an embodiment of the present invention, the nodes can be divided into two categories through the correspondence between nodes (i.e., the access relationship between nodes), and the two categories of nodes are: first-category nodes (i.e., service nodes) and second-category nodes (i.e., Pod nodes). The first-category nodes are characterized as starting nodes and placed above the topological structure, and the second-category nodes are characterized as destination nodes and placed below the topological structure. Then, the connection relationship between the first-category nodes and the second-category nodes can be determined based on the correspondence between the nodes (i.e., the service nodes and the Pod nodes have a connection relationship). At the same time, the layout requirements can be determined based on the display size of the display interface, the number of nodes of the first category and the number of nodes of the second category. In this way, the topological structure generated according to the layout requirements can be displayed more neatly and beautifully. Then, based on the connection relationship and the layout requirements, a topological structure generation request is generated.

[0058] Step S601: receiving a topology structure generation request, wherein the topology structure generation request at least includes: layout requirements, connection relationships between first-type nodes and second-type nodes, where the first-type nodes are start nodes and the second-type nodes are destination nodes.

[0059] In an embodiment of the present invention, a topology structure generation request can be received to construct a topology structure for displaying the access relationship between the service node and the Pod node through the layout requirements carried in the topology structure generation request and the connection relationship between the first type of node and the second type of node.

[0060] Step S602: Determine the number of rows and columns of the target topological structure based on layout requirements.

[0061] In an embodiment of the present invention, the number of nodes displayed in each row (i.e., the number of columns) and the number of nodes displayed in each column (i.e., the number of rows) can be determined according to the layout requirements (i.e., according to the display size of the display interface and the number of nodes). In this way, the topological structure rearranged according to the layout requirements can be more neat and beautiful.

[0062] Step S603: Arrange the first type of nodes according to the first sorting strategy to generate an initial topology structure.

[0063] Optionally, the step of arranging the first type of nodes according to the first sorting strategy includes: determining the number of connections of the second type of nodes connected to each first type node based on the connection relationship between the first type of nodes and the second type of nodes; sorting the number of connections of the second type of nodes connected to each first type node to obtain a sorting result; based on the sorting result, adopting the first sorting strategy, arranging the first type of nodes in sequence from the first column of the last row to the last column of the first row, wherein the first sorting strategy is to arrange the first type of nodes indicated by the maximum number of connections in the first column of the last row, and arrange the first type of nodes in sequence according to the horizontal direction from left to right, and after the last row is full, according to the vertical direction from bottom to top, starting from the first column of the previous row, and continue to arrange the first type of nodes in the horizontal direction until the arrangement of the last column of the first row is completed.

[0064] In an embodiment of the present invention, the number of connections of the second-type nodes connected to each first-type node can be determined based on the connection relationship, and the number of connections can be sorted to obtain a sorting result (that is, the first-type nodes can be sorted in descending order according to the number of connected second-type nodes). Then, based on the sorting result, the first sorting strategy is adopted to arrange the first-type nodes in sequence from the first column of the last row to the last column of the first row (that is, the first-type nodes are arranged starting from the first one in the last row. When the last row is full, they are arranged starting from the first column of the previous row, and so on, until they are arranged to the last column of the first row).

[0065] In this embodiment, the first sorting strategy is to arrange the first-category nodes indicated by the maximum number of connections in the first column of the last row, and arrange the first-category nodes in sequence from left to right horizontally. After the last row is full, the first-category nodes are arranged horizontally starting from the first column of the previous row vertically from bottom to top, and so on, until the arrangement of the last column of the first row is completed. In this way, the first-category nodes without connections can be displayed in the top row, and the first-category nodes with many connections can be displayed in the middle row. This can more clearly show the access relationship between service nodes and Pod nodes, and help users focus on viewing nodes with connection relationships.

[0066] For example, suppose that 4 nodes are displayed per line, a0-a9 are first-class nodes, and the number of connected second-class nodes decreases. Figure 7 is a schematic diagram of an optional arrangement according to an embodiment of the present invention, such as Figure 7 As shown, the arrangement is: place a0 with the most connections in the first column of the last row, then place a1 in the second column of the last row. After the last row is full, start from the first column of the previous row (that is, the first column of the second row) and place a2, a3, a4, and a5 in order. After the second row is full, start from the first column of the previous row (that is, the first column of the first row) and place a6, a7, a8, and a9 in order.

[0067] Optionally, after arranging the first type of nodes according to the first sorting strategy and generating an initial topological structure, it also includes: determining the column identifier connected to each second type node based on the arranged first type nodes and the connection relationship between the first type nodes and the second type nodes; classifying the second type nodes connected to each column into a fully connected node set; classifying the second type nodes that are not connected to each column into an independent node set; generating two sets for each column, wherein one set is a to-be-processed set and the other set is a processed set, the to-be-processed set is used to store the second type nodes that have connected columns but the column identifiers of the connected columns are inconsistent with the column identifier of the current column, and the processed set is used to store the second type nodes that are only not connected to the current column.

[0068] In an embodiment of the present invention, it is possible to determine which columns each second-category node is connected to based on the arranged first-category nodes (i.e., based on the arranged first-category nodes and the connection relationship, determine the column identifier to which each second-category node is connected), and the second-category nodes connected to each column are separately recorded as connectAll (i.e., the second-category nodes connected to each column are classified as a fully connected node set), and the second-category nodes not connected to each column are separately recorded as connectNone (i.e., the second-category nodes not connected to each column are classified as an independent node set). In addition, two column objects can be generated for each column, a to-be-processed column and a processed column (that is, two sets are generated for each column, where one set is the to-be-processed set and the other set is the processed set). The to-be-processed column stores the second-category nodes that can be stored in the column (that is, the second-category nodes that have connections but are not connected to any first-category nodes in the column) (that is, the to-be-processed set is used to store the second-category nodes that have connected columns but whose column identifiers are inconsistent with the column identifier of the current column), and the processed column stores the second-category nodes confirmed to be placed in the column (that is, the processed set is used to store the second-category nodes that are only not connected to the current column).

[0069] Optionally, after generating two sets for each column, the method further includes: after processing each column, if there are second-type nodes that are connected to the columns but not connected to every column, reclassifying the second-type nodes into a fully connected node set.

[0070] In an embodiment of the present invention, if after each column is processed, there are still second-category nodes that have connections and are not connected to every column (that is, after each column is processed, if there are connected columns and second-category nodes that are not connected to every column), then these second-category nodes can be recorded as connectAll (that is, the second-category nodes are reclassified as a fully connected node set).

[0071] Step S604 : Arrange the second type of nodes on the initial topology structure according to the connection relationship between the first type of nodes and the second type of nodes to generate a target topology structure.

[0072] Optionally, the step of arranging the second type of nodes on the initial topological structure according to the connection relationship between the first type of nodes and the second type of nodes to generate the target topological structure includes: on the initial topological structure, adopting a second sorting strategy, starting from the first row and first column under the arranged first type of nodes, and arranging the second type of nodes in sequence according to the horizontal direction from left to right and the vertical direction from bottom to top until the arrangement is completed in the last row and last column, thereby generating the target topological structure, wherein the second sorting strategy is: if the current column is not full of second type nodes and there are still unarranged second type nodes in the fully connected node set, any second type node in the fully connected node set is arranged to the current position; if there are no unarranged second type nodes in the fully connected node set, but there are still unarranged second type nodes in the processed set of the current column, any second type node from the processed set of the current column is arranged to the current position; if there are no unarranged second type nodes in the processed set of the current column and the fully connected node set, any second type node in the independent node set is arranged to the current position.

[0073] In an embodiment of the present invention, the second type of nodes can be arranged on the initial topological structure based on the connection relationship to generate a target topological structure. Specifically, a second sorting strategy can be adopted on the initial topological structure, starting from the first row and first column under the arranged first type of nodes, and the second type of nodes can be arranged in sequence from left to right in the horizontal direction and from bottom to top in the vertical direction until the arrangement is completed in the last row and last column (that is, the second type of nodes can be arranged in sequence according to the first row and first column, the first row and second column, the first row and third column, ..., the last row and last column), to generate a target topological structure.

[0074] In this embodiment, the second sorting strategy is: if the current column is not full of second-class nodes and the fully connected node set still has unsorted second-class nodes, any second-class node in the fully connected node set is arranged to the current position (that is, if the column is not full of second-class nodes and connectAll still has unsorted second-class nodes, then a second-class node of connectAll is arranged to this position); if the fully connected node set has no unsorted second-class nodes, but the processed set of the current column still has unsorted second-class nodes, any second-class node from the processed set of the current column is arranged to the current position (that is, if the column If the processed column is full of second-class nodes or the processed column is not full of second-class nodes, but there are no unarranged second-class nodes in connectAll, and there are still unarranged second-class nodes in the processed column of the column, then put a second-class node from the processed column of the column to that position); if there are no unarranged second-class nodes in the processed set and the fully connected node set of the current column, arrange any second-class node in the independent node set to the current position (that is, if there are no unarranged second-class nodes in the processed set and connectAll, then put the second-class node of connectNone to that position).

[0075] In this way, the second-category nodes without connections can be displayed in the bottom row, the second-category nodes with many connections can be displayed in the middle row, and the remaining second-category nodes can be arranged in a way that the connected nodes are staggered and not placed in the same column. This can center the topology lines and intuitively distinguish nodes without any connection relationships. At the same time, it can also try to avoid overlapping of connections, making it easier to distinguish the starting node and destination node of the connection, effectively ensuring the beauty and clarity of the topology map.

[0076] Optionally, after generating the target topological structure, the method further includes: determining the coordinate attributes of each node based on the row identifier and column identifier of the node; and displaying the coordinate attributes of each node on the display interface.

[0077] In an embodiment of the present invention, after the first type of nodes and the second type of nodes are laid out and arranged, coordinate attributes can be added to each node according to the row number and column number of the node (that is, the coordinate attributes of each node are determined based on the row identifier and column identifier of the node), and then the coordinate attributes of each node are displayed on the display interface for more intuitive display.

[0078] The following describes in detail another optional specific implementation.

[0079] This embodiment can adopt the custom layout of the plug-in of the visualization framework such as Cytoscape.js to add coordinate attributes to the nodes and customize the node coordinates to control the layout of the topology map.

[0080] Figure 8 is a schematic diagram of an optional layout process according to an embodiment of the present invention, such as Figure 8 As shown, the process is as follows:

[0081] (1) Classify the nodes according to the relationship between them, and confirm that the type A nodes (i.e., the first type of nodes) are on the top and the type B nodes (i.e., the second type of nodes) are on the bottom.

[0082] (2) Determine the number of rows and columns of nodes based on layout requirements.

[0083] (3) Arrange the nodes of type A, sort them in descending order according to the number of connected type B nodes, and arrange the nodes of type A starting from the first one in the last row. When the last row is full, arrange them starting from the first one in the previous row, and so on.

[0084] (4) Class B nodes are divided into three categories: connected to every column, not connected to every column, and others.

[0085] (5) According to the strategy that the class B nodes and the connected class A nodes are not in the same column, the class B nodes belonging to other classes are stored in each column.

[0086] (6) The remaining class B nodes that do not conform to the above strategy are classified as class B nodes connected to each column.

[0087] (7) Arrange the nodes of type b by column.

[0088] (8) Determine whether the column is not full of Class B nodes, and there are Class B nodes that are connected to each column and not arranged. If so, store a Class B node that is connected to each column in this position; if not, determine whether the column still has unarranged Class B nodes belonging to other classes. If so, arrange the Class B nodes belonging to other classes in this position; if not, place the Class B nodes that are not connected to each column in this position.

[0089] (9) Finally, add coordinate attributes to the arranged nodes.

[0090] For example, there is the following application scenario: to create a topology diagram of Services and Pods in Kubernetes, you can first divide the nodes of the topology diagram into two categories, with Category A representing Services and Category B representing Pods, and then make the Services and Pods correspond by connecting them.

[0091] Figure 9 is a schematic diagram of an optional topological structure generated according to an embodiment of the present invention without using the layout method proposed in this embodiment, such as Figure 9The topology shown is arranged in the default order. The order of A1 to A16 and B17 to B38 remains unchanged. A1 to A16 are arranged from the first row and first column of the upper part to the last row and last column. B17 to B38 are arranged from the first row and first column of the lower part to the last row and last column. The displayed connections are disorganized and cannot clearly show the access relationship between the Service and the Pod.

[0092] Figure 10 FIG. 1 is a schematic diagram of a topological structure generated by using an optional layout method proposed in this embodiment according to an embodiment of the present invention. Figure 10 As shown, it is the topological structure arranged according to the optimized layout method based on the connection relationship between the nodes. According to the optimized layout method, A1 is placed in the last row and first column of the upper part, A13 is placed in the last row and second column of the upper part, A4 is placed in the last row and third column of the upper part, and A11 is placed in the last row and last column of the upper part. Then, A8, A3, A5, A6, A12, and A2 are placed in the second row and first column of the upper part, the second row and second column of the upper part, the second row and third column of the upper part, the second row and fourth column of the upper part, the second row and fifth column of the upper part, and the second row and sixth column of the upper part. A15, A16, A14, A7, A9, and A10 are placed in the first row and first column of the upper part, the first row and second column of the upper part, the first row and third column of the upper part, the first row and fourth column of the upper part, the first row and fifth column of the upper part, and the first row and sixth column of the upper part. B18, B17, B20, B29, B38, and B27 are placed in the first row and first column of the lower part, the second row and second column of the lower part, the second row and third column of the lower part, the second row and fourth column of the upper part, the second row and fifth column of the upper part, and the second row and sixth column of the upper part. Place B33, B21, B32, B24, B36, and B22 in the second row and first column of the lower part, the second row and second column of the lower part, the second row and third column of the lower part, the second row and fourth column of the lower part, the second row and fifth column of the lower part, and the second row and sixth column of the lower part respectively. Place B23, B25, B26, B28, B19, and B30 in the third row and first column of the lower part, the third row and second column of the lower part, the third row and third column of the lower part, the third row and fourth column of the lower part, the third row and fifth column of the lower part, and the third row and sixth column of the lower part respectively. Place B31, B34, B35, and B37 in the last row and first column of the lower part, the last row and second column of the lower part, the last row and third column of the lower part, and the last row and last column of the lower part respectively. The rearranged topology is neater and more beautiful than the default layout, and can more clearly and intuitively display the access relationship between Services and Pods.

[0093] In this embodiment of the present invention, nodes are arranged symmetrically based on the number of connections between them, ensuring that connections traverse fewer nodes. Furthermore, staggered placement of related nodes ensures that connections traversing a node do not overlap with the node's own connections, reducing the problem of overlapping connections in the topology and providing a clearer and more intuitive display of the relationships between nodes.

[0094] The following describes it in detail with reference to another embodiment.

[0095] Example 2

[0096] The cluster-based topology structure generation device provided in this embodiment includes multiple implementation units, each implementation unit corresponding to each implementation step in the above-mentioned embodiment 1.

[0097] Figure 11 is a schematic diagram of an optional cluster-based topology structure generation device according to an embodiment of the present invention, such as Figure 11 As shown, the generating device may include: a receiving unit 110, a determining unit 111, an arranging unit 112, and a generating unit 113, wherein:

[0098] The receiving unit 110 is configured to receive a topology structure generation request, wherein the topology structure generation request includes at least: a layout requirement and a connection relationship between a first-type node and a second-type node, where the first-type node is a start node and the second-type node is a destination node;

[0099] A determining unit 111 is configured to determine the number of rows and columns of a target topological structure based on layout requirements;

[0100] an arrangement unit 112, configured to arrange the first type of nodes according to a first sorting strategy to generate an initial topology structure;

[0101] The generating unit 113 is configured to arrange the second type of nodes on the initial topology structure according to the connection relationship between the first type of nodes and the second type of nodes to generate a target topology structure.

[0102] The above-mentioned generating device can receive a topology generation request through the receiving unit 110, determine the number of rows and columns of the target topology structure based on the layout requirements through the determining unit 111, arrange the first type of nodes according to the first sorting strategy through the arranging unit 112 to generate an initial topology structure, and arrange the second type of nodes on the initial topology structure according to the connection relationship between the first type of nodes and the second type of nodes through the generating unit 113 to generate the target topology structure. In an embodiment of the present invention, the number of rows and columns can be determined according to the layout requirements, and then the first type of nodes and the second type of nodes can be arranged according to the sorting strategy to generate the target topology structure, which can make the connected nodes arranged in a staggered manner, effectively reducing the problem of overlapping lines in the topology structure, and can more clearly and intuitively display the relationship between nodes, thereby solving the technical problem in the related art that a topology structure that can clearly display the relationship between cluster nodes cannot be generated.

[0103] Optionally, the generating device also includes: a first division module, used to divide all nodes into two categories of nodes based on the correspondence between nodes before receiving the topology structure generation request, wherein the two categories of nodes are: first category nodes and second category nodes; a first characterization module, used to characterize the first category nodes as starting nodes and the second category nodes as destination nodes; a first determination module, used to determine the connection relationship between the first category nodes and the second category nodes based on the correspondence between nodes; a second determination module, used to determine the layout requirements based on the display size of the display interface, the number of nodes of the first category nodes and the number of nodes of the second category nodes; a first generation module, used to generate a topology structure generation request based on the connection relationship between the first category nodes and the second category nodes and the layout requirements.

[0104] In an embodiment of the present invention, the nodes can be divided into two categories through the correspondence between nodes (i.e., the access relationship between nodes), and the two categories of nodes are: first-category nodes (i.e., service nodes) and second-category nodes (i.e., Pod nodes). The first-category nodes are characterized as starting nodes and placed above the topological structure, and the second-category nodes are characterized as destination nodes and placed below the topological structure. Then, the connection relationship between the first-category nodes and the second-category nodes can be determined based on the correspondence between the nodes (i.e., the service nodes and the Pod nodes have a connection relationship). At the same time, the layout requirements can be determined based on the display size of the display interface, the number of nodes of the first category and the number of nodes of the second category. In this way, the topological structure generated according to the layout requirements can be displayed more neatly and beautifully. Then, based on the connection relationship and the layout requirements, a topological structure generation request is generated.

[0105] Optionally, the arrangement unit includes: a third determination module, used to determine the number of connections of the second type nodes connected to each first type node based on the connection relationship between the first type nodes and the second type nodes; a first sorting module, used to sort the number of connections of the second type nodes connected to each first type node to obtain a sorting result; a first arrangement module, used to arrange the first type nodes in sequence from the first column of the last row to the last column of the first row based on the sorting result, using a first sorting strategy, wherein the first sorting strategy is to arrange the first type node indicated by the maximum number of connections in the first column of the last row, and arrange the first type nodes in sequence according to the horizontal direction from left to right, and after the last row is full, according to the vertical direction from bottom to top, starting from the first column of the previous row, and continue to arrange the first type nodes in the horizontal direction until the arrangement of the last column of the first row is completed.

[0106] In an embodiment of the present invention, the number of connections of the second-type nodes connected to each first-type node can be determined based on the connection relationship, and the number of connections can be sorted to obtain a sorting result (that is, the first-type nodes can be sorted in descending order according to the number of connected second-type nodes). Then, based on the sorting result, the first sorting strategy is adopted to arrange the first-type nodes in sequence from the first column of the last row to the last column of the first row (that is, the first-type nodes are arranged starting from the first one in the last row. When the last row is full, they are arranged starting from the first column of the previous row, and so on, until they are arranged to the last column of the first row).

[0107] In this embodiment, the first sorting strategy is to arrange the first-category nodes indicated by the maximum number of connections in the first column of the last row, and arrange the first-category nodes in sequence from left to right horizontally. After the last row is full, the first-category nodes are arranged horizontally starting from the first column of the previous row vertically from bottom to top, and so on, until the arrangement of the last column of the first row is completed. In this way, the first-category nodes without connections can be displayed in the top row, and the first-category nodes with many connections can be displayed in the middle row. This can more clearly show the access relationship between service nodes and Pod nodes, and help users focus on viewing nodes with connection relationships.

[0108] Optionally, the generating device further includes: a fourth determining module for determining the column identifier to which each second-type node is connected based on the arranged first-type nodes and the connection relationship between the first-type nodes and the second-type nodes after arranging the first-type nodes according to the first sorting strategy and generating the initial topological structure; a first classifying module for classifying the second-type nodes connected to each column into a fully connected node set; a second classifying module for classifying the second-type nodes that are not connected to each column into an independent node set; a second generating module for generating two sets for each column, wherein one set is a set to be processed and the other set is a processed set, the set to be processed is used to store the second-type nodes that have connected columns but the column identifiers of the connected columns are inconsistent with the column identifier of the current column, and the processed set is used to store the second-type nodes that are only not connected to the current column.

[0109] In an embodiment of the present invention, it is possible to determine which columns each second-category node is connected to based on the arranged first-category nodes (i.e., based on the arranged first-category nodes and the connection relationship, determine the column identifier to which each second-category node is connected), and the second-category nodes connected to each column are separately recorded as connectAll (i.e., the second-category nodes connected to each column are classified as a fully connected node set), and the second-category nodes not connected to each column are separately recorded as connectNone (i.e., the second-category nodes not connected to each column are classified as an independent node set). In addition, two column objects can be generated for each column, a to-be-processed column and a processed column (that is, two sets are generated for each column, where one set is the to-be-processed set and the other set is the processed set). The to-be-processed column stores the second-category nodes that can be stored in the column (that is, the second-category nodes that have connections but are not connected to any first-category nodes in the column) (that is, the to-be-processed set is used to store the second-category nodes that have connected columns but whose column identifiers are inconsistent with the column identifier of the current column), and the processed column stores the second-category nodes confirmed to be placed in the column (that is, the processed set is used to store the second-category nodes that are only not connected to the current column).

[0110] Optionally, the generating device further includes: a third classification module, which is used to, after generating two sets for each column, reclassify the second-type nodes into a fully connected node set if there are second-type nodes that are connected to each column and are not connected to each column after processing of each column is completed.

[0111] In an embodiment of the present invention, if after each column is processed, there are still second-category nodes that have connections and are not connected to every column (that is, after each column is processed, if there are connected columns and second-category nodes that are not connected to every column), then these second-category nodes can be recorded as connectAll (that is, the second-category nodes are reclassified as a fully connected node set).

[0112] Optionally, the generation unit includes: a third generation module, which is used to adopt a second sorting strategy on the initial topological structure, starting from the first row and first column under the arranged first-type nodes, and arrange the second-type nodes in sequence according to the horizontal direction from left to right and the vertical direction from bottom to top, until the arrangement is completed in the last row and last column, to generate a target topological structure, wherein the second sorting strategy is: if the current column is not full of second-type nodes and there are still unarranged second-type nodes in the fully-connected node set, any second-type node in the fully-connected node set is arranged to the current position; if there are no unarranged second-type nodes in the fully-connected node set, but there are still unarranged second-type nodes in the processed set of the current column, any second-type node is selected from the processed set of the current column and arranged to the current position; if there are no unarranged second-type nodes in the processed set of the current column and the fully-connected node set, any second-type node in the independent node set is arranged to the current position.

[0113] In an embodiment of the present invention, the second type of nodes can be arranged on the initial topological structure based on the connection relationship to generate a target topological structure. Specifically, a second sorting strategy can be adopted on the initial topological structure, starting from the first row and first column under the arranged first type of nodes, and the second type of nodes can be arranged in sequence from left to right in the horizontal direction and from bottom to top in the vertical direction until the arrangement is completed in the last row and last column (that is, the second type of nodes can be arranged in sequence according to the first row and first column, the first row and second column, the first row and third column, ..., the last row and last column), to generate a target topological structure.

[0114] In this embodiment, the second sorting strategy is: if the current column is not full of second-class nodes and the fully connected node set still has unsorted second-class nodes, any second-class node in the fully connected node set is arranged to the current position (that is, if the column is not full of second-class nodes and connectAll still has unsorted second-class nodes, then a second-class node of connectAll is arranged to this position); if the fully connected node set has no unsorted second-class nodes, but the processed set of the current column still has unsorted second-class nodes, any second-class node from the processed set of the current column is arranged to the current position (that is, if the column The processed column is full of second-class nodes or the processed column is not full of second-class nodes, but there are no unarranged second-class nodes in connectAll, and there are still unarranged second-class nodes in the processed column of the column, then put a second-class node from the processed column of the column to that position); if there are no unarranged second-class nodes in the processed set and the fully connected node set of the current column, arrange any second-class node in the independent node set to the current position (that is, if there are no unarranged second-class nodes in the processed column and connectAll, then put the second-class node of connectNone to that position). In this way, the second-class nodes without connections can be displayed in the bottom row, the second-class nodes with many connections can be displayed in the middle row, and the remaining second-class nodes can be arranged in a way that the connected nodes are staggered and not placed in the same column. This can center the topology connection and intuitively distinguish nodes without any connection relationship. At the same time, it can also avoid overlapping of connections as much as possible, making it easy to distinguish the starting node and destination node of the connection, effectively ensuring the beauty and clarity of the topology.

[0115] Optionally, the generating device further includes: a fifth determining module for determining the coordinate attributes of each node based on the row identifier and column identifier of the node after generating the target topological structure; and a first display module for displaying the coordinate attributes of each node on the display interface.

[0116] In an embodiment of the present invention, after the first type of nodes and the second type of nodes are laid out and arranged, coordinate attributes can be added to each node according to the row number and column number of the node (that is, the coordinate attributes of each node are determined based on the row identifier and column identifier of the node), and then the coordinate attributes of each node are displayed on the display interface for more intuitive display.

[0117] The above-mentioned generating device may also include a processor and a memory. The above-mentioned receiving unit 110, determining unit 111, arranging unit 112, generating unit 113, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.

[0118] The processor includes a kernel that retrieves corresponding program units from memory. One or more kernels may be provided, and kernel parameters are adjusted to arrange the second-type nodes on the initial topology based on the connection relationship between the first-type nodes and the second-type nodes to generate a target topology.

[0119] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0120] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: receiving a topology structure generation request, determining the number of rows and columns of a target topology structure based on layout requirements, arranging first-type nodes according to a first sorting strategy to generate an initial topology structure, and arranging second-type nodes on the initial topology structure according to the connection relationship between the first-type nodes and the second-type nodes to generate a target topology structure.

[0121] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium includes a stored computer program. When the computer program runs, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned cluster-based topology structure generation method.

[0122] According to another aspect of an embodiment of the present invention, an electronic device is also provided, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned cluster-based topology structure generation method.

[0123] Figure 12 FIG. 1 is a hardware structure block diagram of an electronic device (or mobile device) for a cluster-based topology structure generation method according to an embodiment of the present invention. Figure 12 As shown, the electronic device may include one or more (illustrated as 1202a, 1202b, ..., 1202n in the figure) processors 1202 (the processor 1202 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1204 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 12The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 12 More or fewer components than shown, or with Figure 12 Different configurations shown.

[0124] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0125] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0127] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0128] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0129] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.

[0130] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A cluster-based topology structure generation method, characterized in that: include: Receive a topology structure generation request, wherein the topology structure generation request includes at least: layout requirements, and a connection relationship between a first type of node and a second type of node, wherein the first type of node is a start node and the second type of node is a destination node; Based on the layout requirements, determining the number of rows and columns of the target topology; According to a first sorting strategy, the first type of nodes are arranged to generate an initial topological structure; based on the connection relationship between the first type of nodes and the second type of nodes, the number of connections of the second type of nodes connected to each first type of node is determined; the number of connections of the second type of nodes connected to each first type of node is sorted to obtain a sorting result; based on the sorting result, the first type of nodes are arranged in sequence from the first column of the last row to the last column of the first row using the first sorting strategy, wherein the first sorting strategy is to arrange the first type of nodes indicated by the largest number of connections in the first column of the last row, and arrange the first type of nodes in sequence according to the horizontal direction from left to right, and after the last row is full, according to the vertical direction from bottom to top, starting from the first column of the previous row, and continue to arrange the first type of nodes according to the horizontal direction until the arrangement of the last column of the first row is completed; wherein the second type of nodes connected to each column are classified as a fully connected node set; and the second type of nodes not connected to each column are classified as an independent node set; Arrange the second-type nodes on the initial topological structure based on the connection relationship between the first-type nodes and the second-type nodes to generate the target topological structure; adopt a second sorting strategy, starting from the first row and first column under the arranged first-type nodes, arrange the second-type nodes in sequence from left to right in the horizontal direction and from bottom to top in the vertical direction until the arrangement ends in the last row and last column, wherein the second sorting strategy is: if the current column is not full of second-type nodes and the fully-connected node set still has unarranged second-type nodes, arrange any second-type node in the fully-connected node set to the current position; if the fully-connected node set has no unarranged second-type nodes, but the processed set of the current column still has unarranged second-type nodes, select any second-type node from the processed set of the current column and arrange it to the current position; if there are no unarranged second-type nodes in the processed set of the current column and the fully-connected node set, arrange any second-type node in the independent node set to the current position, wherein the processed set is used to store second-type nodes that are only not connected to the current column.

2. The generation method according to claim 1, characterized in that Before receiving a request for generating a topology structure, the following steps are also included: Based on the correspondence between nodes, all nodes are divided into two categories of nodes, wherein the two categories of nodes are: first category nodes and second category nodes; Characterizing the first type of node as the starting node and the second type of node as the destination node; Determining a connection relationship between the first type of nodes and the second type of nodes based on the corresponding relationship between the nodes; Determining layout requirements based on a display size of the display interface, the number of nodes of the first type, and the number of nodes of the second type; The topology structure generation request is generated based on the connection relationship between the first type of nodes and the second type of nodes and the layout requirements.

3. The generation method according to claim 1, characterized in that After arranging the first type of nodes according to the first sorting strategy to generate an initial topology structure, the method further includes: Determining a column identifier for each second-type node connection based on the arranged first-type nodes and the connection relationship between the first-type nodes and the second-type nodes; Two sets are generated for each column, wherein one set is a to-be-processed set and the other set is a processed set. The to-be-processed set is used to store the second type of nodes that have connected columns but whose column identifiers are inconsistent with the column identifier of the current column.

4. The generation method according to claim 3, characterized in that After generating two sets for each column, also include: After processing each column, if there are second-type nodes that are connected to the columns but are not connected to every column, the second-type nodes are reclassified as the fully-connected node set.

5. The generation method according to claim 4, characterized in that After generating the target topology structure, the method further includes: Determine the coordinate attributes of each node based on the row identifier and column identifier of the node; The coordinate attributes of each node are displayed on a display interface.

6. A cluster-based topology structure generation device, characterized in that: include: A receiving unit, configured to receive a topology structure generation request, wherein the topology structure generation request includes at least: a layout requirement, a connection relationship between a first type of node and a second type of node, wherein the first type of node is a start node and the second type of node is a destination node; A determining unit, configured to determine the number of rows and columns of a target topological structure based on the layout requirement; an arrangement unit, configured to arrange the first-category nodes according to a first sorting strategy to generate an initial topological structure; determine the number of connections of the second-category nodes connected to each first-category node based on the connection relationship between the first-category nodes and the second-category nodes; sort the number of connections of the second-category nodes connected to each first-category node to obtain a sorting result; based on the sorting result, adopt the first sorting strategy to arrange the first-category nodes in sequence from the first column of the last row to the last column of the first row, wherein the first sorting strategy is to arrange the first-category node indicated by the maximum number of connections in the first column of the last row, arrange the first-category nodes in sequence according to the horizontal direction from left to right, and after the last row is full, continue to arrange the first-category nodes in the horizontal direction starting from the first column of the previous row according to the vertical direction from bottom to top until the arrangement is completed in the last column of the first row; wherein the second-category nodes connected to each column are classified as a fully connected node set; and the second-category nodes not connected to each column are classified as an independent node set; A generating unit is configured to arrange the second-type nodes on the initial topological structure based on the connection relationship between the first-type nodes and the second-type nodes to generate the target topological structure; and adopt a second sorting strategy to arrange the second-type nodes in sequence from left to right in the horizontal direction and from bottom to top in the vertical direction starting from the first row and first column below the arranged first-type nodes, until the arrangement is completed in the last row and last column, wherein the second sorting strategy is as follows: if the current column is not full of second-type nodes and the fully-connected node set still contains unarranged second-type nodes, any second-type node in the fully-connected node set is arranged to the current position; if the fully-connected node set does not contain unarranged second-type nodes, but the processed set of the current column still contains unarranged second-type nodes, any second-type node from the processed set of the current column is arranged to the current position; if there is no unarranged second-type node in the processed set of the current column and the fully-connected node set, any second-type node in the independent node set is arranged to the current position, wherein the processed set is used to store second-type nodes that are only not connected to the current column.

7. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the cluster-based topology structure generation method according to any one of claims 1 to 5.

8. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the cluster-based topology structure generation method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Project group management topological graph generation method, device, equipment and storage medium

    CN111192342A

  • Layout method, device, equipment, medium and product of main and standby cluster topological graph

    CN115001981A