cannin
cannin

Reputation: 3285

Edit or Exclude Small igraph Modules During Plotting in R

Is it possible to exclude or edit the modules being plotted so that modules with only one node do not have a module boundary? In case below, hide the module boundary around 9 and 13.

set.seed(3)
g <- barabasi.game(20, m=2, directed=FALSE)
eb <- cluster_edge_betweenness(g)
plot(eb, g, layout=layout_with_fr) 

igraph plot

Upvotes: 1

Views: 364

Answers (1)

G5W
G5W

Reputation: 37641

You can get at this using the mark.groups argument to plot.communities. First create the default grouping, but then eliminate the groups with only one member.

MG = lapply(unique(eb$membership), function(m) { which(eb$membership == m) })
MG[sapply(MG, length) == 1] = NULL
plot(eb, g, mark.groups=MG, layout=layout_with_fr) 

Small groups unmarked

Upvotes: 2

Related Questions