[igraph] igraph and statnet

20 views
Skip to first unread message

Silvia Alvarez

unread,
Nov 5, 2012, 9:49:53 PM11/5/12
to igrap...@nongnu.org
Hi everybody,

In a students seminar we tried to calculate basic network metrics using the igraph library. I also called the statnet library but used igraph functions for the estimations. When comparing my output with that of my class mates who didn't call statnet, the values were different. I didn't get any warning or error but the values were wrong. I tried to solve this by removing the statnet library (I actually delete it completely from my computer) but I kept getting the same wrong values. I tried it in other computers and I got the same wrong values. Has anyone had similar issues when using igraph and statnet? Is there an explanation for this? Any ideas on how to solve it? I am new to igraph and other network packages, so I am not sure if this has been discussed before, but I haven't been able to find anything yet.

Best wishes,

Silvia


--
Silvia J. Alvarez
PhD Student, Biological Sciences
Behavior, Ecology, Evolution and Systematics (BEES)
University of Maryland
College Park, MD 20742




Gábor Csárdi

unread,
Nov 5, 2012, 9:56:06 PM11/5/12
to Help for igraph users, silv...@gmail.com
Well, you will need to tell us more about these wrong results, otherwise we cannot help you. 

What exactly did you do? What are the wrong results you are getting? 

Ideally you should give us a small piece of R code that we can run and the reproduces your problem. 

Gabor


_______________________________________________
igraph-help mailing list
igrap...@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help




--
Gabor Csardi <csa...@rmki.kfki.hu>     MTA KFKI RMKI

Silvia Alvarez

unread,
Nov 6, 2012, 9:30:56 AM11/6/12
to Gábor Csárdi, Help for igraph users
Hi Gabor,

Thank you for the quick response. Here's the code:

library(igraph)
library(statnet)

##upload datase horse
horse<-read.csv("Horse.csv", header=T, row.names=1, check.names=F)
horse<-as.matrix(horse)
horse[6,2]=3
horse

##create adjacency matrix
hgraph<-igraph::graph.adjacency(horse, mode="undirected", weighted=NULL)
hgraph
igraph::degree(hgraph)
igraph::betweenness(hgraph, v=V(hgraph))

####End

The output I get is:
> igraph::degree(hgraph)
[1] 37 25 11 41 36 12 18 27 13
> igraph::betweenness(hgraph, v=V(hgraph))
[1] 0.8144796 0.4841629 0.0000000 0.7533937 0.6968326 0.0000000 0.0000000 0.2511312 0.0000000

Thank you,

Silvia



2012/11/5 Gábor Csárdi <csa...@rmki.kfki.hu>

Gábor Csárdi

unread,
Nov 6, 2012, 10:34:29 AM11/6/12
to Silvia Alvarez, Help for igraph users
Hi Silvia,

the thing is, I still cannot run this code, because I don't have "Horse.csv". Also, you did not say why do you think the output is bad, and what do you think would be the correct output. For the graphs I have tried igraph and statnet give the same results for degree() and betweenness().

Please also include the output of the sessionInfo() function, because statnet and sna only recently have a namespace, and it matters which version you use.

Thanks, Gabor
Reply all
Reply to author
Forward
0 new messages