% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{estimate_betweenness}
\alias{estimate_betweenness}
\alias{betweenness}
\alias{edge.betweenness}
\alias{betweenness.estimate}
\alias{edge.betweenness.estimate}
\alias{edge_betweenness}
\alias{estimate_edge_betweenness}
\title{Vertex and edge betweenness centrality}
\usage{
estimate_betweenness(
  graph,
  vids = V(graph),
  directed = TRUE,
  cutoff,
  weights = NULL,
  nobigint = TRUE
)

betweenness(
  graph,
  v = V(graph),
  directed = TRUE,
  weights = NULL,
  nobigint = TRUE,
  normalized = FALSE,
  cutoff = -1
)

edge_betweenness(
  graph,
  e = E(graph),
  directed = TRUE,
  weights = NULL,
  cutoff = -1
)
}
\arguments{
\item{graph}{The graph to analyze.}

\item{vids}{The vertices for which the vertex betweenness estimation will be
calculated.}

\item{directed}{Logical, whether directed paths should be considered while
determining the shortest paths.}

\item{cutoff}{The maximum path length to consider when calculating the
betweenness. If zero or negative then there is no such limit.}

\item{weights}{Optional positive weight vector for calculating weighted
betweenness. If the graph has a \code{weight} edge attribute, then this is
used by default. Weights are used to calculate weighted shortest paths,
so they are interpreted as distances.}

\item{nobigint}{Logical scalar, whether to use big integers during the
calculation. Deprecated since igraph 1.3 and will be removed in igraph 1.4.}

\item{v}{The vertices for which the vertex betweenness will be calculated.}

\item{normalized}{Logical scalar, whether to normalize the betweenness
scores. If \code{TRUE}, then the results are normalized by the number of ordered
or unordered vertex pairs in directed and undirected graphs, respectively.
In an undirected graph,            
\deqn{B^n=\frac{2B}{(n-1)(n-2)},}{Bnorm=2*B/((n-1)*(n-2)),} where
\eqn{B^n}{Bnorm} is the normalized, \eqn{B} the raw betweenness, and \eqn{n}
is the number of vertices in the graph.}

\item{e}{The edges for which the edge betweenness will be calculated.}
}
\value{
A numeric vector with the betweenness score for each vertex in
\code{v} for \code{betweenness}.

A numeric vector with the edge betweenness score for each edge in \code{e}
for \code{edge_betweenness}.
}
\description{
The vertex and edge betweenness are (roughly) defined by the number of
geodesics (shortest paths) going through a vertex or an edge.
}
\details{
The vertex betweenness of vertex \code{v} is defined by

\deqn{\sum_{i\ne j, i\ne v, j\ne v} g_{ivj}/g_{ij}}{sum( g_ivj / g_ij,
i!=j,i!=v,j!=v)}

The edge betweenness of edge \code{e} is defined by

\deqn{\sum_{i\ne j} g_{iej}/g_{ij}.}{sum( g_iej / g_ij, i!=j).}

\code{betweenness} calculates vertex betweenness, \code{edge_betweenness}
calculates edge betweenness.

Here \eqn{g_{ij}}{g_ij} is the total number of shortest paths between vertices
\eqn{i} and \eqn{j} while \eqn{g_{ivj}} is the number of those shortest paths
which pass though vertex \eqn{v}.

Both functions allow you to consider only paths of length \code{cutoff} or
smaller; this can be run for larger graphs, as the running time is not
quadratic (if \code{cutoff} is small). If \code{cutoff} is zero or negative,
then the function calculates the exact betweenness scores. Using zero as a
cutoff is \emph{deprecated} and future versions (from 1.4.0) will treat zero
cutoff literally (i.e. no paths considered at all). If you want no cutoff,
use a negative number.

\code{estimate_betweenness} and \code{estimate_edge_betweenness} are
aliases for \code{betweenness} and \code{edge_betweenness}, with a different
argument order, for sake of compatibility with older versions of igraph.

For calculating the betweenness a similar algorithm to the one proposed by
Brandes (see References) is used.
}
\note{
\code{edge_betweenness} might give false values for graphs with
multiple edges.
}
\examples{

g <- sample_gnp(10, 3/10)
betweenness(g)
edge_betweenness(g)

}
\references{
Freeman, L.C. (1979). Centrality in Social Networks I:
Conceptual Clarification. \emph{Social Networks}, 1, 215-239.

Ulrik Brandes, A Faster Algorithm for Betweenness Centrality. \emph{Journal
of Mathematical Sociology} 25(2):163-177, 2001.
}
\seealso{
\code{\link{closeness}}, \code{\link{degree}}, \code{\link{harmonic_centrality}}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\keyword{graphs}
