Digital twin network topological graph construction method based on A star algorithm and related device

By using the A-star algorithm to calculate the shortest connection path in the digital twin network topology diagram, the problems of readability and low construction efficiency of the topology diagram in the existing technology are solved, and automated construction and aesthetic improvement are achieved.

CN118590399APending Publication Date: 2024-09-03ASIAINFO TECH CHINA INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410983010.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

When the existing digital twin network topology diagram construction method is designing the topological connection relationship between network elements, the automatic implementation method does not consider the spatial distribution, resulting in poor readability, while the manual editing method is inefficient and cannot effectively improve the readability of the topology diagram. performance and build efficiency.

Method used

A method based on the A-star algorithm is used to obtain the virtual network element distribution map of the target physical network, perform raster processing and determine the target area of ​​each virtual network element, use the A-star algorithm to calculate the shortest connection path, and draw connections based on the path. lines to ensure that the connection does not pass through other virtual network elements, improving the readability and construction efficiency of the topology diagram.

Benefits of technology

The automatic construction of the digital twin network topology map is realized, the readability and construction efficiency of the topology map are improved, the aesthetics and efficiency of the connections are ensured, and the problems of poor readability and low efficiency in the existing methods are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118590399A
    Figure CN118590399A
Patent Text Reader

Abstract

The invention discloses a digital twin network topological graph construction method based on an A star algorithm and a related device, and relates to the technical field of computers, and the method comprises the steps: obtaining a virtual network element distribution diagram of a digital twin network of a target physical network, carrying out the rasterization of the virtual network element distribution diagram, and determining a target region corresponding to each virtual network element, the position of each target area is the same as that of the corresponding virtual network element and is larger than that of the area where the corresponding virtual network element is located, for any two virtual network elements needing to be connected, each target area serves as an obstacle area, the shortest connection path between the two virtual network elements is calculated in the rasterized virtual network element distribution diagram through an A star algorithm, and the shortest connection path between the two virtual network elements is obtained. And drawing a connection line between the two virtual network elements in the rasterized virtual network element distribution diagram according to the shortest connection path to obtain a digital twin network topological diagram. Based on the method and the device, the readability and the construction efficiency of the digital twin network topological graph are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method for constructing a digital twin network topology map based on an A-star algorithm and related devices. Background Art

[0002] Digital Twin Network (DTN) is an emerging technology concept that involves creating digital images of physical network entities that can simulate, analyze, and optimize the state and behavior of physical networks in a virtual environment. The application of digital twin networks can improve the operating efficiency of physical networks, reduce risks, and promote the rapid deployment and testing of new services.

[0003] The core of the digital twin network is the construction of the network topology map, which involves accurately mapping the physical and virtual twins of the physical network to achieve real-time monitoring, optimization and prediction of the network. The digital twin network topology map can provide a new perspective and tools for network operation and maintenance, and realize intelligent management and autonomous optimization of the network.

[0004] One of the key steps in constructing a digital twin network topology diagram is the design of the topological connection relationship between network elements. The current digital twin network topology diagram construction method has two implementation methods when designing the topological connection relationship between network elements. One is an automatic implementation method, which only focuses on the correctness of the topological connection relationship between network elements, but does not consider the spatial distribution of network elements, resulting in the topological connections between network elements passing through other network elements and poor readability. The other implementation method is to provide a network topology editor, and the user manually edits the wiring through a visual interface. This method is not only labor-intensive but also inefficient.

[0005] Therefore, how to improve the readability and construction efficiency of digital twin network topology diagrams has become a technical problem that needs to be solved urgently. Summary of the invention

[0006] In view of the above problems, this application provides a method and related device for constructing a digital twin network topology map based on the A-star algorithm to improve the readability and construction efficiency of the digital twin network topology map. The specific scheme is as follows:

[0007] The first aspect of the present application provides a method for constructing a digital twin network topology graph based on the A-star algorithm, the method comprising:

[0008] Obtain a virtual network element distribution map of the digital twin network of the target physical network;

[0009] Preprocessing the virtual network element distribution map to obtain a rasterized virtual network element distribution map and a target area corresponding to each virtual network element; the position of each target area is the same as the position of the corresponding virtual network element, and each target area is larger than the area covered by the corresponding virtual network element;

[0010] For any two virtual network elements that need to be connected, each target area is used as an obstacle area, and the A-star algorithm is used to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map;

[0011] A connection line between the two virtual network elements is drawn in the gridded virtual network element distribution map according to the shortest connection path.

[0012] In a possible implementation, the using the A-star algorithm to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map includes:

