% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-layout.R
\name{geom_network}
\alias{geom_network}
\title{Network (node-link) diagram}
\usage{
geom_network(
  mapping = NULL,
  data = NULL,
  node_size = NULL,
  edge_color = NULL,
  edge_width = NULL,
  label = TRUE,
  label_size = NULL,
  alpha = NULL,
  iterations = 200,
  seed = 1
)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Requires \code{x} (source node)
and \code{xend} (target node); optional \code{size} weights the edges.}

\item{node_size}{Node radius in px.}

\item{edge_color, edge_width}{Edge appearance.}

\item{label, label_size}{Node labels.}

\item{alpha}{Node opacity.}

\item{iterations}{Force-simulation steps; more is slower but tidier.}

\item{seed}{Random seed for the initial layout, so plots reproduce.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
Lays out a graph with a from-scratch Fruchterman-Reingold force
simulation (repulsion between all nodes, attraction along edges, with a
cooling schedule) and draws nodes and edges in one unified grammar —
node and edge aesthetics come from the same \code{aes()}.
}
\examples{
d <- data.frame(
  from = c("A", "A", "B", "C", "D", "E"),
  to = c("B", "C", "C", "D", "E", "A")
)
ggnext(d, aes(x = from, xend = to)) + geom_network() + theme_void()
}
