Software metrics

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. McCabe defined essential complexity as the cyclomatic complexity of the reduced CFG (control-flow graph) after iteratively replacing (reducing) all structured programming control structures, i.e. those having a single entry point and a single exit point (for example if-then-else and while loops) with placeholder single statements. McCabe's reduction process is intended to simulate the conceptual replacement of control structures (and actual statements they contain) with subroutine calls, hence the requirement for the control structures to have a single entry and a single exit point. (Nowadays a process like this would fall under the umbrella term of refactoring.) All structured programs evidently have an essential complexity of 1 as defined by McCabe because they can all be iteratively reduced to a single call to a top-level subroutine. As McCabe explains in his paper, his essential complexity metric was designed to provide a measure of how far off this ideal (of being completely structured) a given program was. Thus greater than 1 essential complexity numbers, which can only be obtained for non-structured programs, indicate that they are further away from the structured programming ideal. To avoid confusion between various notions of reducibility to structured programs, it's important to note that McCabe's paper briefly discusses and then operates in the context of a 1973 paper by S. Rao Kosaraju, which gave a refinement (or alternative view) of the structured program theorem. The seminal 1966 paper of Böhm and Jacopini showed that all programs can be [re]written using only structured programming constructs, (aka the D structures: sequence, if-then-else, and while-loop), however, in transforming a random program into a structured program additional variables may need to be introduced (and used in the tests) and some code may be duplicated. In their paper, Böhm and Jacopini conjectured, but did not prove that it was necessary to introduce such additional variables for certain kinds of non-structured programs in order to transform them into structured programs. An example of program (that we now know) does require such additional variables is a loop with two conditional exits inside it. In order to address the conjecture of Böhm and Jacopini, Kosaraju defined a more restrictive notion of program reduction than the Turing equivalence used by Böhm and Jacopini. Essentially, Kosaraju's notion of reduction imposes, besides the obvious requirement that the two programs must compute the same value (or not finish) given the same inputs, that the two programs must use the same primitive actions and predicates, the latter understood as expressions used in the conditionals. Because of these restrictions, Kosaraju's reduction does not allow the introduction of additional variables; assigning to these variables would create new primitive actions and testing their values would change the predicates used in the conditionals. Using this more restrictive notion of reduction, Kosaraju proved Böhm and Jacopini's conjecture, namely that a loop with two exits cannot be transformed into a structured program without introducing additional variables, but went further and proved that programs containing multi-level breaks (from loops) form a hierarchy, such that one can always find a program with multi-level breaks of depth n that cannot be reduced to a program of multi-level breaks with depth less than n, again without introducing additional variables. McCabe notes in his paper that in view of Kosaraju's results, he intended to find a way to capture the essential properties of non-structured programs in terms of their control-flow graphs. He proceeds by first identifying the control-flow graphs corresponding to the smallest non-structured programs (these include branching into a loop, branching out of a loop, and their if-then-else counterparts) which he uses to formulate a theorem analogous to Kuratowski's theorem, and thereafter he introduces his notion of essential complexity in order to give a scale answer ("measure of the structuredness of a program" in his words) rather than a yes/no answer to the question of whether a program's control-flow graph is structured or not. Finally, the notion of reduction used by McCabe to shrink the CFG is not the same as Kosaraju's notion of reducing flowcharts. The reduction defined on the CFG does not know or care about the program's inputs, it is simply a graph transformation. For example, the following C program fragment has an essential complexity of 1, because the inner if statement and the for can be reduced, i.e. it is a structured program. for (i = 0; i < 3; i++) { if (a[i] == 0) b[i] += 2; } The following C program fragment has an essential complexity of four; its CFG is irreducible. The program finds the first row of z which is all zero and puts that index in i; if there is none, it puts -1 in i. for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { if (z[i][j] != 0) goto non_zero; } goto found;non_zero: } i = -1;found: The idea of CFG reducibility by successive collapses of sub-graphs (ultimately to a single node for well-behaved CFGs) is also used in modern compiler optimization. However the notion from structured programming of single-entry and single-exit control structure is replaced with that of , which is defined as a "single-entry, multiple-exit loop, with only a single branch back to the entry from within it". The areas of the CFG that cannot be reduced to natural loops are called improper regions; these regions end up having a fairly simple definition: multiple-entry, strongly connected components of the CFG. The simplest improper region is thus a loop with two entry points. Multiple exits do not cause analysis problems in modern compilers. Improper regions (multiple-entries into loops) do cause additional difficulties in optimizing code. (Wikipedia).

