
The R packagebnRep includes the largest repository ofBayesian networks, which were all collected from recent academicliterature in a variety of fields! If you are using any Bayesian networkfrombnRep you should cite:
Leonelli, M. (2025). bnRep: A repository of Bayesian networks fromthe academic literature. Neurocomputing, 624, 129502.
@Article{, title = {bn{R}ep: A repository of {B}ayesian networks from the academic literature}, author = {Manuele Leonelli}, journal = {Neurocomputing}, volume = {624}, year = {2025}, pages = {129502} }Go tohttps://manueleleonelli.shinyapps.io/bnRep/ to explorethe repository online!
If you are interested in having your Bayesian network included inbnRep you must prepare three objects:
the Bayesian network as abn.fit object (if notcreated withbnlearn you can always use import functions,such asread.bif());
an R file with the same name of thebn.fit objectreporting the documentation of the Bayesian network;
a vector/excel file with the required details to include in thebnRep_summary object.
You can submit the required objects directly via github (e.gfork/pull), or via email.
If you struggle with any of these steps, please get in touch and Iwill try to help!
bnRep includes over 200 Bayesian networks from more than150 academic publications. It includes discrete, Gaussian andconditional linear Gaussian Bayesian networks, all stored as appropriatebn.fit objects frombnlearn. They can beexported for use to other software (e.g. Phython libraries) usingfunctions frombnlearn such aswrite.bif().Recall that in order to plot the associated DAG, one must first convertit to a graph object withbn.net() from thebnlearn package.
# Install stable version from CRAN:install.packages("bnRep")# Or the development version from GitHub:remotes::install_github("manueleleonelli/bnRep")We will use thelawschool Bayesian network as anexample. To load it in the environment simply calldata(lawschool) and to then plot it (for instance usinggraphviz.plot from thebnlearn package)
library(bnRep)library(bnlearn)library(qgraph)data("lawschool")qgraph::qgraph(bn.net(lawschool))
Notice that the functionbn.net function must be used inorder to plot the network.
bnRep includes two features to explore the Bayesiannetworks in the repository:
bnRep_summary: a dataframe with important detailsabout each network in the repository.
bnRep_app: a Shiny app to interactively explorebnRep_summary and filter the networks according to variouscriteria. The app is also available online athttps://manueleleonelli.shinyapps.io/bnRep/.
Here’s the columns ofbnRep_summary:
#> [1] "Name" "Type" "Structure" #> [4] "Probabilities" "Graph" "Area" #> [7] "Nodes" "Arcs" "Parameters" #> [10] "Avg. Parents" "Max Parents" "Avg. Levels" #> [13] "Max Levels" "Average Markov Blanket" "Year" #> [16] "Journal" "Reference"The following plots show some summary statistics of therepository.
#> Warning: package 'ggplot2' was built under R version 4.3.3








