HyperAI

Cyclomatic Complexity

Cyclomatic Complexity is a software metric proposed by Thomas J. McCabe Sr. in 1976 to measure the complexity of a program.A Complexity Measure". This paper was published in IEEE Transactions on Software Engineering and is a classic in the field of software engineering. In the paper, McCabe defined the calculation method of cyclomatic complexity, namely the famous formula V(G) = E – N + 2P, where E is the number of edges, N is the number of nodes, and P is the number of connected components of the program. The introduction of cyclomatic complexity provides an important theoretical basis for software testing and maintenance. It can be used to evaluate the complexity of the program, guide the design of test cases, predict the defect tendency of software, and evaluate the maintainability of software.