% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/network-summary.R
\name{group_centrality}
\alias{group_centrality}
\title{Group Centrality (Everett-Borgatti 1999)}
\usage{
group_centrality(
  x,
  nodes,
  measure = c("betweenness", "closeness", "degree"),
  mode = c("all", "out", "in"),
  normalized = TRUE
)
}
\arguments{
\item{x}{Network input (matrix, igraph, network, cograph_network, tna object).}

\item{nodes}{Integer vector of node indices (1-based) or character vector
of node names identifying the group \eqn{C}.}

\item{measure}{One of \code{"betweenness"}, \code{"closeness"},
\code{"degree"}.}

\item{mode}{For directed graphs with \code{measure = "degree"}: \code{"all"}
(both directions), \code{"out"} (outgoing), or \code{"in"} (incoming).
Ignored for undirected graphs and other measures.}

\item{normalized}{Logical, for \code{"betweenness"} only. If \code{TRUE}
(default), divide by \eqn{(|V| - |C|)(|V| - |C| - 1)}.}
}
\value{
A single numeric scalar — the group centrality of the set
\code{nodes}.
}
\description{
Group centrality measures the importance of a \emph{set} of nodes
\eqn{C \subseteq V} rather than a single node. Three variants are
supported:
}
\details{
\describe{
\item{betweenness}{\eqn{GBC(C) = \sum_{s,t \in V \setminus C, s \ne t}
    \sigma(s, t \mid C) / \sigma(s, t)}, where \eqn{\sigma(s, t)} is the
number of shortest \eqn{s}-\eqn{t} paths and \eqn{\sigma(s, t \mid C)}
is the number of those paths passing through at least one node in
\eqn{C}. Normalized by \eqn{1 / ((|V| - |C|)(|V| - |C| - 1))}.}
\item{closeness}{\eqn{GCC(C) = (|V| - |C|) / \sum_{v \in V \setminus C}
    d(v, C)}, where \eqn{d(v, C) = \min_{c \in C} d(v, c)} is the shortest
distance from \eqn{v} to any group member. Unreachable nodes
contribute 0 to the denominator sum (matching NetworkX convention).
For directed graphs, cograph uses \eqn{d(v, c)} in the original
direction, equivalent to NetworkX's "reverse then multi-source".}
\item{degree}{\eqn{GDC(C) = |N(C) \setminus C| / (|V| - |C|)}, the
fraction of non-group nodes adjacent to at least one group member.
\code{mode = "in"} / \code{"out"} pick the corresponding directed
neighborhood.}
}
}
\section{Divergence from NetworkX on betweenness}{

\code{networkx.group_betweenness_centrality} uses the Puzis-Yahalom-Elovici
iterative algorithm, which produces results that diverge from the textbook
Everett-Borgatti / Puzis 2008 "at least one node in C" definition on some
graph topologies (verified via an independent Python brute-force). cograph
implements the textbook formula directly; group_closeness and group_degree
match NetworkX exactly.
}

\examples{
g <- igraph::make_graph("Zachary")
group_centrality(g, nodes = c(1, 2, 3), measure = "betweenness")
group_centrality(g, nodes = c(1, 2, 3), measure = "closeness")
group_centrality(g, nodes = c(1, 2, 3), measure = "degree")
}
\references{
Everett, M. G., & Borgatti, S. P. (1999). The centrality of groups and
classes. \emph{Journal of Mathematical Sociology}, 23(3), 181-201.

Puzis, R., Yahalom, R., & Elovici, Y. (2008). Augmentative data collection
for betweenness centrality. In \emph{Advances in Social Networks Analysis
and Mining} (pp. 196-200). IEEE.
}
\seealso{
\code{\link{centrality}} for per-node measures.
}
