A K-Truss-based method for identifying key modules of complex software

The software module network is analyzed through the K-Truss algorithm to identify key nodes, solving the problem of low identification efficiency of key modules in software maintenance in the prior art, and improving the efficiency and quality of software maintenance.

CN114706558BActive Publication Date: 2024-11-26ZHEJIANG GONGSHANG UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210262823.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-17
Publication Date
2024-11-26
Estimated Expiration
2042-03-17

AI Technical Summary

Technical Problem

In the software maintenance of the existing technology, it is difficult to effectively identify key modules in complex software. The K-Core algorithm has low requirements for the compactness of the graph structure, resulting in low efficiency. The iteration process of the PageRank algorithm is cumbersome and the parameter calculation is complex, which affects the mining efficiency.

Method used

The K-Truss algorithm is used to analyze the software module network structure, and key nodes are extracted by defining the support degree and key degree values, reducing secondary node information and improving mining efficiency.

Benefits of technology

It improves the efficiency and quality of software maintenance, effectively filters useless information through stricter structural constraints and relationship definitions, and improves the identification and understanding of key software modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114706558B_ABST
    Figure CN114706558B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of software module identification, and discloses a complex software key module identification method based on K-Truss, including: step 1: preprocessing the original software and converting it into a formatted software module network: analyzing the dependency relationship between the modules in the original software, and converting it into a software module network that can be identified by the algorithm; step 2: using the K-Truss algorithm to perform structural analysis on the software module network and mine key nodes: inputting the software module network into the K-Truss algorithm to obtain relevant information of the key nodes; step 3: key class identification output: extracting and outputting the nodes in the K-Truss subgraph according to the set threshold. The present invention uses the K-Truss algorithm to perform importance analysis on the module nodes in the structured module network and detect the key modules therein, and then provides them to the developer, thereby improving the efficiency of the developer's understanding of the software and ultimately improving the quality of software maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of software module identification, and in particular relates to a complex software key module identification method based on K-Truss. Background Art

[0002] The development and maintenance of modern software often follow a standardized software development cycle. The common software development cycle is divided into five stages: feasibility study, demand analysis, software design, software testing, and software maintenance. Among them, the software maintenance stage is the longest stage in the entire software development cycle. The software maintenance process determines the quality of the user experience and whether the software can run stably and sustainably. As the main personnel for software maintenance, developers need to locate and troubleshoot problems that occur or are about to occur during the operation of the software based on their understanding of the software. However, due to the uncertainty of changes in factors such as demand, personnel, and resources during the software development process, developers will encounter greater resistance when facing unfamiliar software maintenance work.

[0003] P.Meyer, H.Siy and S.Bhowmick proposed a method to detect key modules of the network using K-Core algorithm. The method first models the software according to the static dependencies of the software to form a software module network. Each node in the network represents a functional module in the software, and the edge connecting two nodes is used to represent the dependency between two classes. K-Core algorithm is a subgraph mining algorithm, which imposes certain restrictions on the structure of the subgraph, that is, each node of the subgraph is associated with at least K other nodes in the subgraph. Under this restriction, K-Core algorithm can mine a compact subgraph structure that meets the specified coreness in the software network. Among them, the value of K has an upper limit KMax. K-Core algorithm can calculate and sort the coreness of each node in the software module network during the process of mining KMax-Core. Finally, the method outputs the nodes and their corresponding edges with the top 3% of coreness as the key module network. The disadvantage of this method is that the K-Core algorithm used by it does not have high requirements on the compactness of the graph structure, which will result in a large amount of secondary node information in the final subgraph structure, which will ultimately affect the mining efficiency.

[0004] Sehgal, Kaur and others proposed the PageRank algorithm to detect key modules of the network. The method is based on the assumption that the coreness of a node can be propagated to a certain extent with its connected nodes. In the initial stage of the algorithm, the network is constructed through the relationship between each node, and a PR (PageRank) value is set for each node, indicating the probability of its being visited. The algorithm then iterates the PR value for multiple rounds until it becomes stable, thereby obtaining the importance ranking of each node. The disadvantage of this method is that its random jump mechanism does not conform to the actual situation, and the parameters in the iterative process require a lot of experimental calculations, which is not efficient. Summary of the invention

[0005] The purpose of the present invention is to provide a complex software key module identification method based on K-Truss to solve the above-mentioned technical problems.

[0006] In order to solve the above technical problems, the specific technical solution of the complex software key module identification method based on K-Truss of the present invention is as follows:

[0007] A complex software key module identification method based on K-Truss includes the following steps:

[0008] Step 1: Preprocess the original software and convert it into a formatted software module network: Analyze the dependencies between the modules in the original software and convert them into a software module network that can be recognized by the algorithm;

