% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/document-network.R
\name{document_network}
\alias{document_network}
\title{Build a document network}
\usage{
document_network(
  data,
  type = "coupling",
  counting = "full",
  similarity = "none",
  threshold = 0,
  min_occur = 1L,
  top_n = NULL,
  self_loops = FALSE,
  deduplicate = TRUE,
  format = "edgelist"
)
}
\arguments{
\item{data}{A data frame with \code{id} and \code{references} (list-column).}

\item{type}{Character. Relationship type:
\describe{
\item{\code{"coupling"}}{Bibliographic coupling: documents linked when they
share cited references.}
\item{\code{"citation"}}{Direct citation: directed edges from citing to
cited documents (internal citations only).}
\item{\code{"co_citation"}}{Co-citation: documents linked when they are
cited together by other documents in the dataset.}
\item{\code{"equivalence"}}{Profile similarity of reference vectors.}
}}

\item{counting}{Character. Counting method. Default \code{"full"}.
Position-dependent methods are not applicable to document networks.}

\item{similarity}{Character. Similarity measure. Default \code{"none"}.}

\item{threshold}{Numeric. Minimum edge weight. Default 0.}

\item{min_occur}{Integer. Minimum reference frequency. Default 1.}

\item{top_n}{Integer or NULL. Return only the top n edges by weight.
Default NULL (all edges).}

\item{self_loops}{Logical. If \code{TRUE}, include self-loops (an entity linked
to itself). Default \code{FALSE}.}

\item{deduplicate}{Logical. If \code{TRUE} (default), each \verb{(paper, entity)}
pair is counted at most once — duplicate entries in the source data
(e.g., the same author listed twice on a paper) are treated as one
occurrence. Set to \code{FALSE} to count every raw occurrence.}

\item{format}{Character. Output format:
\describe{
\item{\code{"edgelist"}}{Default. A \code{bibnets_network} data frame with
columns \code{from}, \code{to}, \code{weight}, \code{count}.}
\item{\code{"gephi"}}{Gephi-ready data frame: \code{Source}, \code{Target},
\code{Weight}, \code{Count}, \code{Type}.}
\item{\code{"igraph"}}{An igraph graph object (requires igraph).}
\item{\code{"cograph"}}{A cograph_network object (requires cograph).}
\item{\code{"matrix"}}{A sparse adjacency matrix.}
}}
}
\value{
Depends on \code{format}. For \code{type = "citation"}, edges are directed
(from = citing, to = cited) with \code{weight} and \code{count} both 1.
}
\description{
Constructs a network between documents (papers) in the dataset.
}
\examples{
data(biblio_data)
document_network(biblio_data, "coupling")
document_network(biblio_data, "coupling", counting = "strength")
}
