A graph layout visualization method for software supply chain

By combining the FR force guidance algorithm and node characteristics, the graph layout of the software supply chain is optimized, which solves the problems of low space utilization and unclear hierarchical relationships in the existing technology, and achieves efficient software package hierarchical display and special location layout. Suitable for large-scale software supply chain data.

CN114549691BActive Publication Date: 2024-10-18INST OF SOFTWARE - CHINESE ACAD OF SCI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210168079.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2024-10-18
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

When the existing diagram layout method displays the hierarchical relationship of the software supply chain, the space utilization rate is not high and it is difficult to highlight the software packages with special positions, and cannot effectively display the large amount of software supply chain data.

Method used

Based on the FR force guidance algorithm, combined with the location characteristics and degree centrality of nodes, through tree layout, initial position calculation, force iterative update and simulated annealing algorithm, the graph layout of the software supply chain is optimized to ensure clear hierarchical relationships and space utilization. The rate is high.

Benefits of technology

It realizes the rational layout of special location software packages while displaying the hierarchical dependencies of software packages, improves space utilization and layout aesthetics, and is suitable for large-volume software supply chain data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549691B_ABST
    Figure CN114549691B_ABST
Patent Text Reader

Abstract

The present invention relates to a software supply chain graph layout visualization method, comprising the steps of: obtaining a tree layout of a software supply chain to be laid out; determining the initial layout position of each node according to the hierarchical relationship between software package nodes in the tree layout; traversing each node in turn, calculating the force applied to each node and calculating the moving distance according to the force to update the layout position of each node; iteratively executing the above steps until the iteration termination condition is reached, and the obtained node layout is the final graph layout of the software supply chain to be laid out. Compared with the prior art, the method of the present invention can not only display the hierarchical dependency relationship between software packages, but also reasonably lay out software package nodes with special positions, while taking into account the utilization rate of the display space and the overall aesthetics of the node layout.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software supply chain, and in particular relates to a graph layout visualization method for a software supply chain. Background Art

[0002] According to the study of perceptual psychology, humans' cognitive speed and acceptance of images are much greater than that of text. Information visualization is to convey the information behind the data to users through visual means, and to express complex or large-volume information in a visual way to facilitate users to conduct deeper mining and analysis of the data. Graph visualization is an important field of information visualization. Graph data, also known as network data, is one of the most commonly used data types in the real world. Graph visualization plays an important role in scientific research, industrial production, the Internet, daily life and other fields, such as computer networks, bioinformatics, social relationships, software dependencies, etc. After being displayed in a graph visualization way, graph data can assist users in analyzing complex relational data and thus discover the value contained in the data.

[0003] With the rapid development of information technology and the popularization of the Internet, human society's dependence on software has gradually increased, and software has become an indispensable part of people's life, work, and study. The software supply chain is a supply relationship network formed by dependencies, combinations, etc. involving all software upstreams, source packages, binary packages, package managers, repositories, developers, maintainers, communities, foundations, etc. during the development and operation of a system. The number of software packages included in the software supply chain is huge, and the dependencies are complex. Developers usually pay more attention to directly dependent software packages and ignore indirectly dependent software packages. Visualization can help users conduct in-depth exploration and research on these large data with large volumes and complex dependencies. The data of the software supply chain can be abstracted into graph structure data, with software packages representing nodes and dependencies between software packages abstracted into directed edges. Graph visualization of the software supply chain can intuitively display the dependencies between software packages, helping developers discover software packages that have a significant impact on the software supply chain, track the dependencies of software packages, and reduce maintenance risks and compliance risks in the software supply chain itself.

[0004] The core of graph data visualization lies in layout. Graph layout is a very important cornerstone of graph visualization. Reasonable layout of graphs can help researchers quickly analyze and accurately locate problems. Layout algorithms usually display abstract data in concrete form according to some specific models. If the graph is not reasonably laid out, it is difficult for users to quickly extract the desired information from the graph. Software packages in the software supply chain have dependencies, and the graph data abstracted from them has an obvious hierarchical structure. At the same time, a software package may be dependent on software packages at different levels. For example, the bottom-level software package A is also dependent on the upper-level software package C and the third-level software package B. If software package A lacks maintenance and has problems, it will not only affect the security of software package C, but also threaten the security of software package B. Software packages with such location characteristics may have greater significance for the entire software supply chain. Therefore, the visualization of the software supply chain requires not only a clear display of the hierarchical relationship between software packages, but also a reasonable and effective layout of software packages with special locations, so that users can easily dig out more important software packages in the software supply chain, evaluate the risks and security of the software supply chain, and explore more valuable information.

