% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prune.R
\name{prune}
\alias{prune}
\title{Prune a weighted edge list}
\usage{
prune(edges, threshold = NULL, top_n = NULL)
}
\arguments{
\item{edges}{A data frame with at least columns \code{from}, \code{to}, and \code{weight}.}

\item{threshold}{Numeric. Keep only edges with \code{weight >= threshold}.}

\item{top_n}{Integer. For each node, keep only its \code{top_n} strongest edges.
An edge is kept if it is in the top \code{top_n} for \emph{either} endpoint.}
}
\value{
The filtered edge data frame (same columns as input).
}
\description{
Reduces a weighted edge list by removing weak or excess edges.
}
\examples{
edges <- data.frame(
  from   = c("A","A","A","B","B","C"),
  to     = c("B","C","D","C","D","D"),
  weight = c(5,  1,  2,  4,  1,  3)
)

# Keep only edges with weight >= 3
prune(edges, threshold = 3)

# Keep the 2 strongest edges per node
prune(edges, top_n = 2)
}
