export(
  # constraint-based structure learning algorithms.
  "gs", "iamb", "inter.iamb", "fast.iamb", "iamb.fdr", "mmpc", "si.hiton.pc",
  "pc.stable", "hpc",
  # local structure learning algorithms.
  "chow.liu", "aracne",
  # score-based structure learning algorithms.
  "hc", "tabu", "structural.em",
  # hybrid structure learning algorithms.
  "rsmax2", "mmhc", "h2pc",
  # learning neighbours and Markov blankets.
  "learn.mb", "learn.nbr",
  # Bayesian network classifiers.
  "naive.bayes", "tree.bayes",
  # causal discovery algorithms.
  "direct.lingam",
  # whitelists and blacklists.
  "whitelist", "blacklist", "ordering2blacklist", "tiers2blacklist",
  "set2blacklist",
  # functions to compare network structures.
  "compare", "hamming", "shd", "sid",
  # get neighbours and Markov blankets.
  "mb", "nbr",
  # get, set and count arcs and edges; add nodes.
  "arcs", "arcs<-", "directed.arcs", "undirected.arcs", "incoming.arcs",
  "outgoing.arcs", "incident.arcs", "compelled.arcs", "reversible.arcs",
  "narcs", "in.degree", "out.degree", "set.arc", "drop.arc", "reverse.arc",
  "set.edge", "drop.edge", "add.node", "remove.node", "rename.nodes",
  # get, set and count sets of nodes: parents, children, etc.
  "parents", "parents<-", "children", "children<-", "spouses", "ancestors",
  "descendants", "root.nodes", "leaf.nodes", "isolated.nodes", "nnodes",
  # get and set adjacency matrices and arc lists.
  "amat", "amat<-", "alst", "alst<-",
  # model string formulas.
  "modelstring", "modelstring<-", "model2network",
  # arc strength and model averaging.
  "arc.strength", "boot.strength", "bf.strength", "custom.strength",
  "averaged.network", "inclusion.threshold",
  # networks scores and conditional independence tests.
  "alpha.star", "BF", "ci.test",
  # resampling and Bayesian networks.
  "bn.boot", "bn.cv", "loss",
  # notable network structure transforms.
  "skeleton", "pdag2dag", "cpdag", "cextend", "moral", "mutilated", "twin",
  # v-structures and d-separation.
  "vstructs", "dsep", "colliders", "unshielded.colliders", "shielded.colliders", 
  # plotting network structures.
  "graphviz.plot", "strength.plot", "graphviz.compare", "graphviz.chart",
  # fitted Bayesian networks.
  "bn.fit", "custom.fit", "bn.net", "gbn2mvnorm", "mvnorm2gbn",
  # plotting fitted Bayesian networks.
  "bn.fit.qqplot", "bn.fit.histogram", "bn.fit.xyplot", "bn.fit.barchart",
  "bn.fit.dotplot",
  # simulation facilities.
  "empty.graph", "complete.graph", "random.graph", "cpdist", "rbn",
  # data preprocessing and imputation.
  "discretize", "dedup", "impute",
  # probabilistic inference.
  "H", "KL", "cpquery",
  # causal inference.
  "intervention", "counterfactual",
  # import/export functions for varous file formats.
  "read.bif", "write.bif", "read.dsc", "write.dsc", "read.net", "write.net",
  "write.dot",
  # utility functions to manipulate test/score counters.
  "test.counter", "increment.test.counter", "reset.test.counter",
  # assorted functions involving network structures.
  "acyclic", "directed", "valid.cpdag", "valid.dag", "valid.ug", "path.exists",
  "node.ordering", "subgraph", "perturb",
  # assorted functions involving fitted networks.
  "identifiable", "singular", 
  # assorted functions to extract information.
  "configs", "nparams", "ntests",
  # assorted conversion functions.
  "as.bn", "as.bn.fit", "as.scm", "as.grain", "as.graphNEL", "as.graphAM", 
  "as.igraph", "as.lm",
  # graph enumeration.
  "count.graphs", "cextend.all"
)

useDynLib(bnlearn, .registration = TRUE)