[0013] The A-star algorithm using Manhattan distance as a heuristic function is used to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map.

[0014] In a possible implementation, the side length of a single grid in the gridded virtual network element distribution map is N screen pixels; and N is an integer greater than 1.

[0015] In a possible implementation, the number of grids in the gridded virtual network element distribution map is within a target range, and the target range is: 10,000-100,000.

[0016] In a possible implementation, a plurality of anchor points are evenly arranged at the edge of each virtual network element; and the shortest connection path between the two virtual network elements is calculated in the gridded virtual network element distribution map using an A-star algorithm, including:

[0017] Determine a first anchor point in a first virtual network element of the two virtual network elements, and determine a second anchor point in a second virtual network element of the two virtual network elements; the first anchor point is the anchor point with the least number of connections in the first virtual network element, and the second anchor point is the anchor point with the least number of connections in the second virtual network element;

[0018] The A-star algorithm is used to calculate the shortest connection path between the first anchor point and the second anchor point in the gridded virtual network element distribution map.

[0019] In a possible implementation, the straight-line distance between the first anchor point and the second anchor point is less than or equal to the target distance, and the target distance is: the minimum straight-line distance between all target anchor point pairs, one of the anchor points in the target anchor point pair is the anchor point with the least number of connections in the first virtual network element, and the other anchor point in the target anchor point pair is the anchor point with the least number of connections in the second virtual network element.

[0020] In a possible implementation, drawing a connection line between the two virtual network elements in the gridded virtual network element distribution map according to the shortest connection path includes:

[0021] A graphics drawing interface is called to draw a line of a preset style between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path as a connection line between the two virtual network elements.

[0022] The second aspect of the present application provides a device for constructing a digital twin network topology map based on the A-star algorithm, the device comprising:

[0023] An acquisition module, used to obtain a virtual network element distribution map of a digital twin network of a target physical network;

[0024] A preprocessing module, used for preprocessing the virtual network element distribution map to obtain a rasterized virtual network element distribution map and a target area corresponding to each virtual network element; the position of each target area is the same as the position of the corresponding virtual network element, and each target area is larger than the area covered by the corresponding virtual network element;

[0025] A search module is used for calculating the shortest connection path between any two virtual network elements that need to be connected, taking each target area as an obstacle area, and using an A-star algorithm in the gridded virtual network element distribution map;

[0026] A drawing module is used to draw a connection line between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path.

[0027] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the method for constructing a digital twin network topology map based on the A-star algorithm according to the above-mentioned first aspect or any implementation method of the first aspect.

[0028] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0029] The memory is used to store computer programs;

[0030] The processor is used to execute the computer program so that the electronic device can implement the method for constructing a digital twin network topology map based on the A-star algorithm according to the above-mentioned first aspect or any implementation method of the first aspect.

[0031] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the method for constructing a digital twin network topology graph based on the A-star algorithm according to the above-mentioned first aspect or any implementation of the first aspect.

[0032] By means of the above technical scheme, the digital twin network topology map construction method and related devices based on the A star algorithm provided by the present application obtain the virtual network element distribution map of the digital twin network of the target physical network, rasterize the virtual network element distribution map, and determine the target area corresponding to each virtual network element, wherein each target area is the same as the position of the corresponding virtual network element and is larger than the area where the corresponding virtual network element is located. For any two virtual network elements that need to be connected, each target area is used as an obstacle area, and the shortest connection path between the two virtual network elements calculated by the A star algorithm in the rasterized virtual network element distribution map is obtained. According to the shortest connection path, the connection between the above two virtual network elements is drawn in the rasterized virtual network element distribution map to obtain the digital twin network topology map. Based on the present application, the automatic construction of the digital twin network topology map is realized, and in the constructed digital twin network topology map, the connection between any two virtual network elements with a connection relationship will not pass through other virtual network elements, and the readability is improved, thereby achieving the purpose of improving the readability and construction efficiency of the digital twin network topology map. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0034] Figure 1 A flowchart of an implementation of the method for constructing a digital twin network topology map based on the A-star algorithm provided in this application;

[0035] Figure 2 An example diagram of a virtual network element distribution diagram provided in this application;

[0036] Figure 3a-3b Two example diagrams when the target area provided for this application is a square and a circle;

[0037] Figure 4a An example diagram when the shape of the virtual network element provided for this application is a square;

[0038] Figure 4b-4c Two other example images provided for this application when the target area is a square and a circle;

[0039] Figure 5 A gridded virtual network element distribution map provided in this application and an example map of the target area corresponding to each virtual network element;

