问题
I am looking at this stackoverflow plot over here: How to plot only large communities/clusters in R
library(igraph)
set.seed(1)
g1 <- erdos.renyi.game(100, 1 / 70)
cls <- clusters(g1)
g2 <- delete_vertices(g1, V(g1)[cls$membership %in% which(cls$csize <= 10)])
plot(g2)
It seems that first a random graph is created (called "g1"). Then the "cluster()" function is used to find out "isolated subgraphs" of "g1". All the "isolated subgraphs of g1" are stored in another object called "cls". The user than makes a request to plot only the "isolated subgraphs" with more than 10 nodes. Is my understanding correct? (is a "cluster" the same as an "isolated subgraph"?)
Can someone please tell me:
How many clusters (i.e. isolated subgraphs) are created? I am trying to find out a list of "each cluster produced, as well the size of each of these clusters" - how do you access this by writing R code?
How do you plot just one of these clusters? E.g. I tried the following code:
plot(cls[1], g1)
but I got an error: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
Can someone please help me here?
Thanks
Thanks
来源:https://stackoverflow.com/questions/65016504/r-plot-larger-components-clarifying-another-stackoverflow-post