A complexity measure based on nesting level

Warren Harrison, Kenneth Magel

ACM SIGPLAN Notices · 1981 · 143 citations · 2 references

DOIFull text

Open access

Concepts

Abstract

For the past several years an accepted method of determining the complexity of computer programs has involved developing a direct graph, G=(V,E) which represents the flow of control of the program.The directed graph, G consists of a set of nodes, V which represent "blocks" of groups of code, and a set E, of edges which corresponds to the flow of control among the various nodes.The graph is usually restricted to having one initial node which is always executed first.In addition, each block has two properties:(i) No transfer occurs into the interior of the block from outside.(2) If the first statement of the block is executed, all the statements of the block are executed.McCabe [3] has published one method which has been widely accepted.His method requires the calculation of the number of basic paths within the program the smallest set of paths that, when taken in combination may serve to generate every possible path in the graph.This is calculated as the cyclomatic number, V(G), using the following formula: V(G) = e -n + 2 where e represents the number of edges, and n represents the number of nodes in the control flow graph.

References

2