% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/network-summary.R
\name{degree_distribution}
\alias{degree_distribution}
\title{Degree Distribution Visualization}
\usage{
degree_distribution(
  x,
  mode = "all",
  directed = NULL,
  loops = TRUE,
  simplify = "sum",
  cumulative = FALSE,
  main = "Degree Distribution",
  xlab = "Degree",
  ylab = "Frequency",
  col = "steelblue",
  ...
)
}
\arguments{
\item{x}{Network input: matrix, igraph, network, cograph_network, or tna object}

\item{mode}{For directed networks: "all", "in", or "out". Default "all".}

\item{directed}{Logical or NULL. If NULL (default), auto-detect from matrix
symmetry. Set TRUE to force directed, FALSE to force undirected.}

\item{loops}{Logical. If TRUE (default), keep self-loops. Set FALSE to remove them.}

\item{simplify}{How to combine multiple edges between the same node pair.
Options: "sum" (default), "mean", "max", "min", or FALSE/"none" to keep
multiple edges.}

\item{cumulative}{Logical. If TRUE, show cumulative distribution instead of
frequency distribution. Default FALSE.}

\item{main}{Character. Plot title. Default "Degree Distribution".}

\item{xlab}{Character. X-axis label. Default "Degree".}

\item{ylab}{Character. Y-axis label. Default "Frequency" (or "Cumulative
Frequency" if cumulative = TRUE).}

\item{col}{Character. Bar fill color. Default "steelblue".}

\item{...}{Additional arguments passed to \code{\link[graphics]{hist}}.}
}
\value{
Invisibly returns the histogram object from \code{graphics::hist()}.
}
\description{
Creates a histogram showing the degree distribution of a network.
Useful for understanding the connectivity patterns and identifying
whether a network follows particular degree distributions (e.g.,
power-law, normal).
}
\examples{
# Basic usage
adj <- matrix(c(0, 1, 1, 0,
                1, 0, 1, 1,
                1, 1, 0, 1,
                0, 1, 1, 0), 4, 4, byrow = TRUE)
cograph::degree_distribution(adj)

# Cumulative distribution
cograph::degree_distribution(adj, cumulative = TRUE)

# For directed networks
directed_adj <- matrix(c(0, 1, 0, 0,
                         0, 0, 1, 0,
                         1, 0, 0, 1,
                         0, 1, 0, 0), 4, 4, byrow = TRUE)
cograph::degree_distribution(directed_adj, mode = "in",
  main = "In-Degree Distribution")

# With igraph
if (requireNamespace("igraph", quietly = TRUE)) {
  g <- igraph::erdos.renyi.game(100, 0.1)
  cograph::degree_distribution(g, col = "coral")
}
}
