({{, (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot])[g] 
generates a plot showing the community structure of the graph g.}, {, (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot])[g,{{(Subscript[v, (Subscript[i, 1])]),(Subscript[v, (Subscript[i, 2])]),…},…}]
generates a plot for the graph g with communities {(Subscript[v, (Subscript[i, 1])]),(Subscript[v, (Subscript[i, 2])]),…}, ….}, {, (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot])[g,{…,(Subscript[w, j])[{(Subscript[v, (Subscript[i, 1])]),…}],…}]
generates a plot with highlighting features defined by the symbol wrappers (Subscript[w, j]).}, {, (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot])[{(Subscript[v, (Subscript[i, 1])])->(Subscript[v, (Subscript[j, 1])]),(Subscript[v, (Subscript[i, 2])])->(Subscript[v, (Subscript[j, 2])]),…},…]
generates a plot for a graph in which vertex (Subscript[v, ik]) is connected to vertex (Subscript[v, jk]).}, {, (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot])[m,…]
generates a plot for a graph represented by the adjacency matrix m.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot]) attempts to draw the vertices grouped into communities.

The following wrappers (Subscript[w, i]) can be used for communities:

(RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot]) has the same options as (RefLink[Graph, paclet:ref/Graph]), with the following additions and changes:

Possible settings for (RefLink[PlotTheme, paclet:ref/PlotTheme]) include common base themes:

OpenersPrimaryExamplesSection(Spacer1)Examples  (25)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Show communities in a graph:

CommunityGraphPlot[ExampleData[{"NetworkGraph","DolphinSocialNetwork"}]]

Find communities:

g=ExampleData[{"NetworkGraph","ZacharyKarateClub"}];

FindGraphCommunities[g]

Show the communities:

CommunityGraphPlot[g,%]

OpenersExampleSection1(Spacer1)Scope  (8)

(RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot]) works with undirected graphs:

CommunityGraphPlot[]

Directed graphs:

CommunityGraphPlot[]

Multigraphs:

CommunityGraphPlot[]

Mixed graphs:

CommunityGraphPlot[]

Specify a graph using a rule list:

CommunityGraphPlot[{1->3,1->5,1->7,1->10,1->13,2->5,2->6,2->8,2->10,2->14,3->4,4->5,2->3,1->2,14->1}]

Adjacency matrix:

CommunityGraphPlot[(({{0, 1, 1, 1, 0, 0}, {1, 0, 1, 1, 1, 0}, {1, 1, 0, 1, 1, 1}, {1, 1, 1, 0, 1, 1}, {0, 1, 1, 1, 0, 1}, {0, 0, 1, 1, 1, 0}}))]

Specify communities:

CommunityGraphPlot[,{{4,5,7},{1,2,3},{6,9,8}}]

Wrappers:

CommunityGraphPlot[,{Style[{4,5,7,1,2},Green],{3,6,9,8}}]

CommunityGraphPlot[,{Labeled[{4,5,7,1,2},"A"],{3,6,9,8}}]

OpenersExampleSection2(Spacer1)Options  (15)

OpenersExampleSubsection0(Spacer1)CommunityBoundaryStyle  (4)

The default community boundary style is a gray line:

CommunityGraphPlot[,CommunityBoundaryStyle->Automatic]

Use black boundary lines:

CommunityGraphPlot[,CommunityBoundaryStyle->Black]

Use (RefLink[None, paclet:ref/None]) to not show boundary lines:

CommunityGraphPlot[,CommunityBoundaryStyle->None]

Alternate between red and dashed boundary lines:

CommunityGraphPlot[,CommunityBoundaryStyle->{Red,Dashed}]

OpenersExampleSubsection1(Spacer1)CommunityRegionStyle  (3)

The default community region style is (RefLink[None, paclet:ref/None]):

CommunityGraphPlot[]

This can also be obtained with (RefLink[CommunityRegionStyle, paclet:ref/CommunityRegionStyle])->(RefLink[None, paclet:ref/None]):

CommunityGraphPlot[,CommunityRegionStyle->None]

Use green colors on community regions:

CommunityGraphPlot[,CommunityRegionStyle->Green]

Alternate between red and blue colors on community regions:

CommunityGraphPlot[,CommunityRegionStyle->{Red,Blue}]

OpenersExampleSubsection2(Spacer1)CommunityLabels  (3)

Generate labels for communities:

CommunityGraphPlot[,CommunityLabels->{"one","two","three"}]

Use (RefLink[Labeled, paclet:ref/Labeled]) to specify individual labels:

CommunityGraphPlot[,{Labeled[{1,4,10,6},"one"],{2,5,8},{9,3,7}}]

Use (RefLink[Placed, paclet:ref/Placed]) to control the placement of labels:

CommunityGraphPlot[,CommunityLabels->Placed[{"one","two","three"},Below]]

OpenersExampleSubsection3(Spacer1)Method  (2)

By default, (RefLink[CommunityGraphPlot, paclet:ref/CommunityGraphPlot]) uses a force-directed layout:

CommunityGraphPlot[]

This can also be obtained with (RefLink[Method, paclet:ref/Method])->"SpringElectrical":

CommunityGraphPlot[, Method->"SpringElectrical"]

Use (RefLink[Method, paclet:ref/Method])->"Hierarchical" for a hierarchical layout:

CommunityGraphPlot[,Method->"Hierarchical"]

OpenersExampleSubsection4(Spacer1)PlotLegends  (3)

Generate a legend for communities:

CommunityGraphPlot[,PlotLegends->{"one","two","three"}]

Use (RefLink[Legended, paclet:ref/Legended]) to specify individual legend entries:

CommunityGraphPlot[,{Legended[{1,4,10,6},"one"],{2,5,8},{9,3,7}}]

Use (RefLink[Placed, paclet:ref/Placed]) to control the placement of legends:

CommunityGraphPlot[,PlotLegends->Placed[Automatic,Below]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FindGraphCommunities, paclet:ref/FindGraphCommunities])  ▪  (RefLink[FindGraphPartition, paclet:ref/FindGraphPartition])  ▪  (RefLink[Graph, paclet:ref/Graph])  ▪  (RefLink[GraphPlot, paclet:ref/GraphPlot])  ▪  (RefLink[LayeredGraphPlot, paclet:ref/LayeredGraphPlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Social Network Analysis, paclet:guide/SocialNetworks])}, {▪(RefLinkPlain[Graph Visualization, paclet:guide/GraphVisualization])}, {▪(RefLinkPlain[Cluster Analysis, paclet:guide/ClusterAnalysis])}, {▪(RefLinkPlain[Graphs & Networks, paclet:guide/GraphsAndNetworks])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/21-graphs-and-networks.html])(WebLink[: Graphs and Networks, https://www.wolfram.com/language/elementary-introduction/21-graphs-and-networks.html])}})}})