% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prune.R
\name{net_prune}
\alias{net_prune}
\alias{net_prune.netobject}
\alias{net_prune.netobject_group}
\alias{net_prune.default}
\title{Prune a Network's Edges}
\usage{
net_prune(
  x,
  method = "threshold",
  threshold = 0.1,
  lowest = 0.05,
  level = 0.5,
  boot = NULL,
  ...
)

\method{net_prune}{netobject}(
  x,
  method = "threshold",
  threshold = 0.1,
  lowest = 0.05,
  level = 0.5,
  boot = NULL,
  ...
)

\method{net_prune}{netobject_group}(
  x,
  method = "threshold",
  threshold = 0.1,
  lowest = 0.05,
  level = 0.5,
  boot = NULL,
  ...
)

\method{net_prune}{default}(
  x,
  method = "threshold",
  threshold = 0.1,
  lowest = 0.05,
  level = 0.5,
  boot = NULL,
  ...
)
}
\arguments{
\item{x}{A \code{netobject} or \code{netobject_group}.}

\item{method}{One of \code{"threshold"}, \code{"lowest"},
\code{"disparity"}, \code{"bootstrap"}. Default \code{"threshold"}.}

\item{threshold}{Numeric cut-off for \code{method = "threshold"}.
Default \code{0.1}.}

\item{lowest}{Quantile (0-1) for \code{method = "lowest"}. Default
\code{0.05}.}

\item{level}{Significance level (0-1) for \code{method = "disparity"}.
Default \code{0.5}.}

\item{boot}{Optional precomputed \code{net_bootstrap} for
\code{method = "bootstrap"}.}

\item{...}{Passed to \code{\link{bootstrap_network}} when
\code{method = "bootstrap"}.}
}
\value{
The input network (or group) with pruned \code{$weights} and a
\code{"pruning"} attribute. Class is unchanged.
}
\description{
Removes weak or non-significant edges from a network, keeping a record so
the operation can be reversed. This is Nestimate's counterpart of
\code{tna::prune()}; the \code{net_} prefix avoids a name clash with
\code{tna::prune()}.
}
\details{
Pruning is non-destructive: the pruned network carries a \code{"pruning"}
attribute holding the original weights, the pruned weights, the parameters
used, and a tidy table of removed edges. Use \code{\link{net_deprune}} to
restore the original weights and \code{\link{net_reprune}} to re-apply the
pruning, both without recomputation. \code{\link{net_pruning_details}}
reports what was removed.

Methods:
\describe{
\item{\code{"threshold"}}{Remove edges with weight \eqn{\le}
\code{threshold}.}
\item{\code{"lowest"}}{Remove the lowest \code{lowest} quantile of
non-zero edges.}
\item{\code{"disparity"}}{Serrano disparity-filter backbone at
significance \code{level}.}
\item{\code{"bootstrap"}}{Remove edges deemed non-significant by
\code{\link{bootstrap_network}} (pass a precomputed result via
\code{boot}, or extra bootstrap arguments via \code{...}).}
}
For \code{"threshold"}, \code{"lowest"}, and \code{"disparity"} an edge is
dropped only when its removal leaves the network weakly connected.

Diagonal self-loops (self-transitions) are observed data: they are counted
equally when computing the cut-off but are never removed by any method.
(This is a deliberate divergence from \code{tna::prune()}, which prunes
self-loops like any other edge.)
}
\examples{
seqs <- data.frame(
  V1 = c("A","B","A","C","B"), V2 = c("B","C","B","A","C"),
  V3 = c("C","A","C","B","A"))
net    <- build_network(seqs, method = "relative")
pruned <- net_prune(net, method = "threshold", threshold = 0.2)
net_pruning_details(pruned)

}
\seealso{
\code{\link{net_deprune}}, \code{\link{net_reprune}},
\code{\link{net_pruning_details}}
}
