Learn R Programming

bnRep

The R package bnRep includes the largest repository of Bayesian networks, which were all collected from recent academic literature in a variety of fields! If you are using any Bayesian network from bnRep you should cite:

Leonelli, M. (2025). bnRep: A repository of Bayesian networks from the 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 to https://manueleleonelli.shinyapps.io/bnRep/ to explore the repository online!

Contribution

If you are interested in having your Bayesian network included in bnRep you must prepare three objects:

  • the Bayesian network as a bn.fit object (if not created with bnlearn you can always use import functions, such as read.bif());

  • an R file with the same name of the bn.fit object reporting the documentation of the Bayesian network;

  • a vector/excel file with the required details to include in the bnRep_summary object.

You can submit the required objects directly via github (e.g fork/pull), or via email.

If you struggle with any of these steps, please get in touch and I will try to help!

Overview

bnRep includes over 200 Bayesian networks from more than 150 academic publications. It includes discrete, Gaussian and conditional linear Gaussian Bayesian networks, all stored as appropriate bn.fit objects from bnlearn. They can be exported for use to other software (e.g. Phython libraries) using functions from bnlearn such as write.bif(). Recall that in order to plot the associated DAG, one must first convert it to a graph object with bn.net() from the bnlearn package.

Installation

# Install stable version from CRAN:
install.packages("bnRep")

# Or the development version from GitHub:
remotes::install_github("manueleleonelli/bnRep")

Usage

We will use the lawschool Bayesian network as an example. To load it in the environment simply call data(lawschool) and to then plot it (for instance using graphviz.plot from the bnlearn package)

library(bnRep)
library(bnlearn)
library(qgraph)
data("lawschool")
qgraph::qgraph(bn.net(lawschool))

Notice that the function bn.net function must be used in order to plot the network.

Exploring bnRep

bnRep includes two features to explore the Bayesian networks in the repository:

  • bnRep_summary: a dataframe with important details about each network in the repository.

  • bnRep_app: a Shiny app to interactively explore bnRep_summary and filter the networks according to various criteria. The app is also available online at https://manueleleonelli.shinyapps.io/bnRep/.

Here’s the columns of bnRep_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"

An overview of the Bayesian networks in bnRep

The following plots show some summary statistics of the repository.

Copy Link

Version

Install

install.packages('bnRep')

Monthly Downloads

315

Version

0.0.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Manuele Leonelli

Last Published

April 9th, 2025

Functions in bnRep (0.0.3)

agropastoral2

agropastoral Bayesian Networks
aircrash

aircrash Bayesian Network
agropastoral1

agropastoral Bayesian Networks
algalactivity1

algalactivity Bayesian Networks
algalactivity2

algalactivity Bayesian Networks
algal1

algal Bayesian Networks
agropastoral4

agropastoral Bayesian Networks
agropastoral3

agropastoral Bayesian Networks
agropastoral5

agropastoral Bayesian Networks
algal2

algal Bayesian Networks
algorithms1

algorithms Bayesian Networks
aspergillus

aspergillus Bayesian Network
algorithms4

algorithms Bayesian Networks
algorithms3

algorithms Bayesian Networks
argument

argument Bayesian Network
arcticwaters

arcticwaters Bayesian Network
asia

asia Bayesian Network
algorithms2

algorithms Bayesian Networks
algorithms5

algorithms Bayesian Networks
blockchain

blockchain Bayesian Network
algorithms6

algorithms Bayesian Networks
augmenting

augmenting Bayesian Network
bnRep

bnRep: A Repository of Bayesian Network Models
blacksea

blacksea Bayesian Network
bankruptcy

bankruptcy Bayesian Network
beatles

beatles Bayesian Network
beam2

beams Bayesian Network
bank

bank Bayesian Network
beam1

beams Bayesian Network
bnRep_app

Launch the Bayesian Network Viewer App
cardiovascular

cardiovascular Bayesian Network
case

case Bayesian Network
charleston

charleston Bayesian Network
cachexia1

cachexia Bayesian Networks
cachexia2

cachexia Bayesian Networks
bullet

