centroid {centiserve}R Documentation

Find the centroid value of graph vertices


Centroid value C_cen(v) for node v defined as:

Ccen(v) : = min(f(v, w) : w in V(v))

where f(v, w) : = gamma(v) (w) - gamma(w) (v), and gamma(v) (w) is the number of vertex closer to v than to w.


centroid(graph, vids = V(graph), mode = c("all", "out", "in"),
  weights = NULL)



The input graph as igraph object


Vertex sequence, the vertices for which the centrality values are returned. Default is all vertices.


Character constant, gives whether the shortest paths to or from the given vertices should be calculated for directed graphs. If out then the shortest paths from the vertex, if in then to it will be considered. If all, the default, then the corresponding undirected graph will be used, ie. not directed paths are searched. This argument is ignored for undirected graphs.


Possibly a numeric vector giving edge weights. If this is NULL, the default, and the graph has a weight edge attribute, then the attribute is used. If this is NA then no weights are used (even if the graph has a weight attribute).


Centroid value computed by focusing the calculus on couples of nodes (v,w) and systematically counting the nodes that are closer (in term of shortest path) to v or to w. The calculus proceeds by comparing the node distance from other nodes with the distance of all other nodes from the others, such that a high centroid value indicates that a node v is much closer to other nodes. Thus, the centroid value provides a centrality index always weighted with the values of all other nodes in the graph.
More detail at Centroid value


A numeric vector contaning the centrality scores for the selected vertices.


Mahdi Jalili m_jalili@farabi.tums.ac.ir

Algorithm adapted from CentiLib (Grabler, Johannes, 2012).


Scardoni, Giovanni, Michele Petterlini, and Carlo Laudanna. "Analyzing biological network parameters with CentiScaPe." Bioinformatics 25.21 (2009): 2857-2859.

Grabler, Johannes, Dirk Koschutzki, and Falk Schreiber. "CentiLib: comprehensive analysis and exploration of network centralities." Bioinformatics 28.8 (2012): 1178-1179.


g <- graph(c(1,2,2,3,3,4,4,2), directed=FALSE)

[Package centiserve version 1.0.0 Index]