[0005] Existing graph layout methods, such as tree layout, focus more on the hierarchical relationship between nodes. Such layout starts from the root node and accumulates from top to bottom or from left to right in the same direction according to the hierarchical relationship. This display method is the most intuitive and consistent with the public's perception of trees, but there are some problems, such as low utilization of display screen space. The closer to the root node, the sparser it is, resulting in a lot of blank space, wasting screen space, and is not suitable for layout of data in software supply chains with large amounts of data. Force-guided layout is also a commonly used method in graph layout. Force-guided layout emphasizes the attraction and repulsion between simulated electrons, which can greatly reduce the overlap between nodes and the intersection of edges, and can generate a beautiful layout with evenly distributed nodes. However, this feature is not conducive to displaying the hierarchical relationship in the software supply chain, and it is difficult to highlight software packages with special locations. Summary of the invention

[0006] In view of the deficiencies in the prior art, the present invention provides a software supply chain graph layout visualization method based on the FR (Fruchterman Reingold) force-directed algorithm and combined with the location characteristics and degree centrality of nodes. The technical solution adopted is as follows:

[0007] A software supply chain graph layout visualization method includes the following steps:

[0008] Step 1: Obtain the tree layout of the software supply chain to be laid out;

[0009] Step 2: Determine the initial layout position of each node according to the hierarchical relationship between the software package nodes in the tree layout;

[0010] Step 3: Traverse each node in turn, calculate the force on each node and calculate the moving distance according to the force to update the layout position of each node;

[0011] Step 4: Iterate step 3 until the iteration termination condition is reached, and the resulting node layout is the final graph layout of the software supply chain to be laid out.

[0012] Furthermore, in step 1, there is only one root node in the tree layout, and the dependency relationship between the software packages represented by the nodes is reflected by the directed edges between the nodes. The software package represented by node A depends on the software package represented by node B, which is represented by the presence of a directed edge from node A to node B between nodes A and B, and node A is called the predecessor node of node B.

[0013] Furthermore, in step 2,

[0014] First, the nodes in the tree layout are divided into common nodes and public nodes. The nodes with only one predecessor node are common nodes, and the nodes with multiple predecessor nodes are public nodes.

[0015] Then, the nodes in the tree layout are layered. The root node is the first layer, the common nodes connected to the root node are the second layer, the common nodes connected to the common nodes in the second layer are the third layer, and so on. The number of layers of the common nodes is equal to the average number of layers of the common nodes connected to it. The total number of layers in the tree layout, depth, is the highest number of nodes after ignoring the common nodes.

[0016] Finally, the layout positions of the common nodes on the same layer are initialized to the same position.

[0017]

[0018] Initialize the layout positions of common nodes on the same layer to the same position.

[0019]

[0020] Among them, v.pos x With v.pos y Respectively represent the x-coordinate and y-coordinate of the common node in the i-th layer, v g .pos x With v g .pos y They represent the x-coordinate and y-coordinate of the j-th layer public node, respectively. W and H are the width and height of the screen display area, respectively. w The display width of the node.

[0021] Furthermore, the calculation process of the force acting on a certain node in step 3 includes:

[0022] First, determine the ideal distance between nodes. The ideal distance k between common nodes and between common nodes and public nodes is expressed as |V| is the total number of nodes, area is the area of ​​the screen display area; the ideal distance k between common nodes g Expressed as |V g | is the total number of public nodes;

[0023] Then, for the common nodes V that have a connection relationship u and node V t , calculate V u and V t The tightness between the strength, strength = 1 / min (deg (v u ),deg(v t )), deg(v u ) and deg(v t ) are V u and V t The degree of a node represents the number of nodes connected to the node.

[0024] Finally, the forces acting on the nodes are calculated. The forces acting on the nodes include the gravitational force and repulsive force between nodes. The gravitational force and repulsive force between common nodes and between common nodes and public nodes are calculated in the same way, which is:

[0025]

[0026] Among them, f a (d) and f r (d) represents the attraction and repulsion between two nodes, respectively, and d is the geometric distance between the two nodes;

[0027] The calculation method of attraction and repulsion between common nodes is:

[0028]

[0029] Among them, f ag (d) and f rg (d) represent the attractive force and repulsive force between two nodes respectively;

[0030] Only repulsion is calculated between nodes that are not connected by edges.

[0031] Furthermore, in step 4, the number of iterations is controlled by using the simulated annealing algorithm. Before the iteration starts, the initial system temperature and the minimum temperature are defined. Then, according to the calculation of the force in step 3, the moving distance of each node is obtained in turn to update the node position. After each iteration, the system temperature is updated: T n+1 =γT n , T nand T n+1 They represent the system temperature after the nth and n+1th iterations respectively, γ is the cooling coefficient, and the iteration stops when the system temperature is lower than the minimum temperature.

