A network situation visualization method based on improved force-directed algorithm

By improving the force-directed algorithm and adjusting the number of node cores and the force calculation, the problems of unstable random node layout and lack of consideration of importance in the traditional force-directed algorithm are solved, and more efficient network situation visualization is achieved.

CN117640412BActive Publication Date: 2026-06-19CHINESE PEOPLES LIBERATION ARMY UNIT 61660

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINESE PEOPLES LIBERATION ARMY UNIT 61660
Filing Date
2023-12-24
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Traditional force-directed algorithms result in unstable layout effects due to random node placement at the initial moment, and fail to effectively consider the impact of node importance on repulsion forces, leading to a decline in layout quality.

Method used

By performing k-core decomposition on network nodes, they are divided into different levels according to the number of cores. The number of cores is then introduced into the force-directed algorithm as an importance metric. The initial position of the nodes and the force calculation formula are adjusted to improve the stability and efficiency of the layout.

Benefits of technology

By improving the force-directed algorithm, the node layout is more reasonable, the number of iterations is reduced, the layout efficiency is improved, visual interference is reduced, and a better visualization effect of the network resource topology is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117640412B_ABST
    Figure CN117640412B_ABST
Patent Text Reader

Abstract

This invention relates to a network situation visualization method based on an improved force-directed algorithm, belonging to the field of network topology. The invention first designs an improved network initial layout strategy based on the number of node cores. After assigning initial positions to network nodes, it designs a formula for calculating the force on nodes during the layout process, calculates node displacement based on the force, and iterates until equilibrium is reached. This invention addresses the problem of unstable layout results caused by random node placement at the initial moment in traditional force-directed algorithms by designing an improved network initial layout strategy based on the number of node cores. Furthermore, considering that different nodes should have different levels of importance in the network during node layout, it proposes incorporating the number of node cores into the node's force calculation, making the layout more reasonable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of network topology, and specifically relates to a network situation visualization method based on an improved force-directed algorithm. Background Technology

[0002] Projecting network topology onto a large visualization screen allows for understanding the operation and distribution of various network resources, providing a comprehensive understanding of network operation and security, and ensuring the safe and stable operation of the network. The quality of network topology visualization often depends on the effectiveness of the graph layout algorithm. The most common graph layout method is the node-link graph, where nodes represent network entities and lines represent the relationships between entities. A crucial aspect involves how to arrange these nodes on the screen. Among numerous network layout algorithms, the force-directed algorithm is currently the most widely used. Because the force-directed algorithm provides vivid and intuitive layout results, is easy to understand, highly interactive, and easily extended and improved, it has remained in use to this day.

[0003] The force-directed algorithm treats the entire network as a physical system, with network nodes acting as charged particles. It simulates the forces acting between these charged particles to influence the movement of network node positions. Specifically, all nodes in the network experience Coulomb repulsion, forcing them to maintain a certain distance from each other, while interconnected nodes are attracted to each other. Under the influence of these attractive and repulsive forces, the positions of network nodes continuously change until they stabilize relative to their previous positions, at which point the physical system is considered to have reached a stable state. The overall process of the force-directed algorithm is as follows: Figure 1 As shown.

[0004] Traditional force-directed algorithms often randomly assign positions to nodes when generating the initial network layout. This introduces significant uncertainty into the layout, potentially leading to more iterations to reach the convergence point or getting stuck in local minima due to the initial position being too far from it, resulting in a poor layout. Assigning nodes a good initial position can effectively reduce convergence time and improve layout efficiency. In a real network, more important nodes should be located in the center of the layout, with importance decreasing towards the edges. Therefore, this invention introduces the concept of core number to divide the initial node positions. By calculating the core number, the degree to which a node is centered in the network topology is quantified. Nodes are allocated their initial layout range according to their core number, preventing excessive deviation of initial positions from the convergence point and thus improving layout efficiency by reducing the number of iterations.

[0005] Traditional force-directed algorithms typically only consider the distance between two points when calculating the repulsive force between nodes. In reality, the importance of different nodes should be considered during the layout process to improve the quality of the layout, as a large number of nodes mixed together can cause visual interference. Summary of the Invention

[0006] (a) Technical problems to be solved

[0007] The technical problem to be solved by this invention is how to provide a network situation visualization method based on an improved force-directed algorithm, so as to solve the problems of unstable layout effect caused by random node layout at the initial moment in the traditional force-directed algorithm, and the fact that the traditional force-directed algorithm usually only considers the distance between two points when calculating the repulsive force between nodes.

[0008] (II) Technical Solution

