Skip to main content
Tweeted twitter.com/StackMma/status/1155402621722791936
Became Hot Network Question
Mistakes in the title are corrected.
Link
user64494
  • 29.1k
  • 4
  • 29
  • 56

how How to plot connected components in the format of community structure plot?

Source Link
Tugrul Temel
  • 6.4k
  • 3
  • 14
  • 33

how to plot connected components in the format of community structure plot

I have the following code plotting community structure of random graph g. As one can see, the community structure plot presents a nice visual impact. I like to generate a similar plot for the connected components of g using ConnectedComponents[g]. HighLightGraph is showing individual vertices in a given component with the same color but this kind of presentation is not so useful for my purpose. I like to see the components linked to each other through binary links between the components.

SeedRandom[4];
g = RandomGraph[{30, 50}, DirectedEdges -> True];
gg = ConnectedComponents[g];
CommunityGraphPlot[g, CommunityRegionStyle -> LightGray, 
Method -> "Centrality"];
HighlightGraph[g, Subgraph[g, #] & /@ gg];

Thanks.