closeness
takes a graph stack (dat
) and returns the closeness centralities of positions within one graph (indicated by nodes
and g
, respectively). 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=c(1:dim(dat)[2]), gmode="digraph",
diag=FALSE, tmaxdev=FALSE, cmode="directed",
geodist.precomp=NULL, rescale=FALSE)
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{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 a number one greater than the maximum path length (i.e., |V(G)|) for the geodesic distance). It should be understood that this modification is not canonical, 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.
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