igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Fwd: Package ‘igraph’ - Methods degree and betweness


From: Alexandre Souza
Subject: [igraph] Fwd: Package ‘igraph’ - Methods degree and betweness
Date: Tue, 4 Jun 2019 10:56:31 -0300


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.

Att.



Livre de vírus. www.avg.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]