[0009] Step 2: Use the K-Truss algorithm to perform structural analysis on the software module network and mine key nodes: Input the software module network into the K-Truss algorithm to obtain relevant information of key nodes;

[0010] Step 3: Key class identification output: Extract and output the nodes in the K-Truss subgraph according to the set threshold.

[0011] Furthermore, the step 1 includes the following specific steps:

[0012] The class is used as the minimum granularity for key module identification, referred to as the key class. The original software is preprocessed, and irrelevant files in the software project file are excluded. Only files with the suffix ".java" are retained to generate the software module network and define the software module network:

[0013] SMN=(N,E,T)

[0014] Among them, N represents the node set of the network, including the classes and abstract interface elements in the software, E represents the edge set of the network, including the relationship between each node, and T is a triple set, representing the attributes and types of each edge in the edge set.

[0015] Furthermore, step 1 includes defining the relationship types between each node, including inheritance relationship, implementation relationship, dependency relationship, and association relationship; the inheritance relationship refers to a class a inheriting another class b, which is implemented in JAVA with the extends keyword; the implementation relationship refers to a class a implementing the function of an interface b, which is implemented in JAVA with the implements keyword; the dependency relationship refers to a class a using class b, where class b serves as a method parameter of class a; the association relationship refers to an instance a of a class using an instance b of another class.

[0016] Furthermore, step 1 includes a process of converting a source code fragment into a software module network, where each class corresponds to a node. If there is an inheritance relationship, implementation relationship, dependency relationship, or association relationship between two classes in the source code, an edge is added between the corresponding nodes of the software module network, and the above rules are used for conversion to obtain the software module network SMN.

[0017] Furthermore, the step 2 includes the following specific steps:

[0018] For the software module network graph SMN = (N, E, T), any edge in the graph can be represented as E i =(u, v), where E i represents an edge, u and v represent the two nodes connected by this edge respectively, and define the support degree Support(E i ) is used to represent the edge E i The number of triangles in the graph, defining the graph KT as a subgraph of the graph SMN, if KT satisfies the support Support of any edge in the graph, it satisfies Support(E i )≥k-2, then KT is called a k-truss subgraph.

[0019] Furthermore, the step 3 includes the following specific steps:

[0020] After obtaining the k-truss subgraph, sort the nodes in the subgraph by their criticality. For any node in the graph, its criticality is defined as follows:

[0021]

[0022] Among them, Cri v represents the critical value of node v, m represents the k value corresponding to the subgraph with the smallest number of nodes in the k-truss subgraph containing the node, and N m and N m+1Respectively represent the number of nodes contained in the m-truss and (m+1)-truss subgraphs. If the (m+1)-truss subgraph does not exist, then N m+1 Take 0;

[0023] Finally, according to the above method, the criticality value of each node and its corresponding module is calculated and sorted, and the first n module information is selected for output, and the value of n is determined according to the needs.

[0024] The complex software key module identification method based on K-Truss of the present invention has the following advantages: the present invention adopts the K-Truss algorithm, which has higher requirements on the compactness of the subgraph structure, can reduce the proportion of secondary node information in the output result, and improve the mining efficiency; the method defines the relationship between nodes and is simple to implement; the present invention adopts the K-Truss algorithm to analyze the importance of module nodes in the structured module network and detect the key modules therein, and then provide them to developers, thereby improving the efficiency of developers in understanding the software and ultimately improving the quality of software maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is an overview diagram of the method of the present invention;

[0026] Figure 2 Generate a schematic diagram for the SMN of the present invention;

[0027] Figure 3 The SMN of the present invention Ant Schematic diagram;

[0028] Figure 4(a) is a schematic diagram of graph G generated by k-truss;

[0029] Figure 4(b) is a schematic diagram of a 3-truss subgraph in k-truss generation;

[0030] Figure 4(c) is a schematic diagram of a 4-truss subgraph in k-truss generation;

[0031] Figure 5(a) shows SMN Ant Schematic diagram of 3-truss subgraph in k-truss subgraph generation;

[0032] Figure 5(b) shows SMN Ant Schematic diagram of 4-truss subgraph in k-truss subgraph generation;

[0033] Figure 5(c) shows SMN Ant Schematic diagram of 5-truss subgraph in k-truss subgraph generation;

[0034] Figure 5(d) shows SMN AntSchematic diagram of 6-truss subgraph in k-truss subgraph generation;

[0035] Figure 5(e) shows SMN Ant Schematic diagram of 7-truss subgraph in k-truss subgraph generation. DETAILED DESCRIPTION