importFrom("methods", "new", "setClass", "setGeneric", "setMethod")
importFrom("stats", "logLik", "AIC", "BIC", "coefficients", "complete.cases",
  "cor", "dnorm", "ecdf", "fitted", "formula", "knots", "lm", 
  "optimize", "quantile", "residuals", "sd", "weighted.mean", "median", "qunif",
  "sigma", "relevel")
importFrom("grDevices", "col2rgb", "colors", "dev.cur")
importFrom("graphics", "abline", "arrows", "lines", "plot", "points",
  "strheight", "strwidth", "text", "plot.new", "title", "rect", "symbols")
importFrom("parallel", "parLapplyLB", "parSapplyLB", "clusterEvalQ")

S3method(as.bn, "fit")
S3method(as.bn, "scm")

S3method(all.equal, "bn")
S3method(all.equal, "bn.fit")
S3method(print, "bn")
S3method(plot, "bn")
S3method(plot, "bn.fit")
S3method(AIC, "bn")
S3method(AIC, "bn.fit")
S3method(BIC, "bn")
S3method(BIC, "bn.fit")
S3method(logLik, "bn")
S3method(logLik, "bn.fit")
S3method(as.bn, "character")
S3method(as.character, "bn")
S3method(as.grain, "bn.fit")
S3method(as.bn, "grain")
S3method(as.bn.fit, "grain")
S3method(as.bn, "pcAlgo")
S3method(as.graphNEL, "bn")
S3method(as.bn, "graphNEL")
S3method(as.graphNEL, "bn.fit")
S3method(as.graphAM, "bn")
S3method(as.bn, "graphAM")
S3method(as.graphAM, "bn.fit")
S3method(as.igraph, "bn")
S3method(as.igraph, "bn.fit")
S3method(as.bn, "igraph")
S3method(as.scm, "bn")
S3method(as.lm, "bn")
S3method(as.lm, "bn.fit")
S3method(as.lm, "bn.fit.gnode")
S3method(print, "scm")
S3method(print, "bn.tan")
S3method(print, "bn.fit")
S3method(print, "bn.fit.dnode")
S3method(print, "bn.fit.onode")
S3method(print, "bn.fit.gnode")
S3method(print, "bn.fit.cgnode")
S3method(print, "bn.fit.zihpnode")
S3method(print, "bn.fit.zinbnode")
S3method(residuals, "bn")
S3method(residuals, "bn.fit")
S3method(residuals, "bn.fit.dnode")
S3method(residuals, "bn.fit.onode")
S3method(residuals, "bn.fit.gnode")
S3method(residuals, "bn.fit.cgnode")
S3method(residuals, "bn.fit.zihpnode")
S3method(residuals, "bn.fit.zinbnode")
S3method(fitted, "bn")
S3method(fitted, "bn.fit")
S3method(fitted, "bn.fit.dnode")
S3method(fitted, "bn.fit.onode")
S3method(fitted, "bn.fit.gnode")
S3method(fitted, "bn.fit.cgnode")
S3method(fitted, "bn.fit.zihpnode")
S3method(fitted, "bn.fit.zinbnode")
S3method(sigma, "bn")
S3method(sigma, "bn.fit")
S3method(sigma, "bn.fit.dnode")
S3method(sigma, "bn.fit.onode")
S3method(sigma, "bn.fit.gnode")
S3method(sigma, "bn.fit.cgnode")
S3method(sigma, "bn.fit.zihpnode")
S3method(sigma, "bn.fit.zinbnode")
S3method(coef, "bn")
S3method(coef, "bn.fit")
S3method(coef, "bn.fit.dnode")
S3method(coef, "bn.fit.onode")
S3method(coef, "bn.fit.gnode")
S3method(coef, "bn.fit.cgnode")
S3method(coef, "bn.fit.zihpnode")
S3method(coef, "bn.fit.zinbnode")
S3method(print, "bn.kcv")
S3method(plot, "bn.kcv")
S3method(print, "bn.kcv.list")
S3method(plot, "bn.kcv.list")
S3method(plot, "bn.strength")
S3method(predict, "bn.fit")
S3method(predict, "bn.naive")
S3method(predict, "bn.tan")
S3method("$<-", "bn.fit")
S3method("[[<-", "bn.fit")
S3method(mean, "bn.strength")
S3method(mean, "bn.fit")

exportClasses("bn", "scm", "bn.fit")
exportMethods("nodes", "nodes<-", "degree", "score")