bullet Bayesian Network
concrete2

concrete Bayesian Networks
catchment

catchment Bayesian Network
burglar

burglar Bayesian Network
concrete5

concrete Bayesian Networks
concrete1

concrete Bayesian Networks
compaction

compaction Bayesian Network
concrete6

concrete Bayesian Networks
concrete4

concrete Bayesian Networks
concrete3

concrete Bayesian Networks
building

building Bayesian Network
chds

chds Bayesian Network
bnRep_summary

BnRep Summary
conasense

conasense Bayesian Network
corical

corical Bayesian Network
corrosion

corrosion Bayesian Network
constructionproductivity

constructionproductivity Bayesian Network
coral3

coral Bayesian Networks
coral2

coral Bayesian Networks
cng

cng Bayesian Network
coral5

coral Bayesian Networks
coral4

coral Bayesian Networks
covid3

covid Bayesian Networks
consequenceCovid

consequenceCovid Bayesian Network
covidfear

covidfear Bayesian Network
crimescene

crimescene Bayesian Network
covidrisk

covidrisk Bayesian Network
criminal1

criminal Bayesian Networks
covidtech

covidtech Bayesian Network
coral1

coral Bayesian Networks
covid2

covid Bayesian Networks
concrete7

concrete Bayesian Networks
crypto

crypto Bayesian Network
criminal4

criminal Bayesian Networks
corticosteroid

corticosteroid Bayesian Network
criminal2

criminal Bayesian Networks
covid1

covid Bayesian Networks
curacao2

curacao Bayesian Networks
curacao5

curacao Bayesian Networks
disputed4

disputed Bayesian Networks
curacao1

curacao Bayesian Networks
darktriad

darktriad Bayesian Network
curacao4

curacao Bayesian Networks
covidtest

covidtest Bayesian Network
.onAttach

Message for the User
disputed1

disputed Bayesian Networks
criminal3

criminal Bayesian Networks
dioxins

dioxins Bayesian Network
dragline

dragline Bayesian Network
curacao3

curacao Bayesian Networks
diabetes

ciabetes Bayesian Network
drainage

drainage Bayesian Network
disputed3

disputed Bayesian Networks
estuary

estuary Bayesian Network
disputed2

disputed Bayesian Networks
engines

engines Bayesian Network
diagnosis

diagnosis Bayesian Network
expenditure

expenditure Bayesian Network
enrollment

enrollment Bayesian Network
ecosystem

ecosystem Bayesian Network
electricvehicle

electricvehicle Bayesian Network
flood

flood Bayesian Network
firerisk

firerisk Bayesian Network
fire

fire Bayesian Network
fingermarks2

fingermarks Bayesian Networks
fingermarks1

fingermarks Bayesian Networks
firealarm

firealarm Bayesian Network
earthquake

earthquake Bayesian Network
foodallergy1

foodallergy Bayesian Networks
foodallergy2

foodallergy Bayesian Networks
foodallergy3

foodallergy Bayesian Networks
fluids1

fluids Bayesian Networks
dustexplosion

dustexplosion Bayesian Network
fluids3

fluids Bayesian Networks
gasifier

gasifier Bayesian Network
get_network_list

Get the list of available Bayesian network files
gasexplosion

gasexplosion Bayesian Network
greencredit

greencredit Bayesian Network
fundraising

fundraising Bayesian Network
electrolysis

electrolysis Bayesian Network
foodsecurity

foodsecurity Bayesian Network
fluids2

fluids Bayesian Networks
grounding

grounding Bayesian Network
gonorrhoeae

gonorrhoeae Bayesian Network
intensification

intensification Bayesian Network
income

income Bayesian Network
kosterhavet

kosterhavet Bayesian Network
hydraulicsystem

hydraulicsystem Bayesian Network
lawschool

lawschool Bayesian Network
emergency

emergency Bayesian Network
intentionalattacks

intentionalattacks Bayesian Network
inverters

inverters Bayesian Network
humanitarian

humanitarian Bayesian Network
healthinsurance

healthinsurance Bayesian Network
megacities

megacities Bayesian Network
macrophytes

