This function calculates closeness scores for nodes in a weighted network based on the distance_w-function.

1 | ```
closeness_w(net, directed=NULL, gconly=TRUE, precomp.dist=NULL, alpha=1)
``` |

`net` |
A weighted edgelist |

`directed` |
Logical: whether the edgelist is directed or undirected. Default is NULL, then the function detects this parameter. |

`gconly` |
Logical: whether to calculate closeness only on the main component (traditional closeness). Default is TRUE. If this parameter is set to FALSE, a closeness measure for all nodes is computed. For details, see http://toreopsahl.com/2010/03/20/closeness-centrality-in-networks-with-disconnected-components/ |

`precomp.dist` |
If you have already computed the distance matrix using distance_w-function, you can enter the name of the matrix-object here. |

`alpha` |
sets the alpha parameter in the generalised measures from Opsahl, T., Agneessens, F., Skvoretz, J., 2010. Node Centrality in Weighted Networks: Generalizing Degree and Shortest Paths. Social Networks. If this parameter is set to 1 (default), the Dijkstra shortest paths are used. The identification procedure of these paths rely simply on the tie weights and disregards the number of nodes on the paths. |

Returns a data.frame with three columns: the first column contains the nodes' ids, the second column contains the closeness scores, and the third column contains the normalised closeness scores (i.e., divided by N-1).

version 1.0.0

Tore Opsahl; http://toreopsahl.com

http://toreopsahl.com/2009/01/09/average-shortest-distance-in-weighted-networks/

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.