% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/edgelist.R
\name{mat_to_edgelist}
\alias{mat_to_edgelist}
\title{Convert a sparse square matrix to a tidy edge list}
\usage{
mat_to_edgelist(A, directed = FALSE)
}
\arguments{
\item{A}{A square sparse or dense matrix.}

\item{directed}{Logical. If \code{FALSE} (default), returns only upper-triangle
entries. If \code{TRUE}, returns all non-zero off-diagonal entries.}
}
\value{
A data frame with columns \code{from}, \code{to}, \code{weight}, sorted by
descending weight.
}
\description{
Extracts non-zero entries directly from the sparse representation —
no dense matrix allocation. For undirected networks, only the upper
triangle is returned.
}
\keyword{internal}