Video thumbnail

What are complex numbers? | Essence of complex analysis #2

A complete guide to the basics of complex numbers. Feel free to pause and catch a breath if you feel like it - it's meant to be a crash course! Complex numbers are useful in basically all sorts of applications, because even in the real world, making things complex sometimes, oxymoronicall

From playlist Essence of complex analysis

Video thumbnail

Complexity and hyperoperations | Data Structures Math Foundations 174

We introduce the idea of the complexity of a natural number: a measure of how hard it is to actually write down an arithmetical expression that evaluates to that number. This notion does depend on a prior choice of arithmetical symbols that we decide upon, but the general features are surp

From playlist Math Foundations

Video thumbnail

The deep structure of the rational numbers | Real numbers and limits Math Foundations 95

The rational numbers deserve a lot of attention, as they are the heart of mathematics. I am hopeful that modern mathematics will (slowly) swing around to the crucial realization that a lot of things which are currently framed in terms of "real numbers" are more properly understood in terms

From playlist Math Foundations

Video thumbnail

Recursively Defined Sets - An Intro

Recursively defined sets are an important concept in mathematics, computer science, and other fields because they provide a framework for defining complex objects or structures in a simple, iterative way. By starting with a few basic objects and applying a set of rules repeatedly, we can g

From playlist All Things Recursive - with Math and CS Perspective

Video thumbnail

20 The identity element

Sets might contain an element that can be identified as an identity element under some binary operation. Performing the operation between the identity element and any arbitrary element in the set must result in the arbitrary element. An example is the identity element for the binary opera

From playlist Abstract algebra

Video thumbnail

What is the Fundamental theorem of Algebra, really? | Abstract Algebra Math Foundations 217

Here we give restatements of the Fundamental theorems of Algebra (I) and (II) that we critiqued in our last video, so that they are now at least meaningful and correct statements, at least to the best of our knowledge. The key is to abstain from any prior assumptions about our understandin

From playlist Math Foundations

Video thumbnail

Big O Notation: A Few Examples

This video is about Big O Notation: A Few Examples Time complexity is commonly estimated by counting the number of elementary operations (elementary operation = an operation that takes a fixed amount of time to preform) performed in the algorithm. Time complexity is classified by the nat

From playlist Computer Science and Software Engineering Theory with Briana

Video thumbnail

Algorithms Explained: Computational Complexity

An overview of computational complexity including the basics of big O notation and common time complexities with examples of each. Understanding computational complexity is vital to understanding algorithms and why certain constructions or implementations are better than others. Even if y

From playlist Algorithms Explained

Video thumbnail

Optional: Complexity - Applied Cryptography

This video is part of an online course, Applied Cryptography. Check out the course here: https://www.udacity.com/course/cs387.

From playlist Applied Cryptography

Video thumbnail

Jonathan Belcher: Bridge cohomology-a generalization of Hochschild and cyclic cohomologies

Talk by Jonathan Belcher in Global Noncommutative Geometry Seminar (Americas) http://www.math.wustl.edu/~xtang/NCG-... on August 12, 2020.

From playlist Global Noncommutative Geometry Seminar (Americas)

Video thumbnail

Complex Analysis: Casorati Weierstrass Theorem (Intro)

Today, we introduce essential singularities and outline the Casorati-Weierstrass theorem. The proof of the theorem will be in the next video.

From playlist Complex Analysis