[0032] Furthermore, the geometric distance between two nodes is calculated using the Euclidean distance formula.

[0033] Furthermore, the initial system temperature value is set to 1 / 2 of the width of the screen display area, and the cooling coefficient is γ∈[0.6,0.95].

[0034] The beneficial effect of the present invention is that compared with the prior art, the software supply chain graph layout visualization method proposed by the present invention can not only display the hierarchical dependency relationship between software packages, but also reasonably layout the software package nodes with special positions, while taking into account the utilization of the display space and the overall aesthetics of the node layout. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION

[0036] The present invention will now be described in further detail with reference to the accompanying drawings.

[0037] like Figure 1 As shown, the software supply chain graph layout visualization method proposed in the present invention mainly includes the following steps:

[0038] (1) Determine the initial layout position of the nodes based on the hierarchical relationship between the software package nodes

[0039] In the tree diagram data composed of software package nodes, the dependency relationship between the software packages represented by the nodes can be reflected through the directed edges between the nodes. If the software package represented by node A depends on the software package represented by node B, there is a directed edge between nodes A and B from node A to node B. Node A is called the predecessor node of node B.

[0040] The graph data composed of software package nodes has a hierarchical structure, with only one root node. Based on this feature, the nodes are layered, starting from the edge connected to the root node. The layer where the root node is located is defined as the highest layer (the first layer), and the nodes connected to the root node are the second layer, and so on. If it is found that the node belongs to different layers, it means that the node is dependent on nodes of different layers, and the position of the node is more special. The node is defined as a public node, and the number of layers of the public node is equal to the average value of the layers of the ordinary nodes connected to it. The ordinary node is only dependent on one other node, that is, there is only one predecessor node. The total number of layers of the graph, depth, is obtained based on the tree composed of ordinary nodes.

[0041] Next, generate the initial layout of the graph. Here, the positions of nodes in each layer can be initialized to be the same. The initial position of the common nodes in the i-th layer can be set as follows:

[0042]

[0043] The initial position of the j-th layer public node can be set as follows:

[0044]

[0045] Among them, v.pos x With v.pos y Respectively represent the x-coordinate and y-coordinate of the common node in the i-th layer, v g .pos x With v g .pos y They represent the x-coordinate and y-coordinate of the j-th layer public node, respectively. W and H are the width and height of the screen display area, respectively. w The display width of the node.

[0046] (2) Traverse each node and update the layout position of each node according to the force acting on the node

[0047] To calculate the forces between nodes, it is necessary to calculate the ideal distance between nodes. The ideal distance k of common nodes can be calculated using the ideal distance formula of the FR algorithm, that is, The ideal distance k between common nodes g Then through the formula Calculation, area = W * H is the area of ​​the screen display area, |V| is the total number of nodes, |V g | is the total number of public nodes.

[0048] Because the common nodes will be relied upon by nodes at different levels, the tightness parameter is added to adjust the force related to the common nodes. Its definition formula is strength = 1 / min (deg (v u ),deg(v t )), deg(v u ) and deg(v t ) are public nodes V u and node V t The degree of the node indicates the number of nodes connected to the node. u and node V t There is a connection relationship between them.

[0049] The core idea of ​​the FR algorithm is that nodes connected by edges should be close to each other, but there should be no overlap of nodes. At the same time, it is hoped that the distance between any nodes should not be too close. Therefore, the algorithm defines that there is a repulsive force between all nodes, and the repulsive force is inversely proportional to the distance between the nodes. It can be deduced that the greater the distance between the nodes, the smaller the repulsive force, and the smaller the distance between the nodes, the greater the repulsive force. There is an attractive force between the connected nodes, which is proportional to the direct distance between the nodes. The smaller the distance between the nodes, the smaller the attractive force. The forces between ordinary nodes and between ordinary nodes and public nodes are calculated according to the FR force formula:

[0050]

[0051] Among them, f a (d) and f r (d) represents the attraction and repulsion between two nodes respectively, and d is the geometric distance between the two nodes, which is calculated using the Euclidean distance formula.

[0052] Public nodes are relied upon by nodes at different levels, so the present invention defines that the gravity of public nodes is restricted by the number of levels and nodes, and adds a tightness parameter to the calculation formula of the gravity of public nodes. In this way, the calculation formula of the force between public nodes is defined as follows:

[0053]

[0054] Among them, f ag (d) and f rg (d) represent the attractive force and repulsive force between two nodes respectively.

[0055] Next, the moving distance of each node is calculated based on the gravitational force and repulsive force exerted on the node, and then the node position is updated based on the previous layout.

[0056] (3) Iterate step (2) until the termination condition is reached.

