closeness_w {tnet}R Documentation

Closeness centrality in a weighted network

Description

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

Usage

 closeness_w(net, directed=NULL, precomp.dist=NULL) 

Arguments

net A weighted edgelist
directed Logical: whether the edgelist is directed or undirected. Default is NULL, then the function detects this parameter.
precomp.dist If you have already computed the distance matrix using distance_w, you can enter the name of the matrix object here.

Value

Returns a data.frame with two columns: the first containts the node ids of all the nodes in the edgelist, and the second containts the corresponding closeness scores.

Note

version 1.0.0

Author(s)

Tore Opsahl; http://toreopsahl.com

References

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

Examples

## Load sample data
sampledata <- 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 the programme
closeness_w(sampledata)


[Package tnet version 0.1.2 Index]