[0040] Figure 6 This is an example of two anchor points with the least number of connections and the shortest straight-line distance in network element 1 and network element 9 provided in this application;

[0041] Figure 7a An example diagram of the connection lines corresponding to the shortest connection path calculated by the A-star algorithm using Manhattan distance as a heuristic function provided in this application;

[0042] Figure 7b An example diagram of the connection lines corresponding to the shortest connection path calculated by the A-star algorithm using the Euclidean distance as the heuristic function provided in this application;

[0043] Figure 8 An example diagram of a digital twin network topology diagram provided by this application and constructed based on this application;

[0044] Fig. 9 An example diagram of a digital twin network topology diagram provided in this application and constructed based on the prior art;

[0045] Fig.10 A schematic diagram of the structure of a digital twin network topology diagram construction device based on the A-star algorithm provided in this application;

[0046] Fig.11 A schematic diagram of the structure of the electronic device provided in this application. DETAILED DESCRIPTION

[0047] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0048] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0049] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0050] A flowchart of an implementation method of constructing a digital twin network topology map based on the A-star algorithm provided in this application is as follows: Figure 1 As shown, it may include:

[0051] Step S101: Obtain a virtual network element distribution map of the digital twin network of the target physical network.

[0052] The target physical network is a physical network in the real physical world. The physical network elements that constitute the physical network are distributed according to a certain structure. The distribution structure of the physical network elements that constitute a physical network may include but is not limited to any of the following distribution structures: matrix, star, ring, tree, and hybrid.

[0053] The digital twin network of the target physical network is composed of multiple virtual network elements. The number and distribution structure of the virtual network elements are the same as the number and distribution structure of the physical network elements in the target physical network. Each virtual network element corresponds one-to-one to a physical network element, and the connection relationship between the virtual network elements needs to be the same as the connection relationship between each entity in the target physical network.

[0054] The distribution structure of each virtual network element in the virtual network element distribution diagram is the same as the distribution structure of each physical network element in the target physical network.

[0055] As an example, an interactive interface can be output, and the user can customize the type of distribution structure and the number of virtual network elements in the interactive interface. After the user determines the number of virtual network elements and the distribution structure of the virtual network elements based on the number of network elements and the network element distribution structure of the target physical network, the digital twin network topology map construction device based on the A-star algorithm provided in the present application automatically constructs a virtual network element distribution map according to the distribution structure and the number of virtual network elements determined by the user. The number of virtual network elements in the virtual network element distribution map is the same as the number of physical network elements in the target physical network. In the virtual network element distribution map, the distribution structure of the virtual network elements is the same as the distribution structure of the physical network elements in the target physical network. Optionally, after obtaining a specified number of virtual network elements, the specified number of virtual network elements can be laid out according to a specified distribution structure, and then the minimum enclosing rectangle of each virtual network element is determined (for ease of description and distinction, recorded as the first minimum enclosing rectangle), and then the minimum enclosing rectangle of all virtual network elements as a whole is determined (for ease of description and distinction, recorded as the second minimum enclosing rectangle), for each side of the second minimum enclosing rectangle (for ease of description and distinction, recorded as the first side), the side of the first minimum enclosing rectangle that is parallel to the first side and closest to the first side is determined (for ease of description and distinction, recorded as the second side), and the distance between the first side and the second side is taken as the preset distance as the target, and the second minimum enclosing rectangle is enlarged and adjusted to obtain a target enclosing rectangle, and the area covered by the target enclosing rectangle is determined as the virtual network element distribution map; each first minimum enclosing rectangle is within the target enclosing rectangle.

[0056] As an example, each virtual network element may be represented by a circle, or may be represented by a regular polygon, for example, each virtual network element may be represented by any of the following regular polygons: an equilateral triangle, a square, and a regular M-gon. M is a positive integer greater than 4. Different virtual network elements may be represented by graphics of different shapes, or different virtual network elements may be represented by graphics of the same shape.

[0057] like Figure 2 As shown, it is an example diagram of a virtual network element distribution diagram provided in an embodiment of the present application. In this example diagram, there are 9 virtual network elements in the virtual network element distribution diagram, and each virtual network element is represented by a circle. The distribution structure of the virtual network elements is a matrix type. Among them, Figure 2The size of the virtual network element distribution map shown can be determined according to the minimum bounding rectangle of each virtual network element. As an example, after obtaining 9 virtual network elements, the 9 virtual network elements can be laid out in a specified matrix type, and then after determining the first minimum bounding rectangle of each virtual network element, the second minimum bounding rectangle of all virtual network elements as a whole is determined, and for each first side of the second minimum bounding rectangle, the second side of the first minimum bounding rectangle that is parallel to the first side and closest to the first side is determined, and the distance between the first side and the second side is taken as the preset distance as the target, and the second minimum bounding rectangle is enlarged and adjusted to obtain the target bounding rectangle, and the area covered by the target bounding rectangle is determined as the virtual network element distribution map.

