# closeness

From igraph v0.4.4
by Gabor Csardi

##### Closeness centrality of vertices

Cloness centrality measures how many steps is required to access every other vertex from a given vertex.

- Keywords
- graphs

##### Usage

`closeness(graph, v=V(graph), mode = "all")`

##### Arguments

- graph
- The graph to analyze.
- v
- The vertices for which closeness will be calculated.
- mode
- Character string, defined the types of the paths used for
measuring the distance in directed graphs.
in measures the paths*to*a vertex,out measures paths*from*a vertex,*all*uses und

##### Details

The closeness centrality of a vertex is defined by the inverse of the average length of the shortest paths to/from all the other vertices in the graph:

$$\frac{|V|-1}{\sum_{i\ne v} d_vi}$$

If there is no (directed) path between vertex $v$ and $i$ then the total number of vertices is used in the formula instead of the path length.

##### Value

- Numeric vector with the closeness values of all the vertices in
`v`

.

##### References

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

##### See Also

##### Examples

```
g <- graph.ring(10)
g2 <- graph.star(10)
closeness(g)
closeness(g2, mode="in")
closeness(g2, mode="out")
closeness(g2, mode="all")
```

*Documentation reproduced from package igraph, version 0.4.4, License: GPL version 2 or later (June, 1991)*

### Community examples

Looks like there are no examples yet.