generates a plot showing the community structure of the graph g.


generates a plot for the graph g with communities {vi1,vi2,}, .


generates a plot with highlighting features defined by the symbol wrappers wj.


generates a plot for a graph in which vertex vik is connected to vertex vjk.


generates a plot for a graph represented by the adjacency matrix m.

Details and Options

  • CommunityGraphPlot attempts to draw the vertices grouped into communities.
  • The following wrappers wi can be used for communities:
  • Annotation[a,label]provide an annotation
    Button[a,action]define an action to execute when the element is clicked
    EventHandler[a,]define a general event handler for the element
    Hyperlink[a,uri]make the element act as a hyperlink
    Labeled[a,]display the element with labeling
    PopupWindow[a,cont]attach a popup window to the element
    Annotation[a,namevalue]set an annotation for the element
    StatusArea[a,label]display in the status area when moused over
    Style[a,opts]show the element using the specified styles
    Tooltip[a,label]attach an arbitrary tooltip to the element
  • CommunityGraphPlot has the same options as Graph, with the following additions and changes:
  • CommunityRegionStyle Automaticstyle of community region
    CommunityBoundaryStyle Automaticstyle of community boundary
    CommunityLabels Nonelabels for communities
    Method Automaticmethods to use
    PlotLegends Nonelegend for communities
  • Possible settings for PlotTheme include common base themes:
  • "Business"a bright, modern look appropriate for business presentations or infographics
    "Detailed"identify data by employing labels and tooltips
    "Marketing"elegant, eye-catching design suitable for marketing needs
    "Minimal"simple graph
    "Monochrome"single-color design
    "Scientific"candid design useful for analyzing detailed data with labels and tooltips
    "Web"clean, bold design suitable for a consumer website or blog
    "Classic"historical design of graph to remain compatible with existing uses


open allclose all

Basic Examples  (2)

Show communities in a graph:

Find communities:

Show the communities:

Scope  (8)

CommunityGraphPlot works with undirected graphs:

Directed graphs:


Mixed graphs:

Specify a graph using a rule list:

Adjacency matrix:

Specify communities:


Options  (17)

AspectRatio  (2)

By default, CommunityGraphPlot automatically determines the height to width ratio for the plot:

Make the height the same as the width with AspectRatio1:

CommunityBoundaryStyle  (4)

The default community boundary style is a gray line:

Use black boundary lines:

Use None to not show boundary lines:

Alternate between red and dashed boundary lines:

CommunityLabels  (3)

Generate labels for communities:

Use Labeled to specify individual labels:

Use Placed to control the placement of labels:

CommunityRegionStyle  (3)

The default community region style is None:

This can also be obtained with CommunityRegionStyle->None:

Use green colors on community regions:

Alternate between red and blue colors on community regions:

Method  (2)

By default, CommunityGraphPlot uses a force-directed layout:

This can also be obtained with Method->"SpringElectrical":

Use Method->"Hierarchical" for a hierarchical layout:

PlotLegends  (3)

Generate a legend for communities:

Use Legended to specify individual legend entries:

Use Placed to control the placement of legends:

Wolfram Research (2012), CommunityGraphPlot, Wolfram Language function,


Wolfram Research (2012), CommunityGraphPlot, Wolfram Language function,


Wolfram Language. 2012. "CommunityGraphPlot." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2012). CommunityGraphPlot. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2022_communitygraphplot, author="Wolfram Research", title="{CommunityGraphPlot}", year="2012", howpublished="\url{}", note=[Accessed: 09-June-2023 ]}


@online{reference.wolfram_2022_communitygraphplot, organization={Wolfram Research}, title={CommunityGraphPlot}, year={2012}, url={}, note=[Accessed: 09-June-2023 ]}