[0058] Step S102: preprocess the virtual network element distribution map to obtain a rasterized virtual network element distribution map and a target area corresponding to each virtual network element, wherein the position of each target area is the same as the position of the corresponding virtual network element, and each target area is larger than the area where the corresponding virtual network element is located.

[0059] The preprocessing of the virtual network element distribution map includes but is not limited to: gridding the virtual network element distribution map to obtain a rasterized virtual network element distribution map. When the virtual network element distribution map is gridded, the virtual network element distribution map can be gridded according to screen pixels, that is, in the rasterized virtual network element distribution map, each grid is a screen pixel. Of course, the virtual network element distribution map can also be gridded according to other division methods.

[0060] For each virtual network element, its corresponding target area can be determined in the following manner: taking the virtual network element as the center, expanding the area covered by the virtual network element toward the surrounding areas.

[0061] In an embodiment of the present application, the virtual network element distribution map may be first gridded and then the target area corresponding to each virtual network element may be determined, or the target area corresponding to each virtual network element may be determined first and then the virtual network element distribution map may be gridded.

[0062] Optionally, the shape of the target area and the shape of the virtual network element may be the same or different.

[0063] like Figure 2 As shown in FIG. 1 , the shape of the virtual network element is a circle, and the shape of the target area can be a square or a circle. Figure 3a-3b As shown, there are two example diagrams when the target area provided in the embodiment of the present application is a square and a circle. Figure 3a or Figure 3b In the figure, the shaded area and the virtual network element area together constitute the target area.

[0064] like Figure 4aAs shown in FIG. 1 , the shape of the virtual network element provided in the embodiment of the present application is a square, and the shape of the target area can be a square or a circle. Figure 4b-4c As shown, there are two other example diagrams when the target area provided in the embodiment of the present application is a square and a circle. Figure 4b or Figure 4c In the figure, the shaded area and the virtual network element area together constitute the target area.

[0065] Optionally, the distance from the edge of the target area to the edge of the virtual network element is within the target range.

[0066] Optionally, when both the target area and the virtual network element are circular, the radius of the target area is longer than the radius of the virtual network element by a first preset ratio. As an example, the first preset ratio is between 10% and 30%, including 10%, 20%, and 30%.

[0067] Optionally, when both the target area and the virtual network element are square, the side length of the target area is longer than the side length of the virtual network element by a second preset ratio. As an example, the second preset ratio is between 20% and 40%, including 20%, 30%, and 40%.

[0068] Optionally, the intersection of different target areas is empty, that is, different target areas do not have the same coverage.

[0069] Step S103: For any two virtual network elements that need to be connected, each target area is used as an obstacle area, and the A-star algorithm is used to calculate the shortest connection path between the two virtual network elements in the rasterized virtual network element distribution map.

[0070] Which two virtual network elements need to be connected is determined based on the connection relationship between the physical network elements in the target physical network. That is, for any two virtual network elements, respectively recorded as the first virtual network element and the second virtual network element, if there is a connection relationship between the physical network elements corresponding to the first virtual network element and the second virtual network element, then the first virtual network element and the second virtual network element need to be connected.

[0071] As an example, it can be determined whether there is a connection relationship between two physical network elements corresponding to two virtual network elements according to a pre-configured network element topology connection relationship description file.

[0072] A star algorithm refers to The search algorithm belongs to the heuristic search algorithm. Suppose there is an obstacle between the starting point A and the end point B. In the pathfinding of star A, it is necessary to bypass the obstacle to reach point B, so it is necessary to find point C as the transition point. Therefore, two keywords are introduced, the actual consumption G and the estimated consumption H. If the transition is to point C, the actual consumption G is the actual distance traveled from the starting point A to point C, and the estimated consumption H is the shortest estimated distance from point C to the end point B (the influence of obstacles should be ignored when estimating the distance). The estimated value from point A to point B corresponding to point C is F=G+H, and the pathfinding is performed according to the F value of each point. The specific pathfinding process can adopt the existing scheme, and this application does not make specific limitations.

