I'm trying to obtain centrality measures for a directed, weighted network. I've been using the igraph
and tnet
packages in R
. However, I've discovered some differences in the results obtained using these two packages, and I'm a little confused about the cause of these differences. See below.
require(igraph)
require(tnet)
set.seed(1234)
m <- expand.grid(from = 1:4, to = 1:4)
m <- m[m$from != m$to, ]
m$weight <- sample(1:7, 12, replace = T)
igraph_g <- graph.data.frame(m)
tnet_g <- as.tnet(m)
closeness(igraph_g, mode = "in")
2 3 4 1
0.05882353 0.12500000 0.07692308 0.09090909
closeness(igraph_g, mode = "out")
2 3 4 1
0.12500000 0.06250000 0.06666667 0.10000000
closeness(igraph_g, mode = "total")
2 3 4 1
0.12500000 0.14285714 0.07692308 0.16666667
closeness_w(tnet_g, directed = T, alpha = 1)
node closeness n.closeness
[1,] 1 0.2721088 0.09070295
[2,] 2 0.2448980 0.08163265
[3,] 3 0.4130809 0.13769363
[4,] 4 0.4081633 0.13605442
Anybody know what's going on?