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.