[0073] In the above A-star algorithm path finding process, one point corresponds to one grid, and the distance between any two points can be Euclidean distance or other distances, such as Manhattan distance. The distance between any two points is the heuristic function of the A-star algorithm.

[0074] In order to improve the aesthetics of the final connection layout and further improve the aesthetics of the digital twin network topology diagram, Manhattan distance can be preferentially used as the heuristic function of the A-star algorithm.

[0075] By using the target area as the obstacle area in the path finding process, the problem of the generated shortest connection path covering the virtual network element or being close to the edge of the virtual network element can be effectively avoided.

[0076] Step S104: drawing a connection line between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path.

[0077] After all the connections between the virtual network elements that need to be connected are drawn, the digital twin network topology diagram is obtained.

[0078] Optionally, a graphics drawing interface may be called to draw a line of a preset style between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path as a connection line between the two virtual network elements.

[0079] The shortest connection path can be represented by an ordered array Route[N], which is an ordered array consisting of the screen coordinates of each grid point constituting the shortest connection path. The screen coordinates of each grid point can be the screen coordinates of the center of the grid point (ie, a grid).

[0080] As an example, a graphic drawing interface based on H5 Canvas (including beginPath, moveTo, lineTo, etc.) can be used to complete the straight line connection between virtual network elements. Specifically, it may include:

[0081] Get Canvas context: In JavaScript, you need to first get the Canvas element (i.e., the canvas, or the virtual network element distribution map). The code example is as follows:

[0082] var canvas = document.getElementById('myCanvas'); / / Read the virtual network element distribution map myCanvas

[0083] Then get the 2D rendering context of the Canvas element. The code example is as follows:

[0084] var ctx = canvas.getContext('2d'); / / Draw the virtual network element distribution map in two dimensions

[0085] Optionally, you can set the line style: for example, you can set the line color, width and other attributes. You can set the interactive interface, and set the interactive control. If the user operates the interactive control, the color setting box and the width setting box can pop up. After the user enters or selects the color in the color setting box and enters or selects the width in the width setting box, the color and width attributes of the line can be set by the following code:

[0086] ctx.strokeStyle = '#FF0000'; / / Set the line color to red

[0087] ctx.lineWidth = 5; / / Set the line width to 5 pixels

[0088] If the user does not set the line style, the line style uses the default settings, such as black color and 3 pixels width.

[0089] Start drawing a line: call the moveTo() method to set the starting point, and then use the lineTo() method to draw the line. Here, the Route[N] array is traversed in turn, and the screen coordinate information [sceenWidth, sceenheight] of Route[i] is passed as parameters to the lineTo(x,y) function to draw a straight line. The code example is as follows:

[0090] ctx.beginPath(); / / Start a new path

[0091] ctx.moveTo(Route[0][0], Route[0][1]); / / Move the brush to Route[0], where Route[0][0] represents the horizontal coordinate of the point Route[0], and Route[0][1] represents the vertical coordinate of the point Route[0].

[0092] ctx.lineTo(Route[i][0], Route[i][1]); / / Loop through the Route[N] array

[0093] End drawing: After calling the stroke() method, the line drawing is completed. The code example is as follows:

[0094] ctx.stroke(); / / Line drawing completed

[0095] The digital twin network topology map construction method based on the A-star algorithm provided in the present application realizes the automatic construction of the digital twin network topology map. In the constructed digital twin network topology map, the connection between any two virtual network elements with a connection relationship will not pass through other virtual network elements, and the readability is improved, thereby achieving the purpose of improving the readability and construction efficiency of the digital twin network topology map.

[0096] In an optional embodiment, when the virtual network element distribution map is rasterized, the side length of a single grid is N screen pixels; N is an integer greater than 1.

[0097] That is, the side length of a single grid is at least 2 screen pixels.

[0098] Optionally, the side length of a single grid is 5 screen pixels. Of course, it can also be other values, for example, the side length of a single grid is 4 screen pixels, or the side length of a single grid is 6 screen pixels.

[0099] In another optional embodiment, when the virtual network element distribution map is rasterized, the virtual network element distribution map is divided with the number of grids in the rasterized virtual network element distribution map being within a target range, that is, the number of grids in the rasterized virtual network element distribution map is within a target range. Optionally, the target range is 10,000 to 100,000. That is, the number of grids in the rasterized virtual network element distribution map may be 10,000, or 100,000, or any integer value between 10,000 and 100,000.