Video thumbnail

Elia Fioravanti: Spaces of cubulations

CIRM VIRTUAL EVENT Recorded during the meeting"Virtual Geometric Group Theory conference " the May 27, 2020 by the Centre International de Rencontres Mathématiques (Marseille, France) Filmmaker: Guillaume Hennenfent Find this video and other talks given by worldwide mathematicians on CIRM

From playlist Virtual Conference

Video thumbnail

Jezus Gonzalez (6/25/17) Bedlewo: Topological complexity and the motion planning problem in robotics

Early this century Michael Farber introduced the concept of Topological Complexity (TC), a model to study the continuity instabilities in the motion planning problem in robotics. Farber’s model has captured much attention since then due to the rich algebraic topology properties encoded by

From playlist Applied Topology in Będlewo 2017

Video thumbnail

Žiga Virk (4/24/21): A counter-example to Hausmann's conjecture

Title: A counter-example to Hausmann's conjecture Abstract: In 1995 Jean-Claude Hausmann proved that a closed compact Riemannian manifold is homotopy equivalent to its Vietoris-Rips complex for small values of the scale parameter. He then conjectured that the connectivity of Vietoris-Rip

From playlist Vietoris-Rips Seminar

Video thumbnail

A Geometric Approach to Modeling and Analysis of Mixed-Dimensional and Multi-Continuum Materials

SIAM Geosciences Webinar Series Date and Time: Thursday, November 10, 2022 Speaker: Jan Martin Nordbotten, University of Bergen Abstract: Spatial differential operators such as gradient, curl and divergence enjoy deep connections which form the roots of several disparate fields in pure an

From playlist SIAM Geosciences Webinar Series

Video thumbnail

Akhil Mathew - Some recent advances in syntomic cohomology (3/3)

Bhatt-Morrow-Scholze have defined integral refinements $Z_p(i)$ of the syntomic cohomology of Fontaine-Messing and Kato. These objects arise as filtered Frobenius eigenspaces of absolute prismatic cohomology and should yield a theory of "p-adic étale motivic cohomology" -- for example, the

From playlist Franco-Asian Summer School on Arithmetic Geometry (CIRM)

Video thumbnail

Laurent Jacques/Valerio Cambareri: Small width, low distortions: quantized random projections of...

Laurent Jacques / Valerio Cambareri: Small width, low distortions: quantized random projections of low-complexity signal sets Abstract: Compressed sensing theory (CS) shows that a "signal" can be reconstructed from a few linear, and most often random, observations. Interestingly, this rec

From playlist HIM Lectures: Trimester Program "Mathematics of Signal Processing"

Video thumbnail

Michael Groechenig - Complex K-theory of Dual Hitchin Systems

Let G and G’ be Langlands dual reductive groups (e.g. SL(n) and PGL(n)). According to a theorem by Donagi-Pantev, the generic fibres of the moduli spaces of G-Higgs bundles and G’-Higgs bundles are dual abelian varieties and are therefore derived-equivalent. It is an interesting open probl

From playlist 2021 IHES Summer School - Enumerative Geometry, Physics and Representation Theory

Video thumbnail

The chaotic complexity of natural numbers | Data structures in Mathematics Math Foundations 175

This is a sobering and perhaps disorienting introduction to the fact that arithmetic with bigger numbers starts to look quite different from the familiar arithmetic that we do with the small numbers we are used to. The notion of complexity is key in our treatment of this. We talk about bot

From playlist Math Foundations

Video thumbnail

Jakob Hoydis - Recent Progress in End-to-End Learning for the Physical Layer

Abstract: End-to-end learning is one of the most promising applications of machine learning for the physical layer of communication systems. I will provide a tutorial introduction to the topic and will discuss recent results as well as future research direction. ––––––––––––––––––––––––

From playlist 2nd workshop Nokia-IHES / AI: what's next?

Related pages

Control-flow graph | Structured program theorem | Cyclomatic complexity | Kuratowski's theorem