Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even sub...Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even substituting LOC for CC. However, from an empirical standpoint the relationship of CC to LOC is still an open one. We undertake the largest statistical study of this relationship to date. Employing modern regression techniques, we find the linearity of this relationship has been severely underestimated, so much so that CC can be said to have absolutely no explana-tory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear rela-tionship that holds across programmers, languages, code paradigms (procedural versus object-oriented), and software processes. Linear models are developed relating LOC and CC. These models are verified against over 1.2 million randomly selected source files from the SourceForge code repository. These files represent software projects from three target languages (C, C++, and Java) and a variety of programmer experience levels, software architectures, and de-velopment methodologies. The models developed are found to successfully predict roughly 90% of CC’s variance by LOC alone. This suggest not only that the linear relationship between LOC and CC is stable, but the aspects of code complexity that CC measures, such as the size of the test case space, grow linearly with source code size across lan-guages and programming paradigms.展开更多
The Wiener index W(G)of a graph G is a distance-based topological index defined as the sum of distances between all pairs of vertices in G.It is shown that forλ=2 there is an infinite family of planar bipartite chemi...The Wiener index W(G)of a graph G is a distance-based topological index defined as the sum of distances between all pairs of vertices in G.It is shown that forλ=2 there is an infinite family of planar bipartite chemical graphs G of girth 4 with the cyclomatic numberλ,but their line graphs are not chemical graphs,and forλ≥2 there are two infinite families of planar nonbipartite graphs G of girth 3 with the cyclomatic numberλ;the three classes of graphs have the property W(G)=W(L(G)),where L(G)is the line graph of G.展开更多
Tile basic features of object-oriented software makes it difficult to apply traditional testing methods in objectoriented systems. Control Flow Graph (CFG) is a well-known model used for identification of independen...Tile basic features of object-oriented software makes it difficult to apply traditional testing methods in objectoriented systems. Control Flow Graph (CFG) is a well-known model used for identification of independent paths in procedural software. This paper highlights the problem of constructing CFG in object-oriented systems and proposes a new model named Extended Control Flow Graph (ECFG) for code based analysis of Object-Oriented (OO) software. ECFG is a layered CFG where nodes refer to methods rather than statements. A new metrics Extended Cyclomatic Complexity (E-CC) is developed which is analogous to McCabe's Cyclomatic Complexity (CC) and refers to the number of independent execution paths within the OO software. The different ways in which CFG's of individual methods are connected in an ECFG are presented and formulas for E-CC for these different cases are proposed. Finally we have considered an example in Java and based on its ECFG, applied these cases to arrive at the E-CC of the total system as well as proposed a methodology for calculating the basis set, i.e., the set of independent paths for the OO system that will help in creation of test cases for code testing.展开更多
So far,the acyclic hypergraph has two different definitions.One is based on the cyclomatic number of the hypergraph,whereas the other arises from the acyclic schema of the relational database in the computer science.I...So far,the acyclic hypergraph has two different definitions.One is based on the cyclomatic number of the hypergraph,whereas the other arises from the acyclic schema of the relational database in the computer science.In this paper,it is first proved that these two definitions coincide with each other completely.Then we prove that a hypergraph H is not acyclic,or cyclic,if and only if it contains a special partial hypergraph named hypercircuit.In addition,we show that H has l(H)different hypercircuits,where l(H)is a parameter used to decide whether H is acyclic or cyclic.展开更多
文摘Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even substituting LOC for CC. However, from an empirical standpoint the relationship of CC to LOC is still an open one. We undertake the largest statistical study of this relationship to date. Employing modern regression techniques, we find the linearity of this relationship has been severely underestimated, so much so that CC can be said to have absolutely no explana-tory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear rela-tionship that holds across programmers, languages, code paradigms (procedural versus object-oriented), and software processes. Linear models are developed relating LOC and CC. These models are verified against over 1.2 million randomly selected source files from the SourceForge code repository. These files represent software projects from three target languages (C, C++, and Java) and a variety of programmer experience levels, software architectures, and de-velopment methodologies. The models developed are found to successfully predict roughly 90% of CC’s variance by LOC alone. This suggest not only that the linear relationship between LOC and CC is stable, but the aspects of code complexity that CC measures, such as the size of the test case space, grow linearly with source code size across lan-guages and programming paradigms.
基金This work was supported by the National Natural Science Foundation of China(No.11171273)The authors would like to express their sincere gratitude to the anonymous referees for their comments and remarks,which improved the presentation of this paper.
文摘The Wiener index W(G)of a graph G is a distance-based topological index defined as the sum of distances between all pairs of vertices in G.It is shown that forλ=2 there is an infinite family of planar bipartite chemical graphs G of girth 4 with the cyclomatic numberλ,but their line graphs are not chemical graphs,and forλ≥2 there are two infinite families of planar nonbipartite graphs G of girth 3 with the cyclomatic numberλ;the three classes of graphs have the property W(G)=W(L(G)),where L(G)is the line graph of G.
文摘Tile basic features of object-oriented software makes it difficult to apply traditional testing methods in objectoriented systems. Control Flow Graph (CFG) is a well-known model used for identification of independent paths in procedural software. This paper highlights the problem of constructing CFG in object-oriented systems and proposes a new model named Extended Control Flow Graph (ECFG) for code based analysis of Object-Oriented (OO) software. ECFG is a layered CFG where nodes refer to methods rather than statements. A new metrics Extended Cyclomatic Complexity (E-CC) is developed which is analogous to McCabe's Cyclomatic Complexity (CC) and refers to the number of independent execution paths within the OO software. The different ways in which CFG's of individual methods are connected in an ECFG are presented and formulas for E-CC for these different cases are proposed. Finally we have considered an example in Java and based on its ECFG, applied these cases to arrive at the E-CC of the total system as well as proposed a methodology for calculating the basis set, i.e., the set of independent paths for the OO system that will help in creation of test cases for code testing.
基金supported by the National Natural Science Foundation of China(No.19831080).
文摘So far,the acyclic hypergraph has two different definitions.One is based on the cyclomatic number of the hypergraph,whereas the other arises from the acyclic schema of the relational database in the computer science.In this paper,it is first proved that these two definitions coincide with each other completely.Then we prove that a hypergraph H is not acyclic,or cyclic,if and only if it contains a special partial hypergraph named hypercircuit.In addition,we show that H has l(H)different hypercircuits,where l(H)is a parameter used to decide whether H is acyclic or cyclic.