% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scAI_model.R
\name{runLeiden}
\alias{runLeiden}
\title{Run Leiden clustering algorithm
This code is modified from Tom Kelly (https://github.com/TomKellyGenetics/leiden), where we added more parameters (seed.use and n.iter) to run the Python version. In addition, we also take care of the singleton issue after running leiden algorithm.}
\usage{
runLeiden(SNN = matrix(), resolution = 1,
partition_type = c("RBConfigurationVertexPartition",
"ModularityVertexPartition", "RBERVertexPartition", "CPMVertexPartition",
"MutableVertexPartition", "SignificanceVertexPartition",
"SurpriseVertexPartition"), seed.use = 42L, n.iter = 10L,
initial.membership = NULL, weights = NULL, node.sizes = NULL)
}
\arguments{
\item{SNN}{An adjacency matrix compatible with \code{\link[igraph]{igraph}} object.}
\item{resolution}{A parameter controlling the coarseness of the clusters}
\item{partition_type}{Type of partition to use. Defaults to RBConfigurationVertexPartition. Options include: ModularityVertexPartition, RBERVertexPartition, CPMVertexPartition, MutableVertexPartition, SignificanceVertexPartition, SurpriseVertexPartition (see the Leiden python module documentation for more details)}
\item{seed.use}{set seed}
\item{n.iter}{number of iteration}
\item{initial.membership}{arameters to pass to the Python leidenalg function defaults initial_membership=None}
\item{weights}{defaults weights=None}
\item{node.sizes}{Parameters to pass to the Python leidenalg function}
}
\value{
A parition of clusters as a vector of integers
}
\description{
Implements the Leiden clustering algorithm in R using reticulate to run the Python version. Requires the python "leidenalg" and "igraph" modules to be installed. Returns a vector of partition indices.
}
\keyword{graph}
\keyword{igraph}
\keyword{mvtnorm}
\keyword{network}
\keyword{simulation}