closeness
takes one or more graphs (dat
) and returns the closeness centralities of positions (selected by nodes
) within the graphs indicated by g
. Depending on the specified mode, closeness on directed or undirected geodesics will be returned; this function is compatible with centralization
, and will return the theoretical maximum absolute deviation (from maximum) conditional on size (which is used by centralization
to normalize the observed centralization score).
closeness(dat, g=1, nodes=NULL, gmode="digraph", diag=FALSE, tmaxdev=FALSE, cmode="directed", geodist.precomp=NULL, rescale=FALSE, ignore.eval=TRUE)
g
=1. gmode
is set to "digraph" by default. diag
is FALSE
by default. tmaxdev==FALSE
. geodist
object precomputed for the graph to be analyzed (optional) $$C_C(v) = \frac{\left|V\left(G\right)\right|-1}{\sum_{i : i \neq v} d(v,i)}$$
where $d(i,j)$ is the geodesic distance between i and j (where defined). Closeness is ill-defined on disconnected graphs; in such cases, this routine substitutes Inf
. It should be understood that this modification is not canonical (though it is common), but can be avoided by not attempting to measure closeness on disconnected graphs in the first place! Intuitively, closeness provides an index of the extent to which a given vertex has short paths to all other vertices in the graph; this is one reasonable measure of the extent to which a vertex is in the ``middle'' of a given structure.
An alternate form of closeness (apparently due to Gil and Schmidt (1996)) is obtained by taking the sum of the inverse distances to each vertex, i.e.
$$C_C(v) = \frac{\sum_{i : i \neq v} \frac{1}{d(v,i)}}{\left|V\left(G\right)\right|-1}.$$ This measure correlates well with the standard form of closeness where both are well-defined, but lacks the latter's pathological behavior on disconnected graphs. Computation of alternate closeness may be performed via the argument cmode="suminvdir"
(directed case) and cmode="suminvundir"
(undirected case). The corresponding arguments cmode="directed"
and cmode="undirected"
return the standard closeness scores in the directed or undirected cases (respectively). Although treated here as a measure of closeness, this index was originally intended to capture power or efficacy; in its original form, the Gil-Schmidt power index is a renormalized version of the above. Specifically, let $R(v,G)$ be the set of vertices reachable by $v$ in $V \ v$. Then the Gil-Schmidt power index is defined as
$$C_{GS}(v) = \frac{\sum_{i \in R(v,G)} \frac{1}{d(v,i)}}{|R(v,G)|}.$$
This may be obtained via the argument cmode="gil-schmidt"
.
Gil, J. and Schmidt, S. (1996). The Origin of the Mexican Network of Power. Proceedings of the International Social Network Conference, Charleston, SC, 22-25.
Sinclair, P.A. (2007). Social Networks, 29, 81-92.
centralization
g<-rgraph(10) #Draw a random graph with 10 members
closeness(g) #Compute closeness scores
Run the code above in your browser using DataLab