[0036] In order to better understand the purpose, structure and function of the present invention, a complex software key module identification method based on K-Truss of the present invention is further described in detail below in conjunction with the accompanying drawings.

[0037] For modern software, its whole is usually composed of various modules, so developers can use modules as the key objects of their understanding of software. Key modules refer to modules that realize the core functions of software. The identification and detection of key modules can effectively improve the efficiency of developers in understanding complex software. K-Truss is a hierarchical and progressive subgraph structure, which constrains the graph structure and requires that each edge in the graph belongs to at least (K-2) triangles. The K-Truss graph structure under this conditional constraint can effectively reflect the connectivity, centrality and other indicators of the entire graph network. At the same time, compared with other similar algorithms, K-Truss can filter useless information more effectively due to its stricter structural definition constraints, thereby improving the efficiency of graph network analysis and research. The present invention uses the K-Truss algorithm to analyze the importance of module nodes in the structured module network and detect the key modules therein, and then provides them to developers, thereby improving the efficiency of developers in understanding software and ultimately improving the quality of software maintenance.

[0038] In order to obtain the key module information list in complex software (hereinafter referred to as the key module list), we use the K-Truss algorithm to analyze and mine the preprocessed module network. In order to obtain the module network that can be used by this method, we will preprocess the original software to facilitate conversion. Figure 1 As shown, this method has the following steps during use:

[0039] 1) Preprocess the original software and convert it into a formatted software module network. In this step, we need to analyze the dependencies between the modules in the original software and use the set rules to convert them into a software module network that can be recognized by the algorithm.

[0040] 2) Use the K-Truss algorithm to perform structural analysis on the software module network and mine key nodes. In this step, we input the software module network into the K-Truss algorithm to obtain relevant information about key nodes.

[0041] 3) Key class identification output. In this step, we extract and output the nodes in the K-Truss subgraph according to the set threshold.

[0042] Specific steps of the method:

[0043] 1) Original software preprocessing and software network generation

[0044] In the following, we will take the open source software Apache Ant as an example to show the various steps of the method. Since Apache Ant is compiled by Java language, we follow the characteristics of Java software and use classes as the minimum granularity of our key module identification (hereinafter referred to as key classes).

[0045] The original software consists of software source code files and configuration files. In JAVA software, the core code, logic and dependencies of the software usually exist in files with the suffix ".java". In order to ensure the detection of key class information with maximum efficiency, this method will pre-process the original software when performing key class detection on JAVA object-oriented software, exclude irrelevant files in the software project file, and only retain files with the suffix ".java" to generate the software module network. First, we define the software module network:

[0046] SMN=(N,E,T)

[0047] N represents the node set of the network, including elements such as classes and abstract interfaces in the software. E represents the edge set of the network, including the relationship between each node. T is a set of triples, representing the attributes and types of each edge in the edge set. We define the relationship type between each node as shown in Table 1:

[0048] Table 1. Node relationship type table

[0049]

[0050]

[0051] Figure 2 The figure describes the process of converting a source code fragment into a software module network. The upper part of the figure is the content of the source code, which contains six Java classes, namely Human, Student, Address, Book, Live and FreeLive. The lower part of the figure is the converted software module network diagram. The six nodes in the figure correspond to the six Java classes in the source code. If there is a relationship described in Table 1 between two classes in the source code, an edge is added between the corresponding nodes of the software module network.

[0052] The Student class inherits from the Human class, has a dependency relationship with the Book class, and has an association relationship with the Address class, so the Student node has edge relationships with the Human, Book, and Address nodes respectively. The FreeLive class is the interface implementation of the Live class, and has an association relationship with the Address class, so the FreeLive node has edge relationships with the Live and Address nodes respectively. Finally, through transformation, we get the SMN graph corresponding to the source code.

[0053] For the source code of Apache Ant software, we use the above rules to transform and get the following Figure 3 The software module network SMN Ant To facilitate program processing and image display, we numbered each class and its corresponding node. The numbers in the figure are the numbers corresponding to each node.

[0054] 2) K-Truss algorithm analysis and key node mining

[0055] For the software module network graph SMN = (N, E, T), any edge in the graph can be represented as E i =(u, v), where E i represents an edge, u and v represent the two nodes connected by this edge. Define support (E i ) is used to represent the edge E i The number of triangles in the graph. Define a graph KT as a subgraph of the graph SMN if KT satisfies the support Support of any edge in the graph and satisfies Support(E i )≥k-2, then KT is called a k-truss subgraph.

