closeness {sna} | R Documentation

## Compute the Closeness Centrality Scores of Network Positions

### Description

`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).

### Usage

    closeness(dat, g=1, nodes=NULL, gmode="digraph", diag=FALSE,
        tmaxdev=FALSE, cmode="directed", geodist.precomp=NULL,
        rescale=FALSE)

### Arguments

`dat` | one or more input graphs.
`g` | integer indicating the index of the graph for which centralities are to be calculated (or a vector thereof). By default, `g`=1.
`nodes` | list indicating which nodes are to be included in the calculation. By default, all nodes are included.
`gmode` | string indicating the type of graph being evaluated. "digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected. `gmode` is set to "digraph" by default.
`diag` | boolean indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain loops. `diag` is `FALSE` by default.
`tmaxdev` | boolean indicating whether or not the theoretical maximum absolute deviation from the maximum nodal centrality should be returned. By default, `tmaxdev==FALSE`.
`cmode` | string indicating the type of closeness centrality being computed (distances on directed or undirected geodesics).
`geodist.precomp` | a `geodist` object precomputed for the graph to be analyzed (optional)
`rescale` | if true, centrality scores are rescaled such that they sum to 1.

### Details

The closeness of a vertex v is defined as

C_C(v) = (|V(G)|-1)/sum( d(v,i), i in V(G), i!=v )

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.

### Value

A vector, matrix, or list containing the closeness scores (depending on the number and size of the input graphs).

### Note

Judicious use of `geodist.precomp` can save a great deal of time when computing multiple path-based indices on the same network.

### Author(s)

Carter T. Butts, buttsc@uci.edu

### References

Freeman, L.C. (1979). ``Centrality in Social Networks I: Conceptual Clarification.'' Social Networks, 1, 215-239.

### See Also

`centralization`

### Examples

    g<-rgraph(10)     #Draw a random graph with 10 members
    closeness(g)      #Compute closeness scores

[Package sna version 1.1 Index]