[0057] In order to obtain the optimal solution for the layout and prevent excessive iterative calculations, the FR algorithm often uses the simulated annealing algorithm to control the number of iterations. The simulated annealing algorithm starts from a relatively high temperature, which is called the initial system temperature. As the temperature parameter continues to decrease, the solution in the algorithm tends to stabilize. Before the iteration begins, a minimum temperature needs to be set. After each iteration, the system temperature is lowered. When the system temperature is less than the minimum temperature value, the iteration stops and the node position is output.

[0058] The system temperature is adjusted using a linear algorithm, and the temperature drop process is expressed as T n+1 =γT n , γ is the cooling coefficient, ranging from 0.6 to 0.95, and 0.8 is generally used, T n and Tn+1 They represent the system temperature after the nth and n+1th iterations, respectively. The initial system temperature is generally set to 1 / 2 of the side length of the display area. After each iteration, the system temperature is multiplied by the cooling coefficient. Since the value of γ is less than 1, the system temperature decreases with the number of iterations until it is less than the agreed minimum temperature.

[0059] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A software supply chain graph layout visualization method, characterized in that: The following steps are involved: Step 1: Obtain the tree layout of the software supply chain to be laid out; there is only one root node in the tree layout, and the dependency relationship between the software packages represented by the nodes is reflected by the directed edges between the nodes. The software package represented by node A depends on the software package represented by node B, which is represented by a directed edge from node A to node B between nodes A and B. Node A is called the predecessor node of node B; Step 2: Determine the initial layout position of each node according to the hierarchical relationship between the software package nodes in the tree layout; First, the nodes in the tree layout are divided into common nodes and public nodes. The nodes with only one predecessor node are common nodes, and the nodes with multiple predecessor nodes are public nodes. Then, the nodes in the tree layout are layered. The root node is the first layer, the common nodes connected to the root node are the second layer, the common nodes connected to the common nodes in the second layer are the third layer, and so on. The number of layers of the common nodes is equal to the average number of layers of the common nodes connected to it. The total number of layers in the tree layout, depth, is the highest number of nodes after ignoring the common nodes. Finally, the layout positions of the common nodes on the same layer are initialized to the same position. Initialize the layout positions of common nodes on the same layer to the same position. Among them, v.pos x With v.pos y Respectively represent the x-coordinate and y-coordinate of the common node in the i-th layer, v g .pos x With v g .pos y They represent the x-coordinate and y-coordinate of the j-th layer public node, respectively. W and H are the width and height of the screen display area, respectively. w The display width of the node; Step 3: Traverse each node in turn, calculate the force on each node and calculate the moving distance based on the force to update the layout position of each node; the calculation process of the force on the node includes: First, determine the ideal distance between nodes. The ideal distance k between common nodes and between common nodes and public nodes is expressed as V| is the total number of nodes, area is the area of ​​the screen display area; the ideal distance k between common nodes g Expressed as V g | is the total number of public nodes; Then, for the common nodes V that have a connection relationship u and node V t , calculate V u and V t The tightness between the strength, strength = 1 / min (deg (v u ),deg(v t )), deg(v u ) and deg(v t ) are V u and V t The degree of a node represents the number of nodes connected to the node. Finally, the forces acting on the nodes are calculated. The forces acting on the nodes include the gravitational force and repulsive force between nodes. The gravitational force and repulsive force between common nodes and between common nodes and public nodes are calculated in the same way, which is: Among them, f a (d) and f r (d) represents the attraction and repulsion between two nodes, respectively, and d is the geometric distance between the two nodes; The calculation method of attraction and repulsion between common nodes is: Among them, f ag (d) and f rg (d) represent the attractive force and repulsive force between two nodes respectively; Only repulsion is calculated between nodes without edge connections; Step 4: Iterate step 3 until the iteration termination condition is reached. The resulting node layout is the final graph layout of the software supply chain to be laid out. Use the simulated annealing algorithm to control the number of iterations. Before the iteration starts, define the initial system temperature and minimum temperature. Then, according to the calculation of the force in step 3, obtain the moving distance of each node in turn to update the node position. After each iteration, update the system temperature: T n+1 =γT n , T n and T n+1 They represent the system temperature after the nth and n+1th iterations respectively, γ is the cooling coefficient, and the iteration stops when the system temperature is lower than the minimum temperature.

2. A software supply chain graph layout visualization method as claimed in claim 1, characterized in that: The geometric distance between two nodes is calculated using the Euclidean distance formula.

3. A software supply chain graph layout visualization method as claimed in claim 1, characterized in that: The initial system temperature value is set to 1 / 2 of the screen display area width, and the cooling coefficient is γ∈[0.6,0.95].

Citation Information

Patent Citations

  • Graph layout method and device

    CN106202559A

  • Hierarchical visual abstraction method based on improved force-directed graph layout

    CN106934422A