[0100] Optionally, the number of grids can be determined according to the size of the virtual network element distribution map, wherein the number of grids in the rasterized virtual network element distribution map is positively correlated with the size of the virtual network element distribution map, that is, the larger the virtual network element distribution map is, the larger the number of grids in the rasterized virtual network element distribution map is. Optionally, in this embodiment, the side length of a single grid can also be N screen pixels, and the value of N can be determined based on the size of the virtual network element distribution map, the target range, and the positive correlation between the number of grids in the rasterized virtual network element distribution map and the size of the virtual network element distribution map.

[0101] Optionally, the number of grids may be independent of the size of the virtual network element distribution map, that is, no matter how large the virtual network element distribution map is, the number of grids in the gridded virtual network element distribution map is a fixed value within the target range. Optionally, in this embodiment, the side length of a single grid may also be N screen pixels, and the value of N may be determined based on the size of the virtual network element distribution map and the preset number of grids.

[0102] By using custom grid precision instead of screen pixel precision during rasterization, that is, setting the side length of a single grid to be greater than 1 screen pixel, the pathfinding performance can be greatly improved while ensuring that the final generated topology is smooth enough.

[0103] In an optional embodiment, multiple anchor points are evenly arranged at the edge of each virtual network element. For example, anchor points can be arranged in eight directions (upper, lower, left, right, upper left, upper right, lower left, and lower right) of the virtual network element.

[0104] One implementation method of using the A-star algorithm to calculate the shortest connection path between two virtual network elements in the gridded virtual network element distribution map may be:

[0105] A first anchor point is determined in the first virtual network element of the two virtual network elements, and a second anchor point is determined in the second virtual network element of the two virtual network elements; the first anchor point is an anchor point with the least number of connections in the first virtual network element, and the second anchor point is an anchor point with the least number of connections in the second virtual network element.

[0106] That is to say, for each network element, the anchor point with the least number of connections is preferentially selected as the new connection anchor point.

[0107] The A-star algorithm is used to calculate the shortest connection path between the first anchor point and the second anchor point in the above-mentioned rasterized virtual network element distribution map.

[0108] By evenly setting multiple anchor points on the virtual network elements and selecting the anchor points with the least number of connections to connect the network elements, the readability and aesthetics of the digital twin network topology diagram can be further improved.

[0109] Furthermore, the straight-line distance between the first anchor point and the second anchor point is less than or equal to the target distance, and the target distance is: the minimum value of the straight-line distances between all target anchor point pairs, wherein one of the anchor points in the target anchor point pair is the anchor point with the least number of connections in the first virtual network element, and the other anchor point in the target anchor point pair is the anchor point with the least number of connections in the second virtual network element.

[0110] That is to say, the anchor points with the least number of connections can be found in the first virtual network element, and the anchor points with the least number of connections can be found in the second virtual network element. For each anchor point with the least number of connections in the first virtual network element, the straight-line distance between the anchor point and the anchor points with the least number of connections in the second virtual network element is calculated. Among the multiple straight-line distances calculated, the two anchor points corresponding to the shortest straight-line distances are selected as the first anchor point and the second anchor point.

[0111] Assuming that P anchor points with the least number of connections are found in the first virtual network element, and Q anchor points with the least number of connections are found in the second virtual network element, a total of P×Q straight-line distances are calculated. Among the two anchor points corresponding to the shortest straight-line distance among these P×Q straight-line distances, the anchor point belonging to the first virtual network element is determined as the first anchor point, and the anchor point belonging to the second virtual network element is determined as the second anchor point.

[0112] Below Figure 2 Taking as an example, an implementation method of the present application is described.

[0113] First of all, Figure 2 The virtual network element distribution map shown in the figure is preprocessed to obtain a rasterized virtual network element distribution map and an example map of the target area corresponding to each virtual network element. Figure 5 As shown, it is an example diagram of a rasterized virtual network element distribution map and a target area corresponding to each virtual network element provided in an embodiment of the present application. Figure 5 In the example shown, the gray area around each virtual network element and the corresponding virtual network element area together constitute the target area.

[0114] Assuming that network element 1 and network element 9 need to be connected, then select at least one anchor point with the least number of connections from the 8 anchor points of network element 1 (recorded as the first group of anchor points), select at least one anchor point with the least number of connections from the 8 anchor points of network element 9 (recorded as the second group of anchor points), select one anchor point from the first group of anchor points selected from network element 1 (recorded as anchor point 1), and select one anchor point from the second group of anchor points selected from network element 9 (recorded as anchor point 2). Anchor point 1 and anchor point 2 are a pair of anchor points with the shortest straight-line distance in the first group of anchor points and the second group of anchor points. Figure 6 As shown, an example of two anchor points with the least number of connections and the shortest straight-line distance in network element 1 and network element 9 provided in an embodiment of the present application.

