Hi again everyone, After not being able to plot the subgraph via the code
right_size <- which(sizes(wc) < 8 & sizes(wc) > 1) subg <- induced.subgraph(y, which(membership(wc) %in% right_size)) I found an alternative from an sna tutorial. Below is code where I was able to get the indices for the communities of interest. Is there a way I can plot the communities as a graph/subgraph from this index??? I am aware that I would have to convert it into a graph object, but I have not been successful in my attempts. I want to do something as follows: h <- comlist[bigComIndex] newdata <- as.data.frame(h, header=F) ##Gives me an error (expects at least 2 columns) graph.data.frame(newdata)##Gives me an error(not a graphical object) Thanks in advance, Benika H On Wed, Feb 4, 2015 at 8:26 PM, Benika H <[email protected]> wrote: > right_size <- which(sizes(wc) < 8 & sizes(wc) > 1) > subg <- induced.subgraph(y, which(membership(wc) %in% right_size)) > > That code is only giving me 9 communities of one node. > Is there another way? > > when I print out sizes(wc), I get at least 32 communities with at least 2 > nodes and less than 7 nodes. > > I'm not sure why its not working. > > > Thanks for your help!! > > On Wed, Feb 4, 2015 at 8:02 PM, Chris Watson <[email protected]> wrote: > >> Ah indeed you are correct. Your code should work fine... >> >> On Wed, Feb 4, 2015 at 7:59 PM, Gábor Csárdi <[email protected]> >> wrote: >> >>> On Wed, Feb 4, 2015 at 7:53 PM, Chris Watson <[email protected]> >>> wrote: >>> >>>> Again, you need to adjust parentheses. >>>> >>>> which(c1$csize < 8) & which(c1$csize > 2) >>>> >>> >>> This is actually not good, which() returns a numeric vector, so a >>> logical 'and' on it does not make much sense. >>> >>> Again, what is wrong with >>> >>> right_size <- which(sizes(wc) < 8 & sizes(wc) > 1) >>> subg <- induced.subgraph(y, which(membership(wc) %in% right_size)) >>> >>> ? >>> >>> G. >>> >>> [...] >>> >>> _______________________________________________ >>> igraph-help mailing list >>> [email protected] >>> https://lists.nongnu.org/mailman/listinfo/igraph-help >>> >>> >> >> _______________________________________________ >> igraph-help mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/igraph-help >> >> >
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
