# Cyclomatic complexity

Synchronization complexitycode complexitycomplexcomplexityCyclomatic ComplexitiesCyclomatic Complexity NumberMcCabe complexityMcCabe measuresMcCabe's cyclomatic complexity metricThomas McCabe
Cyclomatic complexity is a software metric used to indicate the complexity of a program.wikipedia
76 Related Articles

### Software metric

software metricsmetricmetrics
Cyclomatic complexity is a software metric used to indicate the complexity of a program.

### Programming complexity

complexitySoftware complexitycode complexity
Cyclomatic complexity is a software metric used to indicate the complexity of a program.

### Circuit rank

cyclomatic numbercyclotomic number
In this case, the graph is strongly connected, and the cyclomatic complexity of the program is equal to the cyclomatic number of its graph (also known as the first Betti number), which is defined as :M = E − N + P.
It counts the ears in an ear decomposition of the graph, forms the basis of parameterized complexity on almost-trees, and has been applied in software metrics as part of the definition of cyclomatic complexity of a piece of code.

### Code refactoring

refactoringrefactoredrefactor
(Nowadays such a process would fall under the umbrella term of refactoring.) McCabe's reduction method was later called condensation in some textbooks, because it was seen as a generalization of the condensation to components used in graph theory.
Advantages include improved code readability and reduced complexity; these can improve source-code maintainability and create a more expressive internal architecture or object model to improve extensibility.

### Betti number

Betti numbersPoincaré polynomialBettischen Zahlen
In this case, the graph is strongly connected, and the cyclomatic complexity of the program is equal to the cyclomatic number of its graph (also known as the first Betti number), which is defined as :M = E − N + P.
See cyclomatic complexity for an application to software engineering.

### Basis path testing

One testing strategy, called basis path testing by McCabe who first proposed it, is to test each linearly independent path through the program; in this case, the number of test cases will equal the cyclomatic complexity of the program.
The method normally uses McCabe' cyclomatic complexity to determine the number of linearly independent paths and then generates test cases for each path thus obtained.

### Control-flow graph

control flow graphcontrol flowCFG
Cyclomatic complexity is computed using the control flow graph of the program: the nodes of the graph correspond to indivisible groups of commands of a program, and a directed edge connects two nodes if the second command might be executed immediately after the first command. Mathematically, the cyclomatic complexity of a structured program is defined with reference to the control flow graph of the program, a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from the first to the second.

### Essential complexity

Essential complexity (numerical measure of "structuredness")
McCabe called the measure he devised for this purpose essential complexity.
Essential complexity is a numerical measure defined by Thomas J. McCabe, Sr., in his highly cited, 1976 paper better known for introducing cyclomatic complexity.

### Structured program theorem

Böhm-Jacopini canonical structures
(For details on that part see structured program theorem.) McCabe concludes that section by proposing a numerical measure of how close to the structured programming ideal a given program is, i.e. its "structuredness" using McCabe's neologism.

### Code coverage

coveragebranch coveragecode coverage analysis

### Decision-to-decision path

DD-pathDecision to decision path

### Maintainability

maintainableMaintainability indexunmaintainable
The maintainability index is calculated with certain formulae from lines-of-code measures, McCabe measures and Halstead complexity measures.

### Source code

codesourcesource file
It is a quantitative measure of the number of linearly independent paths through a program's source code. The cyclomatic complexity of a section of source code is the number of linearly independent paths within it.

### Graph (discrete mathematics)

graphundirected graphgraphs
Cyclomatic complexity is computed using the control flow graph of the program: the nodes of the graph correspond to indivisible groups of commands of a program, and a directed edge connects two nodes if the second command might be executed immediately after the first command.

### Directed graph

directed edgedirecteddigraph
Cyclomatic complexity is computed using the control flow graph of the program: the nodes of the graph correspond to indivisible groups of commands of a program, and a directed edge connects two nodes if the second command might be executed immediately after the first command. Mathematically, the cyclomatic complexity of a structured program is defined with reference to the control flow graph of the program, a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from the first to the second.

### Subroutine

functionfunctionssubroutines
Cyclomatic complexity may also be applied to individual functions, modules, methods or classes within a program.

### Modular programming

modulesmodularmodule
Cyclomatic complexity may also be applied to individual functions, modules, methods or classes within a program.

### Method (computer programming)

methodsmethodabstract method
Cyclomatic complexity may also be applied to individual functions, modules, methods or classes within a program.

### Class (computer programming)

classclassesPartial class
Cyclomatic complexity may also be applied to individual functions, modules, methods or classes within a program.

### Software testing

beta testingtestingbeta
One testing strategy, called basis path testing by McCabe who first proposed it, is to test each linearly independent path through the program; in this case, the number of test cases will equal the cyclomatic complexity of the program.

### Control flow

looploopscontrol structure
The cyclomatic complexity of a section of source code is the number of linearly independent paths within it.

### Structured programming

structuredProgram structurestructured program
Mathematically, the cyclomatic complexity of a structured program is defined with reference to the control flow graph of the program, a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from the first to the second.

### Basic block

basic blocksnode
Mathematically, the cyclomatic complexity of a structured program is defined with reference to the control flow graph of the program, a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from the first to the second.