[0009] To address the aforementioned technical problems, this invention proposes a network situation visualization method based on an improved force-guided algorithm, which includes the following steps:

[0010] Step S1: Perform k-kernel decomposition on the network resource topology graph to obtain the number of cores of each node in the network. The larger the number of cores of a node, the more important the node is in the network. Based on the number of cores of the nodes, the nodes are divided into three levels, namely level1, level2 and level3.

[0011] Step S2: Assign positions to nodes based on their core count as the initial layout for the force-directed layout: Create three concentric circles with different radii centered on the center point of the layout screen. Based on the node level in Step S1, assign nodes to their respective concentric circles. Level 1 nodes are assigned to concentric circles near the layout center. Nodes are assigned to the three concentric circles from the innermost to the outermost according to their core count level from largest to smallest. Each node randomly generates a coordinate within the assigned circle as its initial position.

[0012] Step S3: Add the number of cores of a node as a measure of its importance in the network to the force calculation formula of the node, calculate the repulsive and attractive forces on the node, obtain the node's displacement based on the forces, and iterate this process repeatedly until the node's position tends to be stable, at which point the algorithm ends.

[0013] Step S4: Display the locations of these nodes on the screen to achieve the best visualization effect of the network resource topology map.

[0014] Furthermore, in step S1, nodes with a degree of 1 and their connected edges are repeatedly removed from the network until no more nodes and edges in the subgraph are removed. At this point, the removed nodes are the 1-cores of the network. Next, nodes with a degree of 2 and their connected edges are repeatedly removed from the network. At this point, the removed nodes are the 2-cores of the network. This process continues until the network is completely decomposed, and the number of cores for all nodes is obtained.

[0015] Furthermore, level1 corresponds to the 1-core node of the network, level2 corresponds to the 2-core node of the network, and level3 corresponds to the remaining nodes in the network.

[0016] Furthermore, in step S2, the original connection relationships of the nodes remain unchanged during the initial layout.

[0017] Furthermore, in step S3, the formula for calculating the repulsive force on the node is:

[0018]

[0019] Among them, F r (n1,n2) represents the repulsive force between nodes n1 and n2, core(n1) is the core value of node n1. The formula uses core(n1)+1 to ensure that nodes with a core value of 0 still have a certain repulsive force. d(n1,n2) represents the distance between nodes n1 and n2. k is the repulsive force coefficient.

[0020] Furthermore, k is the repulsion coefficient, set as follows:

[0021]

[0022] Where area represents the total area of ​​the layout region, C is a constant, and N represents the number of all nodes in the layout region.

[0023] Furthermore, in step S3, the formula for calculating the gravitational force on the node is:

[0024]

[0025] Furthermore, in step S3, the displacement vector of the node in this iteration process is obtained based on the calculated attraction and repulsion forces, and the network node moves within the pre-divided ring.

[0026] Furthermore, during the displacement process, the actual displacement of the node is determined according to the set maximum displacement magnitude.

[0027] Furthermore, step S3 also includes: setting a threshold parameter min to control the termination of the algorithm. When the moving distance of all nodes in the network is less than this threshold min, the layout is considered to be stable and the iteration is terminated. At this time, the coordinates of the nodes are taken as the final result of the layout.

[0028] (III) Beneficial Effects

[0029] This invention proposes a network situation visualization method based on an improved force-directed algorithm. Addressing the issue of unstable layout results caused by random node placement in the initial stage of the traditional force-directed algorithm, this invention designs an improved network initial layout strategy based on the number of node cores. Considering that different nodes should have different levels of importance in the network during node placement, this invention incorporates the number of node cores into the force calculation of the nodes, resulting in a more reasonable layout. Attached Figure Description

[0030] Figure 1 Here is a flowchart of the existing force-directed algorithm;

[0031] Figure 2 This is a flowchart of the improved force-guided algorithm of the present invention. Detailed Implementation

[0032] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.

[0033] This invention is a network situation visualization method based on an improved force-directed algorithm. Addressing the instability caused by the random initial node placement in traditional force-directed algorithms, this invention proposes an improved network initial placement strategy based on the number of node cores. Traditional force-directed algorithms only consider the connectivity of nodes when calculating the forces acting on them, neglecting the varying importance of nodes within the network. The number of node cores reflects the importance of a node; therefore, this algorithm incorporates the number of node cores into the node force calculation formula, improving the effectiveness of network placement.

[0034] The purpose of this invention is to optimize network layout methods when visualizing network situation on the front end. To this end, a network situation visualization method based on an improved force-directed algorithm is proposed. Specifically, it includes the following steps:

[0035] The algorithm flow of the network situation visualization method based on the improved force-oriented algorithm is as follows: Figure 2 As shown, a network initial layout improvement strategy based on the number of node cores is first designed. After allocating the initial positions of the network nodes, a formula for calculating the force on the nodes during the layout process is designed. The node displacement is calculated based on the force, and the equilibrium is finally reached through iteration.

[0036] Step S1: Perform k-kernel decomposition on the network resource topology graph to obtain the number of cores of each node in the network. This number serves as an important factor for evaluating the importance of the node. The larger the number of cores of a node, the more important the node is in the network. Based on the number of cores of the nodes, the nodes are divided into three levels, namely level1, level2, and level3.

[0037] Step S2: Assign positions to nodes based on their core count as the initial layout for the force-directed layout. Specifically, create three concentric circles with different radii centered on the center point of the layout screen. Nodes are assigned to their respective concentric circles based on their level from Step S1. Level 1 nodes are assigned to concentric circles near the layout center. Nodes are then assigned to the three concentric circles from inner to outer according to their core count, from highest to lowest. Each node randomly generates a coordinate within its assigned circle as its initial position. Although the initial layout still uses random numbers, this algorithm does not rely entirely on random numbers; instead, it determines the initial position of each node based on its core count, ensuring that it appears within a reasonable range.

[0038] Step S3: Considering the varying importance of different nodes in the network, the number of cores is incorporated as a measure of a node's importance into the force calculation formula. The repulsive and attractive forces acting on the node are calculated, and the node's displacement is obtained based on these forces. This process is iterated repeatedly until the node's position stabilizes, at which point the algorithm terminates.

[0039] Step S4: Display the locations of these nodes on the screen to achieve the best visualization effect of the network resource topology map.

[0040] Example 1:

[0041] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0042] The process of the network situation visualization method based on the improved force-guided algorithm of this invention is as follows: Figure 2 As shown, it specifically includes the following four steps:

[0043] Step S1: Assign initial positions to network nodes.

[0044] (1) Perform k-kernel decomposition on the network to classify nodes into levels. There are two classic concepts in complex networks:

[0045] Degree is used to measure the number of edges connected to a node; that is, the degree of a node is determined by how many edges it has. For example, a node with 3 edges has a degree of 3.

[0046] Core count: The subgraph remaining after repeatedly removing nodes with a degree less than or equal to K from a network graph. If a node has K cores and is removed from K+1 cores, then the core count of that node is K.

[0047] Repeatedly remove nodes with degree 1 and their connected edges from the network until no more nodes and edges in the subgraph (a subgraph is a subset of the node set and edge set of a given graph, respectively) can be removed. The removed nodes at this point are the network's 1-cores. Next, repeatedly remove nodes with degree 2 and their connected edges; these removed nodes are the network's 2-cores, and so on, until the network is completely decomposed, yielding the core counts of all nodes. The network nodes are then divided into three levels—level 1, level 2, and level 3—in ascending order of their core counts.

[0048] In this context, level1 corresponds to the 1-core node of the network, level2 corresponds to the 2-core node of the network, and level3 corresponds to the remaining nodes in the network.

[0049] (2) Assign the nodes to the corresponding regions.

[0050] Draw three concentric circles with different radii, using the center of the layout area as the origin. Assign nodes to the corresponding circles in descending order of level, from the inside out. Randomly assign a coordinate to each node in the corresponding circle to form the initial layout.

[0051] In the initial layout, the original connection relationships of the nodes remain unchanged.

[0052] Step S2: Based on the force-oriented algorithm, improve the force formula of the nodes to make the distribution of node positions more reasonable.

[0053] (1) Adjust the repulsive force between nodes to improve the distance between core nodes of the network.

[0054] The formula for calculating the repulsive force on the node after adjustment is:

[0055]

[0056] Among them, F r (n1, n2) represents the repulsive force between nodes n1 and n2. `core(n1)` is the core value of node n1. The formula uses `core(n1) + 1` to ensure that nodes with a core count of 0 (nodes with a core count of 0 are those removed from the network graph with a degree of 0) still possess a certain repulsive force. `d(n1, n2)` represents the distance between nodes n1 and n2. `k` is the repulsive force coefficient, a manually set value, typically set as follows:

[0057]

[0058] Where area represents the total area of ​​the layout region, C is a constant, and N represents the number of all nodes in the layout region.

[0059] (2) Calculate the gravitational force on the node.

[0060] In the force-directed algorithm, gravity exists between connected pairs of nodes, and the formula for calculating the gravity acting on a node is:

