The R package softwareRisk leverages the network-like architecture of scientific models
together with software quality metrics to identify chains of function calls that are more
prone to generating and propagating errors. It operates on tbl_graph objects representing
call dependencies between functions (callers and callees) and computes risk scores for individual
functions and for paths (sequences of function calls) based on cyclomatic complexity, in-degree
and betweenness centrality. The package supports variance-based uncertainty and sensitivity analyses
to assess how risk scores change under alternative risk definitions.
Main features
- Automatic call-graph construction:
call_graph_fun()builds the graph (calls plus cyclomatic complexity) directly from an installedRpackage or a directory of.Rscripts;read_call_graph()imports and validates edge-list and complexity tables prepared with external tools for models in other languages. - Node and path risk scores:
all_paths_fun()scores every function and every entry-to-sink call path from cyclomatic complexity, in-degree and betweenness. - Intervention analysis:
node_exposure_fun()separates chokepoints from hotspots;path_fix_heatmap()andfix_portfolio_fun()show which fixes, and which sets of fixes under a budget, most reduce path risk. - Uncertainty and sensitivity analysis:
uncertainty_fun()propagates alternative risk definitions through the scores (viasensobol);rank_robustness_fun()reports how stable the top-k ranking is;sensitivity_plot_fun()shows which assumption drives the results. - Visualization:
plot_top_paths_fun(),path_uncertainty_plot(),rank_robustness_plot()and companions render the results with a publication-oriented theme.
Installation
To install the stable version on CRAN, use
install.packages("softwareRisk")To install the development version, use devtools:
install.packages("devtools") # if you have not installed devtools package already devtools::install_github("arnaldpuy/softwareRisk", build_vignettes = TRUE)
Usage
Please see the vignette for a walkthrough of the package utilities.
A printable PDF version of this vignette is also available here.
Citation
To cite softwareRisk in publications:
Puy A (2026). softwareRisk: Computation of node and path-level risk scores in scientific models. R package version 0.3.0, https://github.com/arnaldpuy/softwareRisk.
A BibTeX entry for LaTeX users is
@Manual{puy2026_softwareRisk, title = {softwareRisk: Computation of node and path-level risk scores in scientific models}, author = {Arnald Puy}, year = {2026}, note = {R package version 0.3.0}, url = {https://github.com/arnaldpuy/softwareRisk} }