---
date: '2024-12-01'
description: cyclomatic complexity as proxy metric for software complexity, derived from control-flow graphs, and lehman's laws of software evolution.
id: Complexity
modified: 2026-06-05 15:08:05 GMT-04:00
tags:
  - seed
title: Complexity
created: '2024-12-01'
published: '2024-12-01'
pageLayout: default
slug: thoughts/Complexity
permalink: https://aarnphm.xyz/thoughts/Complexity.md
generator:
  quartz: v4.6.0
  hostedProvider: Cloudflare
  baseUrl: aarnphm.xyz
full: https://aarnphm.xyz/llms-full.txt
---
papers: [[thoughts/papers/Out of the Tar Pit, Moseley.pdf|Out of the Tar Pit, B. Moseley]]

## Cyclometric

> A proxy metric for complexity

Think of it as a structured programs defined with references to control-flow graph with an <mark>edge: if control may pass from first to second</mark>

> \[!math\] 1. complexity `M`
>
> defined as follows:
>
> $$
> \begin{aligned}
> \mathbb{M} &= \mathbb{M} - \mathbb{N} + 2 \mathbb{P} \\[8pt]
> &\because \mathbb{E} = \text{number of edges in the graph} \\
> &\quad \space \mathbb{N} = \text{number of nodes in the graph} \\
> &\quad \space \mathbb{P} = \text{number of connected components}
> \end{aligned}
> $$

## Law of Software Evolution

see also: [[thoughts/papers/Programs, Life Cycles, and Laws of Software Evolution - Lehman.pdf|paper]]

