% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/converters.R
\name{to_cograph}
\alias{to_cograph}
\title{Prepare network for cograph::splot()}
\usage{
to_cograph(edges, nodes = NULL, directed = FALSE)
}
\arguments{
\item{edges}{A data frame with at least \code{from}, \code{to}, \code{weight} columns.}

\item{nodes}{Optional data frame of node attributes with an \code{id} column
(e.g., output of \code{\link[=local_citations]{local_citations()}}). All columns are merged into the
\code{cograph_network$nodes} table and become available as aesthetic mappings.}

\item{directed}{Logical. Default \code{FALSE}.}
}
\value{
A \code{cograph_network} object (S3 list with \verb{$nodes} and \verb{$edges}).
}
\description{
Converts a bibnets edge list to a \code{cograph_network} object by calling
\code{cograph::as_cograph()}. Optionally merges node metadata (e.g., from
\code{\link[=local_citations]{local_citations()}}) into the network's node table so attributes like
\code{lcs} or \code{year} can be used directly in \code{splot()} aesthetic parameters
(e.g., \code{node_size = "lcs"}).
}
\details{
Note: bibnets edge lists (\code{from}, \code{to}, \code{weight}) are accepted directly
by \code{cograph::splot()} without conversion. This function is only needed
when you want to attach node-level metadata.
}
\examples{
\dontshow{if (requireNamespace("cograph", quietly = TRUE)) withAutoprint(\{ # examplesIf}
data(biblio_data)

# Without metadata: splot() accepts bibnets edges directly
edges <- author_network(biblio_data, "collaboration")

# With metadata: document network + local citation scores as node size
edges <- document_network(biblio_data, type = "coupling")
nodes <- local_citations(biblio_data)   # keyed by document id
net   <- to_cograph(edges, nodes = nodes)
\dontshow{\}) # examplesIf}
}
