G6-based cross-level multi-superior node link obstacle avoidance topology
By using the G6 engine to implement cross-level multi-upper-node link obstacle avoidance topology, the problem of single node topology structure in existing technologies is solved, an intuitive and accurate node link obstacle avoidance graph is generated, and the layout readability and distance uniformity are optimized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- COWAVE SATELLITE COMM TECH CO LTD
- Filing Date
- 2023-08-16
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, the relationship topology between nodes usually does not span multiple levels, and each node belongs to only one parent node. The topology is simple and lacks flexibility and intuitiveness.
A cross-level multi-upper-node link obstacle avoidance topology based on G6 is adopted. By creating containers, setting graphical object properties, calling the obstacle avoidance algorithm module, and rendering graphics, the automatic generation and obstacle avoidance connection of multiple upper-level nodes are realized.
A more intuitive and accurate node link obstacle avoidance topology map was generated, which optimized the layout readability, evened out the distance between nodes, and reduced the algorithm complexity.
Smart Images

Figure CN117056627B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of web front-end applications and discloses a cross-level multi-upper-node link obstacle avoidance topology based on G6. Background Technology
[0002] Data visualization is the process of presenting data to people intuitively through certain technical means. Relational data is also known as graph data. Visualizing relational data is called graph visualization. On the basis of graph visualization, adding interaction, layout, algorithms, analysis schemes, etc., to complete an analysis task, is called graph visual analysis.
[0003] Currently, most node relationship topologies on the market do not cross levels. Each node has only one parent node, and the entire topology extends downwards layer by layer from the top-level node. Summary of the Invention
[0004] Purpose of the invention: To provide a cross-level multi-upper-node link obstacle avoidance topology based on G6 to solve the above-mentioned problems existing in the prior art.
[0005] Technical solution: A cross-level multi-upper-node link obstacle avoidance topology based on G6, specifically as follows:
[0006] S1. Create at least one container to store the topology graph;
[0007] S2. Create a graphical object representing the satellite station and its relationships in the container, set the properties of the object, and call the obstacle avoidance algorithm module to avoid obstacles on the edge shape of the object;
[0008] S3. Set the edge shape, add a default edge shape to the object representing the satellite station and its relationship, and generate the graphic;
[0009] S4. Render the graphic and add interactive features.
[0010] According to one aspect of this application, step S1 specifically comprises:
[0011] S11. Use a web page language to create at least one rectangular area as a container, and define the name, width, and height of the rectangular area;
[0012] S12. Use network language to refer to the container by the name of the rectangular area.
[0013] According to one aspect of this application, the step S2 of creating a graphical object representing satellite stations and their relationships within the container specifically involves:
[0014] S21. Use import to import the G6 library into the code of the rectangular area;
[0015] S22. Create a satellite station object and define the node data and edge data of the satellite station;
[0016] S23. Calculate the interlayer spacing and node spacing based on node data and the width and height of the rectangular region;
[0017] S24. Using the constructor of G6, receive the layer spacing and node spacing values, and create a new object representing the graph of the satellite station and its relationships.
[0018] According to one aspect of this application, the invocation of the obstacle avoidance algorithm module in step S2 specifically involves:
[0019] S2a. Define nodes as elements of a set and assign them attributes or characteristics;
[0020] S2b: Define obstacles as areas that lines should not cross, and assign them attributes or characteristics;
[0021] S2c converts the elements of the set and the areas that the lines should not cross into a two-dimensional mesh, maps the position of each node to the corresponding two-dimensional mesh cell, and assigns a unique identifier to each node;
[0022] S2d: Use the A-star algorithm to find the shortest path between two nodes that avoids obstacles in the two-dimensional grid.
[0023] S2e: Convert the coordinates of each shortest path in the grid to coordinates in the graph, and optimize the lines of the shortest paths using pivot points.
[0024] According to one aspect of this application, step S3 specifically comprises:
[0025] S31. Define a custom edge shape for the graphic using functions provided by the G6 library. The functions receive parameters, including the name of the edge shape, a drawing function, and an update function.
[0026] S32. In the drawing function, obtain the coordinates of the starting and ending points of the edge, set the spacing of the edge, calculate the inflection point based on the coordinates and spacing, and use the drawing function to draw the polyline;
[0027] S33. In the update function, receive nodes or edges whose positions have changed, and update the drawn polyline.
[0028] S34. Use attributes to add default edge shapes to the object representing the graph of satellite stations and their relationships, and generate the graph based on the updated polylines.
[0029] According to one aspect of this application, step S4 specifically comprises:
[0030] S41. Call the function provided by the graphics object to render the graphics into the container;
[0031] S42. Call the functions provided by the graphics object to adjust the size and position of the graphics in the container;
[0032] S43. Call the functions provided by the graphics object to add event listener functionality for mouse events of the graphics nodes and edges;
[0033] S44. Use the functions provided by the graphics object to adjust the state of the nodes and edges of the graphics according to the event.
[0034] According to one aspect of this application, obstacle avoidance is also performed on the edge shape of the object using deep reinforcement learning and imitation learning, specifically through the following steps:
[0035] Sa, collect demonstration data and preprocess the demonstration data; wherein the demonstration data includes the path and direction of the edge shape;
[0036] Sb. Use imitation learning to analyze the preprocessed demonstration data to obtain a learning policy or reward function, and evaluate the performance of the learning policy or reward function in a test environment.
[0037] Sc. Using deep reinforcement learning, the learning strategy or reward function is interacted with the environment to improve the learning strategy or reward function.
[0038] According to one aspect of this application, step Sa specifically comprises:
[0039] Sa1, Data collection;
[0040] Sa2. Use mobile networks, cloud computing, and edge computing to transmit and store the data;
[0041] Sa3. Use data cleaning, transformation, integration, and reduction techniques to preprocess stored data to make it suitable for analysis;
[0042] Sa4. Use small data techniques to analyze the preprocessed data.
[0043] According to one aspect of this application, rendering the graphic in step S4 specifically involves:
[0044] S4a. Construct a diagram representing the satellite stations and their relationships;
[0045] S4b: Enhance the visualization of the chart using a graph neural network to provide additional information;
[0046] S4c. Visualize the connection relationships of nodes in the diagram by connecting lines, and display the attributes and characteristics of the nodes and their connection relationships.
[0047] According to one aspect of this application, step S4b specifically comprises:
[0048] S4b1. Using a node embedding method, learn and capture the low-dimensional vector representation of the nodes of the graph;
[0049] S4b2. Using a graph embedding method, learn the low-dimensional vector representation to capture global information of the graph;
[0050] S4b3. Using a node classification method, assign labels or categories to nodes based on the features and embeddings of nodes in the global information;
[0051] S4b4. Using a link prediction method, based on the features and embeddings of nodes in the global information, infer missing or potential edges between nodes;
[0052] S4b5. Using graph generation methods, modify the graph based on the labels or categories assigned to nodes and the missing or potential edges between nodes.
[0053] Beneficial effects: This invention automatically generates optimal node positions and obstacle avoidance connection lines based on the hierarchy and hierarchical relationships between nodes, making the node link obstacle avoidance topology diagram more intuitive and accurate, optimizing the readability of the layout, making the distance between nodes more uniform, making the cross-level relationship layout more reasonable, and reducing the complexity of the algorithm. Attached Figure Description
[0054] Figure 1 This is a diagram showing the connection relationships between multiple parent nodes.
[0055] Figure 2 This is a diagram showing the connection relationships between nodes across different levels.
[0056] Figure 3 This is a topology diagram for obstacle avoidance across multiple levels and multiple superior nodes. Detailed Implementation
[0057] Data visualization is the process of presenting data to people intuitively through certain technical means. Relational data is also known as graph data. Visualizing relational data is called graph visualization. On the basis of graph visualization, adding interaction, layout, algorithms, analysis schemes, etc., to complete an analysis task, is called graph visual analysis.
[0058] Currently, most node relationship topologies on the market do not cross levels. Each node has only one parent node, and the entire topology extends downwards layer by layer from the top-level node.
[0059] AntVG6 is a simple, easy-to-use, and comprehensive graph visualization engine. Based on high customization capabilities, it provides a series of elegantly designed and user-friendly graph visualization solutions. It helps developers build their own graph, graph analysis, or graph editor applications. This invention proposes a cross-level, multi-upper-node link obstacle avoidance topology based on G6, with the following specific steps:
[0060] S1. Create at least one container to store the topology graph;
[0061] Create a space on a webpage that displays a diagram of the satellite stations and their relationships, specifically:
[0062] S11. Use a web page language to create at least one rectangular area as a container, and define the name, width, and height of the rectangular area;
[0063] S12. Use network language to refer to the container by the name of the rectangular area.
[0064] In a further embodiment, a div element with a specified id, width, and height is created using Hypertext Markup Language (HTML) and Cascading Style Sheets (CSS), and JavaScript is used to retrieve a reference to the div element by its id.
[0065] S2. Create a graphical object representing the satellite station and its relationships in the container, set the properties of the object, and call the obstacle avoidance algorithm module to avoid obstacles on the edge shape of the object;
[0066] Create a G6.Graph object, call the obstacle avoidance algorithm module, with type dagre and direction TB from top to bottom.
[0067] Further, creating a graphical object representing the satellite stations and their relationships within the container involves:
[0068] S21. Use import to import the G6 library into the code of the rectangular area;
[0069] S22. Create a satellite station object and define the node data and edge data of the satellite station;
[0070] S23. Calculate the interlayer spacing and node spacing based on node data and the width and height of the rectangular region;
[0071] S24. Using the constructor of G6, receive the layer spacing and node spacing values, and create a new object representing the graph of the satellite station and its relationships.
[0072] In a further embodiment, the G6 library is imported using `importG6from'@antv / g6'`, defining the node and edge data of the satellite stations and their relationships, including their coordinates, orientation, status, rank, and order. Nodes are satellite stations, and edges are their communication links. The rankep and node-sep distances are calculated based on the node data and the width and height of the container. A new Graph object is created using the G6 constructor, which accepts parameters or inputs, including a pointer or handle to a rectangular region on the webpage, the size of the rectangular region, the type and orientation of the graph layout algorithm, the rankep and node-sep distance values, and information or attributes of the nodes and edges.
[0073] Further calls to the obstacle avoidance algorithm module are as follows:
[0074] S2a. Define nodes as elements of a set and assign them attributes or characteristics;
[0075] S2b: Define obstacles as areas that lines should not cross, and assign them attributes or characteristics;
[0076] S2c converts the elements of the set and the areas that the lines should not cross into a two-dimensional mesh, maps the position of each node to the corresponding two-dimensional mesh cell, and assigns a unique identifier to each node;
[0077] S2d: Use the A-star algorithm to find the shortest path between two nodes that avoids obstacles in the two-dimensional grid.
[0078] S2e: Convert the coordinates of each shortest path in the grid to coordinates in the graph, and optimize the lines of the shortest paths using pivot points.
[0079] In a further embodiment, obstacle avoidance algorithms are used to connect lines between nodes, visualizing set information present in categorical data. The A-Star algorithm is used to avoid obstacles between data items, and then pivot points are introduced to make the lines more artistic and fluid. First, categorical or set data is collected and preprocessed using various sources and methods, such as surveys, databases, and web scraping. Data cleaning, transformation, integration, and reduction techniques are used to preprocess the data and make it suitable for visualization. Obstacle avoidance algorithms are applied to connect lines between data items, defining data items as elements or members of a set and assigning them attributes or characteristics, such as name, value, category, and subcategory. Obstacles are defined as areas or regions that lines should not cross, and attributes or characteristics are assigned to them, such as shape, size, position, and color. The A-Star algorithm is used to find the shortest path between two data items that avoids obstacles. Pivot points are used to make the lines more artistic and fluid; a pivot point is a point where the line changes direction or curvature. Pivot points are calculated using rules or methods. Data items are visualized by connecting lines, displaying category information, subcategory information, or other information.
[0080] Visualize data items by connecting lines, displaying category information, subcategory information, or other information. Use different shapes, colors, sizes, labels, etc. to represent data items and their attributes or characteristics on a 2D plane; use different styles, widths, lengths, labels, etc. to represent lines on a 2D plane and their attributes or characteristics; use different layouts, interactions, animations, etc. to enhance the readability and aesthetics of the visualization, providing users with more insights and functions.
[0081] The A-star algorithm uses a heuristic function to estimate the cost of reaching the goal from a given node and expands the node with the lowest cost until the goal is reached or no more nodes can be expanded.
[0082] In a further embodiment, obstacle avoidance and topology restoration using a multi-agent system are specifically defined as follows: the multi-agent system is defined as agents that can communicate according to a directed graph; the obstacle avoidance problem is defined as finding a control law for each agent that can avoid obstacles while maintaining the formation shape; the topology restoration problem is defined as finding a control law for each agent that can restore the communication link when it is interrupted due to obstacle avoidance; it is assumed that each agent has dual integrator dynamics and can measure its own position and its relative position with its neighbors and obstacles; an obstacle avoidance algorithm based on a flexible function of relative position is designed, defining a flexible function that can adjust the position between the agent and the obstacle according to parameters (e.g., obstacle size, obstacle safety distance); the flexible function is used to calculate how each agent maintains the formation shape.
[0083] A topology restoration algorithm is designed based on graph connectivity properties and the initial adjacency matrix. Graph connectivity properties are defined as an attribute of a directed graph, determining whether it is a strong or weak connection. Conditions for topology restoration, such as minimum and maximum link counts and link priorities, are obtained using these properties and the initial adjacency matrix. Depending on the situation, topology restoration mechanisms are used to rebuild communication links, such as adding links to increase connectivity, deleting links to avoid redundancy, and selecting links based on priority. Finally, the performance and robustness of the proposed algorithm are analyzed, proving the theoretical results and ensuring the convergence, stability, and optimality of the proposed algorithm under certain assumptions and constraints. Simulations and experiments are conducted to demonstrate the effectiveness, efficiency, and scalability of the proposed algorithm in different scenarios and environments. This method allows the system's communication topology to be restored even if link failures occur between nodes during obstacle avoidance, based on the conditions they have obtained.
[0084] In a further embodiment, obstacle avoidance control of a multi-agent system modeled with dual-integral dynamics under a directed interconnect topology is provided. The control task is accomplished through a master-slave formation scheme combined with an artificial potential field (APF) method. Specifically, the multi-agent system is defined as agents that can communicate according to a directed graph and move in a 2D plane with dual-integral dynamics. The formation control problem is defined as finding a control law for each agent that can achieve the desired formation shape and orientation while avoiding obstacles and maintaining connectivity. It is assumed that each agent can measure its own position, the relative positions of its neighbors, and the relative positions of obstacles. A formation control algorithm based on the master-slave scheme and the artificial potential field method is designed. A scheme is defined to assign a leader agent and multiple follower agents to each formation, and a virtual structure is used to describe the desired formation shape and orientation. An artificial potential field method is defined to generate attractive and repulsive forces for each agent based on the relative positions of the leader, followers, and obstacles. Feedback linearization is used to transform the dual-integral dynamics into single-integral dynamics, and a proportional-integral controller is used to drive the actual position to the desired position.
[0085] Finally, the performance and robustness of the proposed algorithm are analyzed, the theoretical results are proved, and the convergence, stability and optimality of the proposed algorithm under certain assumptions and constraints are guaranteed. Simulations and experiments are conducted to demonstrate the effectiveness, efficiency and scalability of the proposed algorithm in different scenarios and environments.
[0086] In a further embodiment, deep reinforcement learning and imitation learning are used to solve the obstacle avoidance problem, specifically:
[0087] Sa, collect demonstration data and preprocess the demonstration data; wherein the demonstration data includes the path and direction of the edge shape;
[0088] Sa1. Collect data, such as the status, actions, and rewards of experts or teachers, specifically including data such as the coordinates, direction, status, and communication links of satellite stations;
[0089] Sa2. Securely and efficiently transmit and store the data using mobile networks, cloud computing, and edge computing;
[0090] Sa3. Use data cleaning, transformation, integration, and reduction techniques to preprocess stored data to make it suitable for analysis;
[0091] Sa4. Use small data techniques to analyze the preprocessed data.
[0092] Further use of adaptive machine learning methods can be employed to learn from data with less or more variation, such as few-shot learning, meta-learning, transfer learning, and active learning; interpretable systems can be used to explain the logic and reasoning behind their decisions, such as interpretable artificial intelligence, causal reasoning, and counterfactual analysis; and online learning methods that can update models in real time and adapt to changing circumstances, such as incremental learning, streaming learning, and concept drift detection.
[0093] Sb. Use imitation learning to analyze the preprocessed demonstration data to obtain a learning policy or reward function, and evaluate the performance of the learning policy or reward function in a test environment.
[0094] Furthermore, when using behavior cloning, a deep neural network is used to learn a policy that maps states to actions, and the network is trained by minimizing the mean squared error or cross-entropy loss between predicted actions and expert actions; when using inverse reinforcement learning, a deep neural network is used to learn a reward function that maps states and actions to rewards, and the network is trained by maximizing the probability of expert actions given states and rewards; the performance of the learned policy or reward function is evaluated on a validation set or test environment, and the network parameters are fine-tuned as needed.
[0095] Sc. Using deep reinforcement learning, the learning strategy or reward function is interacted with the environment to improve the learning strategy or reward function.
[0096] Furthermore, obstacle avoidance solutions using deep reinforcement learning employ deep neural networks to approximate the optimal policy or value function of a Markov decision process (MDP), and update the network parameters through interaction with the environment and trial-and-error learning.
[0097] Imitation learning can reduce data and computational requirements by leveraging prior knowledge and guidance from experts, improve stability and robustness by avoiding exploration and exploiting trade-offs and reducing the variance of policy gradients, and enhance generalization and portability by learning from diverse, high-quality demonstrations covering different situations and environments.
[0098] S3. Set the edge shape, add a default edge shape to the object representing the satellite station and its relationship, and generate the graphic;
[0099] S31. Define a custom edge shape for the graphic using functions provided by the G6 library. The functions receive parameters, including the name of the edge shape, a drawing function, and an update function.
[0100] S32. In the drawing function, obtain the coordinates of the starting and ending points of the edge, set the spacing of the edge, calculate the inflection point based on the coordinates and spacing, and use the drawing function to draw the polyline;
[0101] S33. In the update function, receive nodes or edges whose positions have changed, and update the drawn polyline.
[0102] S34. Use attributes to add default edge shapes to the object representing the graph of satellite stations and their relationships, and generate the graph based on the updated polylines.
[0103] In a further embodiment, an edge shape is set by adding a default edge shape, `defaultEdge`, to the Graph object. A custom edge shape is defined using `G6.registerEdge` with a name, a draw function, and an update function. In the `draw` function, the start and end points of the edge are obtained, the inflection points are calculated based on the coordinates and spacing, and a polyline is drawn using `group.addShape` with these points. In the update function, the position of the polyline is updated based on the new points. The default edge shape `defaultEdge` is added to the Graph object using `defaultEdge:{type:'custom-edge-name'}`.
[0104] Furthermore, for satellite station nodes in adjacent layers, two inflection points are calculated based on the layer spacing and node spacing to connect the adjacent layer nodes; for satellite station nodes belonging to multiple superior nodes, two inflection points are calculated for each superior node based on the coordinates of the start and end points, and then connected by a polyline; for satellite station nodes in non-adjacent layers with the same x-coordinate, no inflection points are needed, and only a straight line is drawn from the start to the end point; for satellite station nodes in non-adjacent layers with different x-coordinates, two inflection points are calculated for each intermediate layer node to bypass them, and then connected by a polyline.
[0105] S4. Render the graphic and add interactive features.
[0106] S41. Call the function provided by the graphics object to render the graphics into the container;
[0107] S42. Call the functions provided by the graphics object to adjust the size and position of the graphics in the container;
[0108] S43. Call the functions provided by the graphics object to add event listener functionality for mouse events of the graphics nodes and edges;
[0109] S44. Use the functions provided by the graphics object to adjust the state of the nodes and edges of the graphics according to the event.
[0110] In a further embodiment, “graph.render()” is called to render the graph on the container; “graph.fitView()” is called to fit the graph to the container size; “graph.on” is called to add event listeners for mouse events such as click, drag, and hover on nodes and edges; and “graph.setItemState” is used to change the state of nodes and edges based on events.
[0111] Further rendering of the graphics specifically involves:
[0112] S4a. Construct a diagram representing the satellite stations and their relationships;
[0113] A directed acyclic graph (DAG) is constructed using the preprocessed data, where nodes are satellite stations and edges are their communication links. The output is a DAG object containing the nodes and edges of the graph. Node and edge features are used to represent the attributes and relationships of the satellite stations, such as their coordinates, orientation, state, level, and order; the output is a feature matrix containing the feature vectors of the graph's nodes and edges. Graph features are used to represent the attributes of the entire graph, such as its size, density, diameter, and centrality; the output is an feature vector containing the graph's feature values.
[0114] S4b: Enhance the visualization of the chart using a graph neural network to provide additional information;
[0115] S4b1. Using a node embedding method, learn and capture the low-dimensional vector representation of the nodes of the graph;
[0116] S4b2. Using a graph embedding method, learn the low-dimensional vector representation to capture global information of the graph;
[0117] S4b3. Using a node classification method, assign labels or categories to nodes based on the features and embeddings of nodes in the global information;
[0118] S4b4. Using a link prediction method, based on the features and embeddings of nodes in the global information, infer missing or potential edges between nodes;
[0119] S4b5. Using graph generation methods, modify the graph based on the labels or categories assigned to nodes and the missing or potential edges between nodes.
[0120] In further embodiments, node embedding methods are used to learn low-dimensional vector representations of nodes that capture their structural and semantic information, such as GraphSAGE, GCN, GAT, etc.; graph embedding methods are used to learn low-dimensional vector representations of the entire graph to capture its global information, such as Graph2Vec, NetMF, GraphWave, etc.; node classification methods are used to assign labels or categories to nodes based on their features and embeddings, such as Graph Convolutional Networks (GCN), Graph Attention Networks (GAT), etc.; link prediction methods are used to infer missing or potential edges between nodes based on their features and embeddings, such as SEAL, R-GCN, VGAE, etc.; and graph generation methods are used to create new graphs or modify existing graphs based on certain criteria or objectives, such as GraphRNN, GraphVAE, GraphGAN, etc.
[0121] Furthermore, node embeddings and graph features are used instead of graph embedding methods to learn a low-dimensional vector representation of the entire graph, reducing computational complexity and memory consumption.
[0122] S4c. Visualize the connection relationships of nodes in the diagram by connecting lines, and display the attributes and characteristics of the nodes and their connection relationships.
[0123] Using different shapes, colors, sizes, labels, etc., to represent data items and their attributes or characteristics on a 2D plane, the output is a visualization object containing graphical elements of graphical nodes; using different styles, widths, lengths, labels, etc., to represent lines and their attributes or characteristics on a 2D plane, the output is a visualization object containing graphical elements of graphical edges; using different layouts, interactions, animations, etc., to enhance the readability and aesthetics of visualizations, providing users with more insights and functionality, the output is a display object of graphical visualizations displayed on a screen or device.
[0124] This application uses antVG6 as the graph visualization engine and employs the Dagre procedural layout algorithm. This algorithm arranges nodes in a directed acyclic graph (DAG) according to their level and order, enabling cross-layer and cross-superior-level connections. It also calculates edge inflection points based on node coordinates and spacing, and redraws edges to achieve obstacle avoidance. The final visualization clearly and intuitively displays the complex relationships between satellite stations, helping users analyze and understand data. It redraws connections between multiple superior nodes, enabling link connections between multiple subordinate superiors of a single node. Figure 1 As shown; the connections between nodes across levels are redrawn to establish link connections between top and bottom nodes and to bypass all nodes to achieve obstacle avoidance in link connections, as shown. Figure 2 As shown.
[0125] In a further embodiment, a custom layout algorithm is used to meet the need for visualizing complex relationships between satellite stations. Specifically, this includes: hierarchical layout, which groups nodes by level and parent level and places them in a hierarchical structure, highlighting the hierarchy and dependencies of nodes and avoiding long edges and edge intersections. This layout algorithm is implemented using the built-in hierarchical layout method G6.Layout.hierarchical of antVG6; radial layout, which places nodes around a central or focal node and arranges them in concentric circles or sectors, highlighting the centrality and proximity of nodes and avoiding node overlap and edge intersections. This layout algorithm is implemented using the built-in radial layout method G6.Layout.radial of antVG6; and force-directed layout, which minimizes edge intersections and overlapping nodes by simulating physical forces between nodes and edges, generating natural and aesthetically pleasing charts that reflect the data structure and characteristics. This layout algorithm is implemented using the built-in forced-directed layout method G6.Layout.force of antVG6.
[0126] In a further embodiment, for satellite station nodes at adjacent levels, two inflection points are calculated based on the level spacing and node spacing to establish link connections between adjacent level nodes; for satellite station nodes belonging to multiple superior levels, two inflection points are calculated based on the coordinates x and y of the starting and ending points to establish link connections between multiple superior nodes; for satellite station nodes at non-adjacent levels with the same x, it is not necessary to calculate the two inflection points in the link, only the starting and ending points are needed; for satellite station nodes at non-adjacent levels with different x, it is necessary to bypass intermediate level nodes to achieve link connection obstacle avoidance, and calculate the two intermediate inflection points to establish link connections between adjacent level nodes. Specifically:
[0127] First, create a container to store the topology graph.
[0128] Create a G6.Graph object of type dagre with direction TB from top to bottom. Calculate the layer spacing ranksep and node spacing nodesep based on the node data and the width and height of the container. Appropriate layer spacing and node spacing can automatically generate the optimal node position, making the nodes of the entire relational topology very intuitive.
[0129] The node positions are fixed. Set the edge shape and add a default edge shape, defaultEdge, to the Graph object.
[0130] Customize the edge shape as follows: First, obtain the start and end points needed to draw the edge (according to ②, the node position has been calculated based on the layer spacing and node spacing, and x and y are fixed). Based on the start point (startPoint) and end point (endPoint), calculate the differences in x and y coordinates, hgapX and hgapY. For edges that bypass the entire node to avoid obstacles, calculate the offset distance of the end point from the center of the canvas for subsequent inflection point calculations. The topology is arranged vertically. Calculate the offset distance offsetX based on the difference between endPoint.x and startPoint.x, the canvas width, and the layer difference between the start and end points (the larger the difference, the longer the distance bypassing the entire node). The offset distance is endPoint.x - startPoint. If x=0, then offset is 0. If endPoint.x-startPoint.x>0, offset=endPoint.x-startPoint.x. When the value is less than 0, it means the end point is on the right and needs to be calculated based on the width of the container. offset=((width–startPoint.x)*sourceNode.level) / 3(sin(6 / Π)). Calculate the path of the edge. According to ②, we know that the node position has been calculated based on the layer spacing and node spacing. x and y are fixed. The first term ['M',startPoint.x,startPoint.y] and the last term ['L',endPoint.x,endPoint.y] of the path are available. We only need to calculate the positions of the two inflection points in different cases.
[0131] For start and end points of multiple adjacent upper levels, the x-coordinate of the first inflection point is the same as the x-coordinate of the start point, the x-coordinate of the second inflection point is the same as the x-coordinate of the end point, and the y-coordinate of the first and second inflection points is the same. The y-coordinates of the two inflection points can be calculated using hgapY in I: y = (startPoint.y + hgap / sourceNode.level), and the path can be derived accordingly. For start and end points spanning multiple levels, if startPoint.x and endPoint.x are the same, there is no need to calculate the two intermediate inflection points. The path is a direct connection between the starting point and the ending point. If they are different, it is necessary to calculate the two intermediate turning points of the bypass route. The x-coordinate of the first turning point can be calculated based on hgapY in I and the x-coordinate of the starting point. The y-coordinate is the y-coordinate of the starting point. The x-coordinate of the second turning point is calculated based on the x-coordinate of the ending point, the offsetX obtained in II, and the layer difference between the starting point and the ending point. The y-coordinate is the same as the y-coordinate of the ending point. x = (startPoine.x – hgapX * 3 (sin(6 / Π) + odffsetX)). The path can be obtained accordingly.
[0132] like Figure 3 As shown, this illustrates the link connection topology of satellite station nodes across multiple levels and with multiple superiors. A level 4 node has three adjacent superior nodes, and links are established by calculating corresponding inflection points using different starting points. Level 3 nodes 1 and 3, and the level 4 node, each have superiors across different levels. They avoid obstacles by calculating corresponding inflection points around nodes at adjacent levels to achieve corresponding link connections, making the link connection relationships between satellite station nodes clearer.
[0133] This invention provides a web front-end application and is a visualization solution for the relationships between nodes based on G6. It includes the link connection relationships between nodes across levels and multiple upper levels, as well as the online status of each node. It automatically generates the optimal node position and obstacle avoidance connection lines based on the hierarchy and superior-subordinate relationships, making the node link obstacle avoidance topology map more intuitive and accurate. The novel layout algorithm based on Dagre flowchart optimizes the readability of the layout, makes the distance between nodes uniform, and makes the layout of relationships between cross levels reasonable, while reducing the complexity of the algorithm.
[0134] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all fall within the protection scope of the present invention.
Claims
1. A cross-level multi-upper-node link obstacle avoidance topology based on G6, characterized in that: S1. Create at least one container to store the topology graph; S2. Create a graphical object representing the satellite station and its relationships in the container, set the properties of the object, and call the obstacle avoidance algorithm module to avoid obstacles on the edge shape of the object; S3. Set the edge shape, add a default edge shape to the object representing the satellite station and its relationship, and generate the graphic; S4. Render the graphic and add interactive features; The specific steps in step S2 involving calling the obstacle avoidance algorithm module are as follows: S2a. Define nodes as elements of a set and assign them attributes or characteristics; S2b: Define obstacles as areas that lines should not cross, and assign them attributes or characteristics; S2c converts the elements of the set and the areas that the lines should not cross into a two-dimensional mesh, maps the position of each node to the corresponding two-dimensional mesh cell, and assigns a unique identifier to each node; S2d: Use the A-star algorithm to find the shortest path between two nodes that avoids obstacles in the two-dimensional grid. S2e: Convert the coordinates of each shortest path in the grid to coordinates in the graph, and optimize the lines of the shortest paths using pivot points; Step S3 is as follows: S31. Define a custom edge shape for the graphic using functions provided by the G6 library. The functions receive parameters, including the name of the edge shape, a drawing function, and an update function. S32. In the drawing function, obtain the coordinates of the starting and ending points of the edge, set the spacing of the edge, calculate the inflection point based on the coordinates and spacing, and use the drawing function to draw the polyline; S33. In the update function, receive nodes or edges whose positions have changed, and update the drawn polyline. S34. Use attributes to add default edge shapes to the object representing the graph of satellite stations and their relationships, and generate a graph based on the updated polylines. In S32, the inflection point is calculated, including: For the starting and ending points of multiple adjacent upper levels, the x-coordinate of the first inflection point is the same as the x-coordinate of the starting point, the x-coordinate of the second inflection point is the same as the x-coordinate of the ending point, and the y-coordinate of the first and second inflection points is the same. The y-coordinates of the two inflection points can be calculated based on hgapY. For start and end points across levels, if startPoint.x and endPoint.x are the same, there is no need to calculate the two intermediate inflection points, and the path is the direct connection between the start point and the end point; If they are different, the two inflection points in the middle of the bypass route need to be calculated. The x-coordinate of the first inflection point can be calculated using hgapY and the x-coordinate of the starting point; the y-coordinate is the y-coordinate of the starting point. The x-coordinate of the second point is calculated based on the x-coordinate of the end point, the offsetX value, and the hierarchical difference between the start and end points.
2. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 1, characterized in that, Step S1 is as follows: S11. Use a web page language to create at least one rectangular area as a container, and define the name, width, and height of the rectangular area; S12. Use network language to refer to the container by the name of the rectangular area.
3. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 2, characterized in that, In step S2, creating a graphical object representing satellite stations and their relationships within the container specifically involves: S21. Use import to import the G6 library into the code of the rectangular area; S22. Create a satellite station object and define the node data and edge data of the satellite station; S23. Calculate the interlayer spacing and node spacing based on node data and the width and height of the rectangular region; S24. Using the constructor of G6, receive the layer spacing and node spacing values, and create a new object representing the graph of the satellite station and its relationships.
4. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 1, characterized in that, Step S4 is as follows: S41. Call the function provided by the graphics object to render the graphics into the container; S42. Call the functions provided by the graphics object to adjust the size and position of the graphics in the container; S43. Call the functions provided by the graphics object to add event listener functionality for mouse events of the graphics nodes and edges; S44. Use the functions provided by the graphics object to adjust the state of the nodes and edges of the graphics according to the event.
5. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 1, characterized in that, It also includes using deep reinforcement learning and imitation learning to avoid obstacles by analyzing the edge shapes of objects. The specific steps are as follows: Sa, collect demonstration data and preprocess the demonstration data; The demonstration data includes the path and direction of the edge shape; Sb. Use imitation learning to analyze the preprocessed demonstration data to obtain a learning policy or reward function, and evaluate the performance of the learning policy or reward function in a test environment. Sc. Using deep reinforcement learning, the learning strategy or reward function is interacted with the environment to improve the learning strategy or reward function.
6. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 5, characterized in that, Step Sa specifically includes: Sa1, Data collection; Sa2. Use mobile networks, cloud computing, and edge computing to transmit and store the data; Sa3. Use data cleaning, transformation, integration, and reduction techniques to preprocess stored data to make it suitable for analysis; Sa4. Use small data techniques to analyze the preprocessed data.
7. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 1, characterized in that, The rendering of the graphic in step S4 specifically involves: S4a. Construct a diagram representing the satellite stations and their relationships; S4b: Enhance the visualization of the chart using a graph neural network to provide additional information; S4c. Visualize the connection relationships of nodes in the diagram by connecting lines, and display the attributes and characteristics of the nodes and their connection relationships.
8. The G6-based cross-level multi-upper-node link obstacle avoidance topology according to claim 7, characterized in that, Step S4b is as follows: S4b1. Using a node embedding method, learn and capture the low-dimensional vector representation of the nodes of the graph; S4b2. Using a graph embedding method, learn the low-dimensional vector representation to capture global information of the graph; S4b3. Using a node classification method, assign labels or categories to nodes based on the features and embeddings of nodes in the global information; S4b4. Using a link prediction method, based on the features and embeddings of nodes in the global information, infer missing or potential edges between nodes; S4b5. Using graph generation methods, modify the graph based on the labels or categories assigned to nodes and the missing or potential edges between nodes.