[0115] Taking the 9 target areas as obstacle areas, the A-star algorithm is used to calculate the shortest connection path between virtual network element 1 and virtual network element 9 in the rasterized virtual network element distribution map, and the connection line between the two virtual network elements is drawn in the rasterized virtual network element distribution map according to the calculated shortest connection path. Figure 7aAs shown, it is an example diagram of the connection corresponding to the shortest connection path calculated by the A-star algorithm using the Manhattan distance as the heuristic function provided in the embodiment of the present application, Figure 7b An example diagram of the connection lines corresponding to the shortest connection path calculated by the A-star algorithm using the Euclidean distance as the heuristic function provided in the embodiment of the present application. Obviously, the connection lines corresponding to the shortest connection path calculated by the A-star algorithm using the Manhattan distance as the heuristic function are more beautiful and readable.

[0116] like Figure 8 As shown, this is an example diagram of a digital twin network topology diagram provided by this application and constructed based on this application. Fig. 9 An example diagram of a digital twin network topology diagram constructed based on the prior art provided in the embodiment of the present application. By comparison, it is found that the digital twin network topology diagram constructed based on the present application is more readable and aesthetically pleasing.

[0117] Corresponding to the method embodiment, the present application also provides a digital twin network topology map construction device based on the A star algorithm. A structural schematic diagram of the digital twin network topology map construction device based on the A star algorithm provided in the embodiment of the present application is as follows: Fig.10 As shown, it may include:

[0118] Acquisition module 1001, pre-processing module 1002, search module 1003 and drawing module 1004;

[0119] Among them, the acquisition module 1001 is used to obtain a virtual network element distribution map of the digital twin network of the target physical network;

[0120] The preprocessing module 1002 is used to preprocess the virtual network element distribution map to obtain a rasterized virtual network element distribution map and a target area corresponding to each virtual network element; the position of each target area is the same as the position of the corresponding virtual network element, and each target area is larger than the area covered by the corresponding virtual network element;

[0121] The search module 1003 is used for calculating the shortest connection path between any two virtual network elements that need to be connected, taking each target area as an obstacle area, and using the A-star algorithm in the gridded virtual network element distribution map;

[0122] The drawing module 1004 is used to draw a connection line between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path.

[0123] The digital twin network topology map construction device based on the A-star algorithm provided in the embodiment of the present application realizes the automatic construction of the digital twin network topology map. In the constructed digital twin network topology map, the connection between any two virtual network elements with a connection relationship will not pass through other virtual network elements, and the readability is improved, thereby achieving the purpose of improving the readability and construction efficiency of the digital twin network topology map.

[0124] In an optional embodiment, when the search module 1003 uses the A-star algorithm to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map, it is used to:

[0125] The A-star algorithm using Manhattan distance as a heuristic function is used to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map.

[0126] In an optional embodiment, the side length of a single grid in the gridded virtual network element distribution map is N screen pixels; and N is an integer greater than 1.

[0127] In an optional embodiment, the number of grids in the gridded virtual network element distribution map is within a target range, and the target range is: 10,000-100,000.

[0128] In an optional embodiment, a plurality of anchor points are evenly arranged at the edge of each virtual network element; when the search module 1003 uses the A-star algorithm to calculate the shortest connection path between the two virtual network elements in the rasterized virtual network element distribution map, it is used to:

[0129] Determine a first anchor point in a first virtual network element of the two virtual network elements, and determine a second anchor point in a second virtual network element of the two virtual network elements; the first anchor point is the anchor point with the least number of connections in the first virtual network element, and the second anchor point is the anchor point with the least number of connections in the second virtual network element;

[0130] The A-star algorithm is used to calculate the shortest connection path between the first anchor point and the second anchor point in the gridded virtual network element distribution map.

[0131] In an optional embodiment, the straight-line distance between the first anchor point and the second anchor point is less than or equal to a target distance, and the target distance is: the minimum straight-line distance between all target anchor point pairs, one of the anchor points in the target anchor point pair is the anchor point with the least number of connections in the first virtual network element, and the other anchor point in the target anchor point pair is the anchor point with the least number of connections in the second virtual network element.

[0132] In an optional embodiment, when the drawing module 1004 draws the connection line between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path, it is used to:

[0133] A graphics drawing interface is called to draw a line of a preset style between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path as a connection line between the two virtual network elements.

