closeness_w

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

This function takes two options:

  • edgelist: the weighted edgelist that we are calculating closeness scores on
  • directed: Logical: whether the edgelist is directed or undirected. Default is NULL, then the function detects this parameter
  • dist.precomp: if you have already computed the distance matrix, you can import it here. This significantly reduces computing time for large networks.

Closeness is calculated by assigning a farness score to each node. This farness score can be calculated in a number of ways; however, the most common way is to sum the distances to all the other nodes. In tnet only this method is implemented; however, distance is defined differently (see distance_w). Farness score for each node is then transformed into closeness by inverting the score. 

Example: Sample data

## Load tnet
library(tnet)
## Define sample data
Imagesampledata <- rbind(
c(1,2,4),
c(1,3,2),
c(2,1,4),
c(2,3,4),
c(2,4,1),
c(2,5,2),
c(3,1,2),
c(3,2,4),
c(4,2,1),
c(5,2,2),
c(5,6,1),
c(6,5,1))
## Run programme
closeness_w(sampledata)
  node closeness
1    1 0.2222222
2    2 0.2857143
3    3 0.2222222
4    4 0.1333333
5    5 0.2222222
6    6 0.1176471

 

Last Updated ( Monday, 03 August 2009 )