% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
\name{bootstrap_networks}
\alias{bootstrap_networks}
\title{Bootstrap network inference}
\usage{
bootstrap_networks(
  data,
  n_bootstrap = 100L,
  k = 5L,
  cpus = 4L,
  use_mrnet = TRUE,
  save_path = NULL
)
}
\arguments{
\item{data}{A numeric matrix or data.frame with observations (samples)
as rows and variables (MAGs) as columns.}

\item{n_bootstrap}{Integer; number of bootstrap iterations.}

\item{k}{Integer; kNN parameter for \code{\link[=compute_mi_matrix]{compute_mi_matrix()}}.}

\item{cpus}{Integer; number of parallel workers. For large datasets
(>1000 MAGs), consider using more CPUs (e.g. \code{cpus = 14L}).}

\item{use_mrnet}{Logical; if \code{TRUE} (default), applies MRNET to the MI
matrix for sparse edge selection. If \code{FALSE}, uses all pairwise MI
edges directly.}

\item{save_path}{Optional directory path. When non-\code{NULL}, each
bootstrap result is saved as an RDS file for recovery.}
}
\value{
A named list with elements \code{MRNET_1}, \code{dCor_1}, \code{MRNET_2},
\code{dCor_2}, etc.
}
\description{
Runs \code{n_bootstrap} bootstrap iterations in parallel using
\pkg{snowfall}. Each iteration resamples rows, computes MI and dCor
networks, and returns edge lists. Results are collected into a single
named list.
}
\examples{
small_mat <- matrix(rnorm(50), nrow = 10, ncol = 5,
                    dimnames = list(NULL, paste0("V", 1:5)))
res <- bootstrap_networks(small_mat, n_bootstrap = 2, k = 2L, cpus = 1)
names(res)[1:4]

}
