% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/network-utils.R
\name{select_top_edges}
\alias{select_top_edges}
\title{Select Top N Edges}
\usage{
select_top_edges(
  x,
  n,
  by = "weight",
  ...,
  .keep_isolates = FALSE,
  keep_format = FALSE,
  directed = NULL
)
}
\arguments{
\item{x}{Network input.}

\item{n}{Integer. Number of top edges to select.}

\item{by}{Character. Metric for ranking. One of:
\code{"weight"}, \code{"abs_weight"}, \code{"edge_betweenness"}.
Default \code{"weight"}.}

\item{...}{Additional filter expressions.}

\item{.keep_isolates}{Keep nodes with no edges? Default FALSE.}

\item{keep_format}{Keep input format? Default FALSE.}

\item{directed}{Auto-detect if NULL.}
}
\value{
A cograph_network with the top N edges.
}
\description{
Select the top N edges ranked by weight or another metric.
}
\examples{
adj <- matrix(c(0, .5, .8, 0,
                .5, 0, .3, .6,
                .8, .3, 0, .4,
                 0, .6, .4, 0), 4, 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")

# Top 3 edges by weight
select_top_edges(adj, n = 3)

# Top 2 by edge betweenness
select_top_edges(adj, n = 2, by = "edge_betweenness")
}
\seealso{
\code{\link{select_edges}}, \code{\link{select_top}}
}
