Code quality and technical debt

Dependency graph density

Also known as Dependency graph density, Dependency graph density in software engineering

By WeavePublished 1 min read

Definition

A measure of how many dependency relationships exist relative to the possible relationships in a graph.

What it means

Dependency graph density describes how interconnected a selected set of components is. For a directed graph, the calculation must specify whether self-links, duplicate edges, optional dependencies, and direction are included. Higher density can mean more coordination paths, but it may also reflect deliberate modular reuse in a small system. The metric is most useful for comparing similar boundaries over time.

Example

A platform team tracks density for its service layer after splitting a monolith. If density rises while ownership boundaries multiply, the team investigates whether the split created more coupling than independence.

Limitations

Density alone cannot identify a harmful dependency. A graph with few edges can still contain one critical circular dependency, and a dense graph may be healthy when interfaces are stable. Keep the component set and extraction rules fixed before comparing values.

How to use the signal

Weave can help compare density changes with review effort, blocked time, and rework in the same repository. Use the graph tool for the calculation and Weave for surrounding engineering context rather than treating density as a built-in quality score.

How this relates to Weave

Weave can help compare density changes with review effort, blocked time, and rework in the same repository. Use the graph tool for the calculation and Weave for surrounding engineering context rather than treating density as a built-in quality score.

Explore Engineering intelligence

Sources and further reading

  1. SonarSource code metrics and analysis documentation