igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] key players in networks


From: Gabor Csardi
Subject: Re: [igraph] key players in networks
Date: Thu, 20 Sep 2007 15:35:10 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Wed, Sep 19, 2007 at 08:13:14PM +0200, Tamas Nepusz wrote:
> Dear Simone,
> 
> > Is there a function like isolates() that retrive a list of isolates
> > nodes so that I can pass it to delete.vertices()?
> No, there is no isolates(), but it is easy to achieve using degree():
> 
> isolates <- seq(vcount(g))[degree(g) == 0]
> 
> This gives you the indices of the isolated vertices. At least I hope
> so, I'm not an expert in R :)

Should be good. The only catch is that vertex ids start with zero in
igraph, so you need to subtract one. Also, the 'which' function is easier
to use:

which(degree(g)==0)-1

Deleting them is easy of course:

g2 <- delete.vertices(g, which(degree(g)==0)-1)

G.

> -- 
> Tamas
> 
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

-- 
Csardi Gabor <address@hidden>    MTA RMKI, ELTE TTK




reply via email to

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