The default for the directed
argument to eigen_centrality
is FALSE
, as you can see in the documentation. In the first call, hence directed=FALSE
by default, while in the second call, you explicitly set directed=TRUE
. The full reproducible example is below, showing that both calls produce identical results if you set directed=TRUE
also in the first call.
library(igraph)
A = matrix(
c(0, 1, 1, 1, 1, 1, 1, 0, 0,
1, 0, 1, 1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 1, 0, 0, 0, 0,
1, 1, 0, 0, 0, 1, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 1, 0,
1, 0, 0, 1, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 1, 1, 0),
nrow=9, ncol=9)
w = A/rowSums((A))
g = graph.adjacency(w,mode="directed",weighted=TRUE)
v1 = eigen_centrality(g, directed = TRUE)$vector
v2 = eigen_centrality(g, directed = TRUE, weights = E(g)$weigh)$vector
print(v1)
print(v2)
output:
> print(v1)
[1] 1.0000000 0.5000000 0.5000000 0.5000000 0.5000000 0.3333333 0.3333333
[8] 0.3333333 0.3333333
> print(v2)
[1] 1.0000000 0.5000000 0.5000000 0.5000000 0.5000000 0.3333333 0.3333333
[8] 0.3333333 0.3333333