Hello Gabor,
How are you!?
I would like to understand with you about methods degree e betweness.
I am compare this methods with sna methods for the same graph and the result are differents.
This is my single graph:
rede4 <- read.table("c:/temp/Exemplo Rede_4_vertices.csv",header=TRUE,sep = ";", dec=",")
# Adaptando o data.frame rede para que possa servir para a montagem da rede
grede4 <- rede4[,2:5]
rownames(grede4) <- rede4[,1]
rownames(grede4)
Look my results about SNA:
> sna::degree(grede4,gmode="graph",cmode="indegree")
[1] 2 2 2 2
> sna::closeness(grede4,gmode="graph")
[1] 0.75 0.75 0.75 0.75
> sna::betweenness(grede4,gmode="graph")
[1] 0.5 0.5 0.5 0.5
Look my results about igraph:
library("igraph")
#transformando one-mode network matrix into an igraph object,
a = as.matrix(as.data.frame(lapply(grede4, as.numeric)))
a
net1 <- graph_from_adjacency_matrix(a, mode="undirected", weighted=NULL)
net1
> degree(net1, mode="out")
A B C D
4 4 4 4
> closeness(net1, mode="all")
A B C D
0.25 0.25 0.25 0.25
> betweenness(net1)
A B C D
0.5 0.5 0.5 0.5
Can you help-me understand why the results about degree is different?
grown up my graph, another differences show on.
thanks very much.
best regards.