[0134] The present application also provides an electronic device in an embodiment. Fig.11 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application can be a terminal device such as a mobile phone, a tablet computer, a personal computer, or a server device, which can be a single server or a server cluster. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0135] like Fig.11 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage device 1108 to a random access memory (RAM) 1103. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1103. The processing device 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0136] Typically, the following devices may be connected to the I / O interface 1105: an input device 1106 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1108 including, for example, a memory card, a hard disk, etc.; and a communication device 1109. The communication device 1109 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0137] Also provided in an embodiment of the present application is a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the methods for constructing a digital twin network topology map based on the A-star algorithm provided in the embodiments of the present application.

[0138] A computer-readable storage medium is also provided in an embodiment of the present application, which carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any one of the digital twin network topology map construction methods based on the A-star algorithm provided in the embodiment of the present application.

[0139] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0140] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0141] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. Professionals and technicians may use different methods to implement the described functions for each specific solution, but such implementation should not be considered beyond the scope of this application.

[0142] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

[0143] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0144] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for constructing a digital twin network topology graph based on the A-star algorithm, characterized in that: The method comprises: Obtain a virtual network element distribution map of the digital twin network of the target physical network; Preprocessing the virtual network element distribution map to obtain a rasterized virtual network element distribution map and a target area corresponding to each virtual network element; the position of each target area is the same as the position of the corresponding virtual network element, and each target area is larger than the area covered by the corresponding virtual network element; For any two virtual network elements that need to be connected, each target area is used as an obstacle area, and the A-star algorithm is used to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map; A connection line between the two virtual network elements is drawn in the gridded virtual network element distribution map according to the shortest connection path.

2. The method according to claim 1, characterized in that The using of the A-star algorithm to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution graph includes: The A-star algorithm using Manhattan distance as a heuristic function is used to calculate the shortest connection path between the two virtual network elements in the gridded virtual network element distribution map.

3. The method according to claim 1, characterized in that The side length of a single grid in the gridded virtual network element distribution map is N screen pixels; N is an integer greater than 1.

4. The method according to claim 1 or 3, characterized in that: The number of grids in the gridded virtual network element distribution map is within a target range, which is 10,000 to 100,000.

5. The method according to claim 1, characterized in that A plurality of anchor points are evenly arranged at the edge of each virtual network element; and the shortest connection path between the two virtual network elements is calculated in the gridded virtual network element distribution map using the A-star algorithm, including: Determine a first anchor point in a first virtual network element of the two virtual network elements, and determine a second anchor point in a second virtual network element of the two virtual network elements; the first anchor point is the anchor point with the least number of connections in the first virtual network element, and the second anchor point is the anchor point with the least number of connections in the second virtual network element; The A-star algorithm is used to calculate the shortest connection path between the first anchor point and the second anchor point in the gridded virtual network element distribution map.

6. The method according to claim 5, characterized in that The straight-line distance between the first anchor point and the second anchor point is less than or equal to the target distance, and the target distance is: the minimum straight-line distance between all target anchor point pairs, one of the anchor points in the target anchor point pair is the anchor point with the least number of connections in the first virtual network element, and the other anchor point in the target anchor point pair is the anchor point with the least number of connections in the second virtual network element.

7. The method according to claim 1, characterized in that Drawing a connection line between the two virtual network elements in the gridded virtual network element distribution map according to the shortest connection path includes: A graphics drawing interface is called to draw a line of a preset style between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path as a connection line between the two virtual network elements.

8. A digital twin network topology map construction device based on the A-star algorithm, characterized in that: The device comprises: An acquisition module, used to obtain a virtual network element distribution map of a digital twin network of a target physical network; A preprocessing module, used for preprocessing the virtual network element distribution map to obtain a rasterized virtual network element distribution map and a target area corresponding to each virtual network element; the position of each target area is the same as the position of the corresponding virtual network element, and each target area is larger than the area covered by the corresponding virtual network element; A search module is used for calculating the shortest connection path between any two virtual network elements that need to be connected, taking each target area as an obstacle area, and using an A-star algorithm in the gridded virtual network element distribution map; A drawing module is used to draw a connection line between the two virtual network elements in the rasterized virtual network element distribution map according to the shortest connection path.

9. A computer program product, characterized in that It includes computer-readable instructions, which, when executed on an electronic device, enable the electronic device to implement the method for constructing a digital twin network topology map based on the A-star algorithm as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: The electronic device comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the method for constructing a digital twin network topology map based on the A-star algorithm as described in any one of claims 1 to 7.

11. A computer storage medium, characterized in that: The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the method for constructing a digital twin network topology map based on the A-star algorithm as described in any one of claims 1 to 7.