% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/clustering.R
\name{getClustering}
\alias{getClustering}
\title{Get clustering results for the graph.}
\usage{
getClustering(
  gg,
  alg = c("lec", "wt", "fc", "infomap", "louvain", "sgG1", "sgG2", "sgG5", "spectral")
)
}
\arguments{
\item{gg}{igraph object to cluster}

\item{alg}{clustering algorithm name}
}
\value{
\code{\link[igraph]{communities}} object or NULL if algorithm failed.
}
\description{
Wrapper function for calculation of clustering for predefined set of ten
algorithms:
\itemize{
\item lec -- leading eigenvector community (version of
\code{\link[igraph]{leading.eigenvector.community}});
\item wt -- walktrap community \code{\link[igraph]{walktrap.community}};
\item fc -- fastgreedy community \code{\link[igraph]{fastgreedy.community}};
\item infomap -- infomap community \code{\link[igraph]{cluster_infomap}};
\item louvain -- cluster_louvain \code{\link[igraph]{cluster_louvain}};
\item sgG1 -- spin-glass model and simulated annealing clustering (version of
\code{\link[igraph]{spinglass.community}} with spins=500 and gamma=1);
\item sgG2 -- spin-glass model and simulated annealing clustering (version of
\code{\link[igraph]{spinglass.community}} with spins=500 and gamma=2);
\item sgG5 -- spin-glass model and simulated annealing clustering (version of
\code{\link[igraph]{spinglass.community}} with spins=500 and gamma=7);
\item spectral -- spectral modularity clustering
\code{\link[rSpectral]{spectral_igraph_communities}};
}
}
\details{
graph suppose to be undirected. If algorithm failed warning will be issued
and function returned NULL.

Algorithm names are verified with \code{\link[base]{match.arg}}.
}
\examples{
data(karate,package='igraphdata')
c<-getClustering(karate,'lec')
c$modularity
}
