Propagation Cost is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Propagation Cost
API ID: PropagationCostLanguages: Any
Targets: Architectures, Project
The density of the visibility matrix as a percentage.
The paper (Baldwin, Carliss, Alan MacCormack, and John Rusnak. "Hidden structure: Using network methods to map system architecture." Research Policy 43.8 (2014): 1381-1397.) presents a way to classify projects based on dependencies. This metric is based on that paper.
Research
Dependency Matrices
Dependencies are first plotted in a matrix with files on the axis. If a file directly or indirectly depends on another file, the value at the matrix is true. The inclusion of indirect dependencies makes the matrix a "Visibility" matrix. The following metrics can be calculated from the matrix:
- Visible Fan In the number of files that directly or indrectly depend on the target file. This is the sum of the file's column.
- Visible Fan Out the number of files the target file directly or indrectly depends on. This is the sum of the file's row.
- Propagation Cost the density of the matrix expressed as a percentage. This is a measure of how hard it is to modify the project.
There are also versions of the above metrics that consider only direct dependencies: Direct Fan In, Direct Fan Out, and Direct Propagation Cost.
Project Classification
The authors found that plotting the Visible Fan In and Visible Fan Out values revealed a pattern.
The "Core" is the largest cyclical group in the project. There are metrics for the number and percentage of files in the core. The Visibility Matrix Cores architecture can be used to find all the cyclical groups in the project.
Most projects were "Core-Periphery" projects with a single core and periphery files. However, not all projects have a clear single core. "Hierarchical" projects have no core and "Multi-Core" projects have more than one. "Multi-Core" and "Hierarchical" projects are split into four groups using median visible fan metrics instead of the core's visible fan metrics. The Visibility Matrix architecture classifies the project and splits the files into the four groups.
See also the Project Quality solution and the blog article Dependency Networks with Understand ↗.