% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/communities.R
\name{community_spinglass}
\alias{community_spinglass}
\alias{com_sg}
\title{Spinglass Community Detection}
\usage{
community_spinglass(
  x,
  weights = NULL,
  vertex = NULL,
  spins = 25,
  parupdate = FALSE,
  start.temp = 1,
  stop.temp = 0.01,
  cool.fact = 0.99,
  update.rule = c("config", "random", "simple"),
  gamma = 1,
  implementation = c("orig", "neg"),
  gamma.minus = 1,
  seed = NULL,
  ...
)

com_sg(
  x,
  weights = NULL,
  vertex = NULL,
  spins = 25,
  parupdate = FALSE,
  start.temp = 1,
  stop.temp = 0.01,
  cool.fact = 0.99,
  update.rule = c("config", "random", "simple"),
  gamma = 1,
  implementation = c("orig", "neg"),
  gamma.minus = 1,
  seed = NULL,
  ...
)
}
\arguments{
\item{x}{Network input}

\item{weights}{Edge weights. NULL uses network weights, NA for unweighted.}

\item{vertex}{Vertex to find community for (single community mode).
NULL for full partitioning.}

\item{spins}{Number of spins (maximum communities). Default 25.}

\item{parupdate}{Parallel update mode. Default FALSE.}

\item{start.temp}{Starting temperature. Default 1.}

\item{stop.temp}{Stopping temperature. Default 0.01.}

\item{cool.fact}{Cooling factor. Default 0.99.}

\item{update.rule}{Update rule: "config" (default), "random", or "simple".}

\item{gamma}{Gamma parameter for modularity. Default 1.}

\item{implementation}{"orig" (default) or "neg" (for negative weights).}

\item{gamma.minus}{Gamma for negative weights in "neg" implementation.}

\item{seed}{Random seed for reproducibility. Default NULL.}

\item{...}{Additional arguments passed to \code{\link{to_igraph}}}
}
\value{
A \code{cograph_communities} object

A \code{cograph_communities} object. See \code{\link{detect_communities}}.
}
\description{
Statistical mechanics approach using simulated annealing.
Can handle negative edge weights.
}
\examples{
\dontshow{if (requireNamespace("igraph", quietly = TRUE)) withAutoprint(\{ # examplesIf}
g <- igraph::make_graph("Zachary")
comm <- community_spinglass(g)
membership(comm)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("igraph", quietly = TRUE)) withAutoprint(\{ # examplesIf}
net <- as_cograph(matrix(runif(25), 5, 5))
com_sg(net)
\dontshow{\}) # examplesIf}
}
\references{
Reichardt, J., & Bornholdt, S. (2006).
Statistical mechanics of community detection.
\emph{Physical Review E}, 74, 016110.
}