[0061]

[0062] Step S3: Based on the attraction and repulsion calculated in step S2, the displacement vector of the node in this iteration process is obtained. The network node moves within the pre-divided ring and the actual displacement of the node is determined according to the set maximum displacement magnitude.

[0063] Step S4: Set a threshold (min) parameter to control the termination of the algorithm. When the moving distance of all nodes in the network is less than this threshold (min), the layout is considered to be stable and the iteration is terminated. At this time, the coordinates of the nodes are taken as the final result of the layout.

[0064] Step S5: Display the locations of these nodes on the screen to achieve the best visualization effect of the network resource topology map.

[0065] This invention addresses the instability caused by random node placement in the initial stage of traditional force-directed algorithms by proposing an improved network initial placement strategy based on the number of node cores. Considering that different nodes should have varying degrees of importance within the network during placement, the invention incorporates the number of node cores into the force calculation of each node, resulting in a more rational placement outcome.

[0066] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A network situation visualization method based on an improved force-directed algorithm, characterized in that, The method includes the following steps: Step S1: Perform k-kernel decomposition on the network resource topology graph to obtain the number of cores of each node in the network. The larger the number of cores of a node, the more important the node is in the network. Based on the number of cores of the nodes, the nodes are divided into three levels, namely level1, level2 and level3. Step S2: Assign positions to nodes based on their core count as the initial layout for the force-directed layout: Create three concentric circles with different radii centered on the center point of the layout screen. Based on the node level in Step S1, assign nodes to their respective concentric circles. Level 1 nodes are assigned to concentric circles near the layout center. Nodes are assigned to the three concentric circles from the innermost to the outermost according to their core count level from largest to smallest. Each node randomly generates a coordinate within the assigned circle as its initial position. Step S3: Add the number of cores of a node as a measure of its importance in the network to the force calculation formula of the node, calculate the repulsive and attractive forces on the node, obtain the node's displacement based on the forces, and iterate this process repeatedly until the node's position tends to be stable, at which point the algorithm ends. Step S4: Display the locations of these nodes on the screen to achieve the best visualization effect of the network resource topology map.

2. The network situation visualization method based on the improved force-directed algorithm of claim 1, wherein, In step S1, nodes with a degree of 1 and their connected edges are repeatedly removed from the network until no more nodes and edges in the subgraph are removed. The removed nodes are the 1-cores of the network. Next, nodes with a degree of 2 and their connected edges are repeatedly removed from the network. The removed nodes are the 2-cores of the network. This process continues until the network is completely decomposed, and the number of cores for all nodes is obtained.

3. The network situation visualization method based on the improved force-directed algorithm of claim 2, wherein, Level 1 corresponds to the 1-core node of the network, level 2 corresponds to the 2-core node of the network, and level 3 corresponds to the remaining nodes in the network.

4. The method for network situation visualization based on improved force-directed algorithm of claim 1, wherein, In step S2, the original connection relationships of the nodes remain unchanged during the initial layout.

5. The network situation visualization method based on the improved force-guided algorithm as described in any one of claims 1-4, characterized in that, In step S3, the formula for calculating the repulsive force on the node is: Among them, F r (n1,n2) represents the repulsive force between nodes n1 and n2, core(n1) is the core value of node n1. The formula uses core(n1)+1 to ensure that nodes with a core value of 0 still have a certain repulsive force, d(n1,n2) represents the distance between nodes n1 and n2, and k is the repulsive force coefficient.

6. The network situation visualization method based on the improved force-directed algorithm of claim 5, wherein, k is the repulsion coefficient, set as follows: Where area represents the total area of ​​the layout region, C is a constant, and N represents the number of all nodes in the layout region.

7. The method for network situation visualization based on improved force-directed algorithm of claim 6, wherein, In step S3, the formula for calculating the gravitational force on the node is:

8. The network situation visualization method based on the improved force-directed algorithm of claim 7, wherein, In step S3, the displacement vector of the node in this iteration process is obtained based on the calculated attraction and repulsion forces, and the network node moves within the pre-defined ring.

9. The network situation visualization method based on the improved force-directed algorithm of claim 8, wherein, During the displacement process, the actual displacement of the node is determined according to the set maximum displacement magnitude.

10. The method for network situation visualization based on improved force-directed algorithm of claim 8, wherein, Step S3 further includes: setting a threshold parameter min to control the termination of the algorithm. When the moving distance of all nodes in the network is less than this threshold min, the layout is considered to be stable and the iteration is terminated. At this time, the coordinates of the nodes are taken as the final result of the layout.