Weijia see ?degree for the degree and ?cor for the correlation. E.g.
mixing <- function(g) { el <- get.edgelist(g) deg <- degree(g) cor(deg[el[,1]+1], deg[el[,2]+1]) } You need to modify the degree() call to take edge direction into account. Gabor ps. FYI, there is also an igraph missing list, in case I miss your messages on R-help and nobody else answers either. On Fri, Dec 26, 2008 at 5:48 PM, Weijia You <weiji...@gmail.com> wrote: > Dear colleagues, > > I'm trying to have a look at the Assortative and Disassortative ( > http://en.wikipedia.org/wiki/Assortative_mixing) of the network I have. > But it seems that the igraph hasn't mentioned that yet. > > I have to get the in/out degree of the vertices of each edge and calculate > the Pearson's Correlation coefficient which seems to be quite a huge task > for me. :( > > So I wonder if anyone had done that before and give me some hints on it? > > Thank you in anticipation! > > Weijia > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Gabor Csardi <gabor.csa...@unil.ch> UNIL DGM ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.