1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/structural.properties.R 3\name{estimate_betweenness} 4\alias{estimate_betweenness} 5\alias{betweenness} 6\alias{edge.betweenness} 7\alias{betweenness.estimate} 8\alias{edge.betweenness.estimate} 9\alias{edge_betweenness} 10\alias{estimate_edge_betweenness} 11\title{Vertex and edge betweenness centrality} 12\usage{ 13estimate_betweenness( 14 graph, 15 vids = V(graph), 16 directed = TRUE, 17 cutoff, 18 weights = NULL, 19 nobigint = TRUE 20) 21 22betweenness( 23 graph, 24 v = V(graph), 25 directed = TRUE, 26 weights = NULL, 27 nobigint = TRUE, 28 normalized = FALSE 29) 30 31edge_betweenness(graph, e = E(graph), directed = TRUE, weights = NULL) 32} 33\arguments{ 34\item{graph}{The graph to analyze.} 35 36\item{vids}{The vertices for which the vertex betweenness estimation will be 37calculated.} 38 39\item{directed}{Logical, whether directed paths should be considered while 40determining the shortest paths.} 41 42\item{cutoff}{The maximum path length to consider when calculating the 43betweenness. If zero or negative then there is no such limit.} 44 45\item{weights}{Optional positive weight vector for calculating weighted 46betweenness. If the graph has a \code{weight} edge attribute, then this is 47used by default. Weights are used to calculate weighted shortest paths, 48so they are interpreted as distances.} 49 50\item{nobigint}{Logical scalar, whether to use big integers during the 51calculation. This is only required for lattice-like graphs that have very 52many shortest paths between a pair of vertices. If \code{TRUE} (the 53default), then big integers are not used.} 54 55\item{v}{The vertices for which the vertex betweenness will be calculated.} 56 57\item{normalized}{Logical scalar, whether to normalize the betweenness 58scores. If \code{TRUE}, then the results are normalized by the number of ordered 59or unordered vertex pairs in directed and undirected graphs, respectively. 60In an undirected graph, 61\deqn{B^n=\frac{2B}{(n-1)(n-2)},}{Bnorm=2*B/((n-1)*(n-2)),} where 62\eqn{B^n}{Bnorm} is the normalized, \eqn{B} the raw betweenness, and \eqn{n} 63is the number of vertices in the graph.} 64 65\item{e}{The edges for which the edge betweenness will be calculated.} 66} 67\value{ 68A numeric vector with the betweenness score for each vertex in 69\code{v} for \code{betweenness}. 70 71A numeric vector with the edge betweenness score for each edge in \code{e} 72for \code{edge_betweenness}. 73 74\code{estimate_betweenness} returns the estimated betweenness scores for 75vertices in \code{vids}, \code{estimate_edge_betweenness} the estimated edge 76betweenness score for \emph{all} edges; both in a numeric vector. 77} 78\description{ 79The vertex and edge betweenness are (roughly) defined by the number of 80geodesics (shortest paths) going through a vertex or an edge. 81} 82\details{ 83The vertex betweenness of vertex \code{v} is defined by 84 85\deqn{\sum_{i\ne j, i\ne v, j\ne v} g_{ivj}/g_{ij}}{sum( g_ivj / g_ij, 86i!=j,i!=v,j!=v)} 87 88The edge betweenness of edge \code{e} is defined by 89 90\deqn{\sum_{i\ne j} g{iej}/g_{ij}.}{sum( g_iej / g_ij, i!=j).} 91 92\code{betweenness} calculates vertex betweenness, \code{edge_betweenness} 93calculates edge betweenness. 94 95\code{estimate_betweenness} only considers paths of length \code{cutoff} or 96smaller, this can be run for larger graphs, as the running time is not 97quadratic (if \code{cutoff} is small). If \code{cutoff} is zero or negative 98then the function calculates the exact betweenness scores. 99 100\code{estimate_edge_betweenness} is similar, but for edges. 101 102For calculating the betweenness a similar algorithm to the one proposed by 103Brandes (see References) is used. 104} 105\note{ 106\code{edge_betweenness} might give false values for graphs with 107multiple edges. 108} 109\examples{ 110 111g <- sample_gnp(10, 3/10) 112betweenness(g) 113edge_betweenness(g) 114 115} 116\references{ 117Freeman, L.C. (1979). Centrality in Social Networks I: 118Conceptual Clarification. \emph{Social Networks}, 1, 215-239. 119 120Ulrik Brandes, A Faster Algorithm for Betweenness Centrality. \emph{Journal 121of Mathematical Sociology} 25(2):163-177, 2001. 122} 123\seealso{ 124\code{\link{closeness}}, \code{\link{degree}} 125} 126\author{ 127Gabor Csardi \email{csardi.gabor@gmail.com} 128} 129\keyword{graphs} 130