C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Cyclomatic ComplexityCyclomatic complexity is a software metric used to measure the complexity of a program. Thomas J. McCabe developed this metric in 1976.McCabe interprets a computer program as a set of a strongly connected directed graph. Nodes represent parts of the source code having no branches and arcs represent possible control flow transfers during program execution. The notion of program graph has been used for this measure, and it is used to measure and control the number of paths through a program. The complexity of a computer program can be correlated with the topological complexity of a graph. How to Calculate Cyclomatic Complexity?McCabe proposed the cyclomatic number, V (G) of graph theory as an indicator of software complexity. The cyclomatic number is equal to the number of linearly independent paths through a program in its graphs representation. For a program control graph G, cyclomatic number, V (G), is given as: V (G) = E - N + 2 * P E = The number of edges in graphs G N = The number of nodes in graphs G P = The number of connected components in graph G. Example:Properties of Cyclomatic complexity:Following are the properties of Cyclomatic complexity:
Next TopicCase Tools For Software Metrics
|