macrophytes Bayesian Network
load_network

Load a Bayesian network
liquidity

liquidity Bayesian Network
knowledge

knowledge Bayesian Network
lidar

lidar Bayesian Network
liquefaction

liquefaction Bayesian Network
lithium

lithium Bayesian Network
metal

metal Bayesian Network
lexical

lexical Bayesian Network
nuisancegrowth

nuisancegrowth Bayesian Network
oildepot

oildepot Bayesian Network
nanomaterials1

nanomaterial Bayesian Networks
moodstate

moodstate Bayesian Network
medicaltest

medicaltest Bayesian Network
onlinerisk

onlinerisk Bayesian Network
nuclearwaste

nuclearwaste Bayesian Network
nanomaterials2

nanomaterial Bayesian Networks
navigation

navigation Bayesian Network
orbital

orbital Bayesian Network
mountaingoat

mountaingoat Bayesian Network
perioperative

perioperative Bayesian Network
phdarticles

phdarticles Bayesian Network
pneumonia

pneumonia Bayesian Network
polymorphic

polymorphic Bayesian Network
permaBN

permaBN Bayesian Network
oxygen

oxygen Bayesian Network
poultry

poultry Bayesian Network
project

project Bayesian Network
parkinson

parkinson Bayesian Network
pilot

pilot Bayesian Network
rainstorm

rainstorm Bayesian Network
ricci

ricci Bayesian Network
projectmanagement

projectmanagement Bayesian Network
redmeat

redmeat Bayesian Network
propellant

propellant Bayesian Network
resilience

resilience Bayesian Network
softwarelogs1

softwarelogs Bayesian Networks
shipping

shipping Bayesian Network
ropesegment

ropesegment Bayesian Network
rockburst

rockburst Bayesian Network
simulation

simulation Bayesian Network
seismic

seismic Bayesian Network
safespeeds

safespeeds Bayesian Network
rainwater

rainwater Bayesian Network
sallyclark

sallyclark Bayesian Network
rockquality

rockquality Bayesian Network
salmonella2

salmonella Bayesian Networks
salmonella1

salmonella Bayesian Networks
softwarelogs2

softwarelogs Bayesian Networks
softwarelogs3

softwarelogs Bayesian Networks
soilliquefaction3

soilliquefaction Bayesian Networks
soil

soil Bayesian Network
soilliquefaction4

soilliquefaction Bayesian Networks
stocks

stocks Bayesian Network
student1

student Bayesian Networks
softwarelogs4

softwarelogs Bayesian Networks
soillead

soillead Bayesian Network
student2

student Bayesian Networks
soilliquefaction2

soilliquefaction Bayesian Networks
soilliquefaction1

soilliquefaction Bayesian Networks
theft2

theft Bayesian Networks
titanic

titanic Bayesian Network
transport

transport Bayesian Network
trajectories

trajectories Bayesian Network
tastingtea

tastingtea Bayesian Network
tbm

tbm Bayesian Network
turbine1

turbine Bayesian Networks
tubercolosis

tubercolosis Bayesian Network
theft1

theft Bayesian Networks
suffocation

suffocation Bayesian Network
wheat

wheat Bayesian Network
windturbine

windturbine Bayesian Network
vessel1

vessel Bayesian Networks
vessel2

vessel Bayesian Networks
twinframework

twinframework Bayesian Network
turbine2

turbine Bayesian Networks
waterlead

waterlead Bayesian Network
urinary

urinary Bayesian Network
vaccine

vaccine Bayesian Network
yangtze

yangtze Bayesian Network
witness

witness Bayesian Network
accidents

accidents Bayesian Network
GDIpathway1

GDIpathway Bayesian Networks
GDIpathway2

GDIpathway Bayesian Networks
BOPfailure2

BOPfailure Bayesian Networks
APSsystem

APSsystem Bayesian Network
aerialvehicles

aerialvehicles Bayesian Network
adversarialbehavior

adversarialbehavior Bayesian Network
adhd

adhd Bayesian Network
BOPfailure1

BOPfailure Bayesian Networks
BOPfailure3

BOPfailure Bayesian Networks