[Top][All Lists]

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

[igraph] Extracting the largest component

From: Andrew Papachristos
Subject: [igraph] Extracting the largest component
Date: Thu, 8 Dec 2011 17:50:25 -0500

Greetings, fellow igraphers.  

I have a quick question that has me frustrated, so after a few hours and a bit of frustration.  I'm trying to do something that should be pretty straight forward: I'm trying to extract the large component of a network.  The basic code I'm using is something like this (I apologize, I'm not programmer by nature, so this might be a pretty 'ugly').

g <- erdos.renyi.game(100, 2/100)


nodes<-which(V(g)$comps!=0)    #the "0" component is the largest component

largec<-delete.vertices(g, nodes)

When I get to this last step, I get the following error message:

Error in delete.vertices(g, nodes) : 
  At iterators.c:722 : Cannot create iterator, invalid vertex id, Invalid vertex id

Any thoughts?  Or easier solutions that I'm overlooking?


Andrew V. Papachristos
Robert Wood Johnson Health & Society Scholar ~ Harvard University
Assistant Professor (on leave) ~ UMass, Amherst - Dept. of Sociology
(413) 545 - 0443

reply via email to

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