---
library: "brainference"
slug: "SpectralEntropy"
name: "SpectralEntropy"
ref: "SpectralEntropy#d557"
hash: "sema:SpectralEntropy#mh:SHA-256:d557f8c3d693a0ee6c24c656efb113cf0fab9dabae8c60f5ba1ae076dbc6b79a"
type: "Primitives"
layer: "Infrastructure"
version: "1.0.0"
root: "8d7193fc97804cdc3aa9080728d8094732206c114f34d36b8ca2b89b943b3990"
license: null
url: "https://semahash.org/vocabularies/brainference/patterns/SpectralEntropy"
---

# SpectralEntropy

Entropy of a graph Laplacian's eigenvalues: the diversity of global flow and relaxation modes

Infrastructure · Primitives

## Mechanism

Build the graph Laplacian L. For an undirected graph L = D - A, with D the diagonal degree matrix and A the adjacency matrix. For a directed graph use the incidence matrix B (B_ie = +1 if edge e leaves node i, -1 if it enters, 0 otherwise) and L = B B^T. Take its eigenvalues lambda_i, normalise them to p_i = lambda_i / sum_j lambda_j, and compute H_s = -sum_i p_i log2 p_i, the [ShannonEntropy](https://semahash.org/vocabularies/brainference/patterns/ShannonEntropy.md) of the spectrum. Because the Laplacian governs diffusion, synchronisation and relaxation on the graph, H_s describes global structure: a spread-out spectrum (high H_s) means many distinct flow modes, a concentrated spectrum (low H_s) means regular, modular or tightly structured topology. It complements local measures such as [DegreeEntropy](https://semahash.org/vocabularies/brainference/patterns/DegreeEntropy.md).

## Invariants

- Uses the whole eigenvalue spectrum, so it reflects global rather than local structure
- Laplacian eigenvalues are non-negative, so the normalised spectrum is a valid distribution
- The zero eigenvalues (one per connected component) contribute nothing

## Failure modes

- Density domination: when the spectrum mostly tracks node or edge count, H_s scales almost perfectly with density and carries little else, so an excellent data collapse can be a trivial one
- Comparing spectra of graphs with different Laplacian definitions (combinatorial, normalised, incidence-based)
- Eigendecomposition cost on very large graphs

## Where this came from

- Thesis: do_2026_ant_collective_behavior (Ch. 1.2.1 Eq. 1.2; Ch. 1.3.3 Eqs. 1.8-1.9; Ch. 3.2.1 Eqs. 3.22-3.25; Ch. 4.2.3)

## Builds on

- [ShannonEntropy](https://semahash.org/vocabularies/brainference/patterns/ShannonEntropy.md) (references)
- [DegreeEntropy](https://semahash.org/vocabularies/brainference/patterns/DegreeEntropy.md) (composes_with)

## Used by

- [InteractionSequenceEntropySignature](https://semahash.org/vocabularies/brainference/patterns/InteractionSequenceEntropySignature.md) (references)
- [SecondOrderInteractionNetwork](https://semahash.org/vocabularies/brainference/patterns/SecondOrderInteractionNetwork.md) (composes_with)

## Identity

- Library: brainference 1.0.0 (root 8d7193fc9780)
- Ref: SpectralEntropy#d557
- Hash: sema:SpectralEntropy#mh:SHA-256:d557f8c3d693a0ee6c24c656efb113cf0fab9dabae8c60f5ba1ae076dbc6b79a

## Links

- Page: https://semahash.org/vocabularies/brainference/patterns/SpectralEntropy
- JSON: https://semahash.org/vocabularies/brainference/patterns/SpectralEntropy.json
- Library: https://semahash.org/vocabularies/brainference
- Library index: https://semahash.org/vocabularies/brainference/index.json
