% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{subgraph_centrality}
\alias{subgraph_centrality}
\title{Find subgraph centrality scores of network positions}
\usage{
subgraph_centrality(graph, diag = FALSE)
}
\arguments{
\item{graph}{The input graph. It will be treated as undirected.}

\item{diag}{Boolean scalar, whether to include the diagonal of the adjacency
matrix in the analysis. Giving \code{FALSE} here effectively eliminates the
loops edges from the graph before the calculation.}
}
\value{
A numeric vector, the subgraph centrality scores of the vertices.
}
\description{
Subgraph centrality of a vertex measures the number of subgraphs a vertex
participates in, weighting them according to their size.
}
\details{
The subgraph centrality of a vertex is defined as the number of closed walks
originating at the vertex, where longer walks are downweighted by the
factorial of their length.

Currently the calculation is performed by explicitly calculating all
eigenvalues and eigenvectors of the adjacency matrix of the graph. This
effectively means that the measure can only be calculated for small graphs.
}
\section{Related documentation in the C library}{
\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_is_directed}{\code{is_directed()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_get_adjacency}{\code{get_adjacency()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_get_adjacency_sparse}{\code{get_adjacency_sparse()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}}
}

\examples{

g <- sample_pa(100, m = 4, dir = FALSE)
sc <- subgraph_centrality(g)
cor(degree(g), sc)

}
\references{
Ernesto Estrada, Juan A. Rodriguez-Velazquez: Subgraph
centrality in Complex Networks. \emph{Physical Review E} 71, 056103 (2005).
}
\seealso{
\code{\link[=eigen_centrality]{eigen_centrality()}}, \code{\link[=page_rank]{page_rank()}}

Centrality measures
\code{\link{alpha_centrality}()},
\code{\link{authority_score}()},
\code{\link{betweenness}()},
\code{\link{closeness}()},
\code{\link{diversity}()},
\code{\link{eigen_centrality}()},
\code{\link{harmonic_centrality}()},
\code{\link{hits_scores}()},
\code{\link{page_rank}()},
\code{\link{power_centrality}()},
\code{\link{spectrum}()},
\code{\link{strength}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com} based on the Matlab
code by Ernesto Estrada
}
\concept{centrality}
\keyword{graphs}
