5.2. igraph_betweenness — Betweenness centrality of some vertices.

int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res,
  const igraph_vs_t vids, igraph_bool_t directed);

The betweenness centrality of a vertex is the number of geodesics going through it. If there are more than one geodesic between two vertices, the value of these geodesics are weighted by one over the number of geodesics.

Arguments: 

graph:

The graph object.

res:

The result of the computation, a vector containing the betweenness scores for the specified vertices.

vids:

The vertices of which the betweenness centrality scores will be calculated.

directed:

Logical, if true directed paths will be considered for directed graphs. It is ignored for undirected graphs.

Returns: 

Error code: IGRAPH_ENOMEM, not enough memory for temporary data. IGRAPH_EINVVID, invalid vertex id passed in vids.

Time complexity: O(|V||E|), |V| and |E| are the number of vertices and edges in the graph. Note that the time complexity is independent of the number of vertices for which the score is calculated.

See also: 

Other centrality types: igraph_degree(), igraph_closeness(). See igraph_edge_betweenness() for calculating the betweenness score of the edges in a graph. See igraph_betweenness_estimate() to estimate the betweenness score of the vertices in a graph.