[0056] As shown in Figure 4(a), graph G is an undirected graph with 10 nodes and 17 edges. According to the above rules, we delete nodes 7 and 9 and the edges connecting them, and we get the 3-truss subgraph shown in Figure 4(b). According to the above definition, each edge in the 3-truss subgraph belongs to one triangle. Then we continue to delete nodes 3, 6, 8, and 10 and the edges connecting them, and we get the 4-truss subgraph shown in Figure 4(c), in which each edge belongs to two triangles.

[0057] For Apache Ant, the process is as follows Figure 5(a)-Figure 5(e) As shown:

[0058] We first generate the software module network SMN in step 1) AntAs input, according to the definitions and steps mentioned above, we get the 3-truss subgraph shown in Figure 5(a), and then further decompose the 3-truss subgraph to get the subgraph 4-truss, and so on. Finally, we get a total of five k-truss subgraphs (k = 3, 4, 5, 6, 7).

[0059] 3) Key category identification output

[0060] After obtaining the k-truss subgraph, we need to sort the criticality of the nodes in the subgraph. For any node in the graph, we define its criticality as follows:

[0061]

[0062] Among them, Cri v represents the critical value of node v, m represents the k value corresponding to the subgraph with the smallest number of nodes in the k-truss subgraph containing the node, and N m and N m+1 Respectively represent the number of nodes contained in the m-truss and (m+1)-truss subgraphs. If the (m+1)-truss subgraph does not exist, then N m+1 Take 0.

[0063] Finally, we calculate the criticality value of each node and its corresponding module (class) according to the above method and sort them, and select the first n module (class) information for output (the value of n is determined according to the needs).

[0064] It is to be understood that the present invention is described by some embodiments, and it is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the scope of protection of the present invention.

Claims

1. A complex software key module identification method based on K-Truss, characterized in that: The steps include: Step 1: Preprocess the original software and convert it into a formatted software module network: Analyze the dependencies between the modules in the original software and convert them into a software module network that can be recognized by the algorithm; The step 1 comprises the following specific steps: The class is used as the minimum granularity for key module identification, referred to as the key class. The original software is preprocessed, and irrelevant files in the software project file are excluded. Only files with the suffix ".java" are retained to generate the software module network and define the software module network: , in, A collection of nodes representing a network, including classes and abstract interface elements in the software. Represents the edge set of the network, including the relationship between each node, It is a set of triples, representing the attributes and types of each edge in the edge set; The step 1 includes defining the relationship type between each node, including inheritance relationship, implementation relationship, dependency relationship, and association relationship; the inheritance relationship refers to a class a inheriting another class b, which is implemented by the extends keyword in JAVA; the implementation relationship refers to a class a implementing the function of an interface b, which is implemented by the implements keyword in JAVA; the dependency relationship refers to a class a using a class b, where class b is used as a method parameter of class a; the association relationship refers to an instance a of a class using an instance b of another class; The step 1 includes a process of converting a source code fragment into a software module network, where each class corresponds to a node. If there is an inheritance relationship, implementation relationship, dependency relationship, or association relationship between two classes in the source code, an edge is added between the corresponding nodes of the software module network, and the above rules are used for conversion to obtain a software module network. ; Step 2: Use the K-Truss algorithm to perform structural analysis on the software module network and mine key nodes: Input the software module network into the K-Truss algorithm to obtain relevant information of key nodes; Step 3: Key class identification output: Extract and output the nodes in the K-Truss subgraph according to the set threshold.

2. The complex software key module identification method based on K-Truss according to claim 1 is characterized in that: The step 2 comprises the following specific steps: For software module network diagram , any edge in the graph can be represented as ,in represents the edge, and Represent the two nodes connected by this edge, and define the support Used to represent edges The number of triangles involved in the graph defines the graph It is a picture A subgraph of Satisfies the support of any edge in the graph All meet , then it is called is a k-truss subgraph.

3. The complex software key module identification method based on K-Truss according to claim 2 is characterized in that: The step 3 comprises the following specific steps: After obtaining the k-truss subgraph, sort the nodes in the subgraph by their criticality. For any node in the graph, its criticality is defined as follows: , in, Representation Node The critical value of Indicates the k value corresponding to the subgraph with the smallest number of nodes in the k-truss subgraph containing the node. and Respectively represent the number of nodes contained in the m-truss and (m+1)-truss subgraphs. If the (m+1)-truss subgraph does not exist, then Pick ; Finally, according to the above method, the criticality value of each node and its corresponding module is calculated and sorted, and the first n module information is selected for output, and the value of n is determined according to the needs.

Citation Information

Patent Citations

  • Key class identification method based on a software running network

    CN109871318A

  • Key package identification method based on software running network

    CN109976807A

  • K-truss decomposition method based on Quegel distributed graph computing system

    CN113590887A