---
title: "CommunityStructurePartition"
language: "en"
type: "Symbol"
summary: "As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System. >>"
keywords: 
- network analysis graph partition graph partitioning
canonical_url: "https://reference.wolfram.com/language/GraphUtilities/ref/CommunityStructurePartition.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Graphs & Networks"
    link: "https://reference.wolfram.com/language/guide/GraphsAndNetworks.en.md"
  - 
    title: "Graph Visualization"
    link: "https://reference.wolfram.com/language/guide/GraphVisualization.en.md"
  - 
    title: "Computation on Graphs"
    link: "https://reference.wolfram.com/language/guide/ComputationOnGraphs.en.md"
  - 
    title: "Graph Construction & Representation"
    link: "https://reference.wolfram.com/language/guide/GraphConstructionAndRepresentation.en.md"
  - 
    title: "Graphs and Matrices"
    link: "https://reference.wolfram.com/language/guide/GraphsAndMatrices.en.md"
  - 
    title: "Graph Properties & Measurements"
    link: "https://reference.wolfram.com/language/guide/GraphPropertiesAndMeasurements.en.md"
  - 
    title: "Graph Operations and Modifications"
    link: "https://reference.wolfram.com/language/guide/GraphModifications.en.md"
  - 
    title: "Statistical Analysis"
    link: "https://reference.wolfram.com/language/guide/RandomGraphs.en.md"
  - 
    title: "Social Network Analysis"
    link: "https://reference.wolfram.com/language/guide/SocialNetworks.en.md"
  - 
    title: "Graph Properties"
    link: "https://reference.wolfram.com/language/guide/GraphProperties.en.md"
  - 
    title: "Mathematical Data Formats"
    link: "https://reference.wolfram.com/language/guide/MathematicalDataFormats.en.md"
  - 
    title: "Discrete Mathematics"
    link: "https://reference.wolfram.com/language/guide/DiscreteMathematics.en.md"
related_functions: 
  - 
    title: "FindGraphCommunities"
    link: "https://reference.wolfram.com/language/ref/FindGraphCommunities.en.md"
related_tutorials: 
  - 
    title: "Upgrading from Graph Utilities Package"
    link: "https://reference.wolfram.com/language/Compatibility/tutorial/GraphUtilities.en.md"
---
## GraphUtilities\`

# CommunityStructurePartition

⚠ As of Version 10, all the functionality of the ``GraphUtilities`` package is built into the Wolfram System. [`>>`](https://reference.wolfram.com/language/ref/FindGraphCommunities.en.md)

CommunityStructurePartition[g] gives the partition of a graph g into communities.

## Details and Options

* ``CommunityStructurePartition`` functionality is now available in the built-in Wolfram Language function ``FindGraphCommunities``.

* To use ``CommunityStructurePartition``, you first need to load the [Graph Utilities Package](https://reference.wolfram.com/language/GraphUtilities/guide/GraphUtilitiesPackage.en.md) using ``Needs["GraphUtilities`"]``.

* The partition groups the vertices into communities, such that there is a higher density of edges within communities than between them.

* The following option can be given:

[Weighted](https://reference.wolfram.com/language/GraphUtilities/ref/Weighted.en.md) 	[`False`](https://reference.wolfram.com/language/ref/False.en.md)	whether edges with higher weights are preferred during matching

---

## Examples (3)

### Basic Examples (2)

This defines a small graph:

```wl
In[1]:= Needs["GraphUtilities`"]

In[2]:=
g = {3 -> 2, 2 -> 1, 1 -> 3, 3 -> 5, 5 -> 6, 6 -> 7, 7 -> 5};
GraphPlot[g, VertexLabeling -> True]

Out[2]= [image]
```

This finds that the network is grouped into two communities:

```wl
In[3]:= CommunityStructurePartition[g]

Out[3]= {{3, 2, 1}, {5, 6, 7}}
```

---

``CommunityStructurePartition`` has been superseded by ``FindGraphCommunities`` :

```wl
In[1]:= g = Graph[{3 -> 2, 2 -> 1, 1 -> 3, 3 -> 5, 5 -> 6, 6 -> 7, 7 -> 5}]

Out[1]= [image]

In[2]:= FindGraphCommunities[g]

Out[2]= {{3, 2, 1}, {5, 6, 7}}
```

### Options (1)

#### Weighted (1)

This specifies a weighted graph:

```wl
In[1]:= Needs["GraphUtilities`"]

In[2]:= g = SparseArray[{{1, 2} -> 10, {2, 1} -> 10, {2, 3} -> 1, {3, 2} -> 1, {3, 1} -> 1, {1, 3} -> 1, {3, 5} -> 10, {5, 3} -> 10, {5, 6} -> 1, {6, 5} -> 1, {6, 4} -> 10, {4, 6} -> 10, {5, 4} -> 1, {4, 5} -> 1}, {6, 6}]

Out[2]= SparseArray["<"14">", {6, 6}]
```

This plots the graph with edge weights shown:

```wl
In[3]:= GraphPlot[g, VertexLabeling -> True, EdgeRenderingFunction -> ({Line[#1], Text[g[[First[#4], Last[#4]]], LineScaledCoordinate[#1], Background -> White]}&)]

Out[3]= [image]
```

This finds the community structure, ignoring edge weights:

```wl
In[4]:= cs = CommunityStructurePartition[g]

Out[4]= {{1, 2, 3}, {4, 6, 5}}
```

This finds the community structure, taking into account the edge weights:

```wl
In[5]:= cs = CommunityStructurePartition[g, Weighted -> True]

Out[5]= {{1, 2}, {3, 5}, {4, 6}}
```

## See Also

* [`FindGraphCommunities`](https://reference.wolfram.com/language/ref/FindGraphCommunities.en.md)
* [CommunityStructureAssignment](https://reference.wolfram.com/language/GraphUtilities/ref/CommunityStructureAssignment.en.md)
* [CommunityModularity](https://reference.wolfram.com/language/GraphUtilities/ref/CommunityModularity.en.md)
* [MinCut](https://reference.wolfram.com/language/GraphUtilities/ref/MinCut.en.md)

## Tech Notes

* [Upgrading from Graph Utilities Package](https://reference.wolfram.com/language/Compatibility/tutorial/GraphUtilities.en.md)
* [Graph Utilities Package](https://reference.wolfram.com/language/GraphUtilities/tutorial/GraphUtilities.en.md)

## Related Guides

* [Graph Utilities Package](https://reference.wolfram.com/language/GraphUtilities/guide/GraphUtilitiesPackage.en.md)
* [Graphs & Networks](https://reference.wolfram.com/language/guide/GraphsAndNetworks.en.md)
* [Graph Visualization](https://reference.wolfram.com/language/guide/GraphVisualization.en.md)
* [Computation on Graphs](https://reference.wolfram.com/language/guide/ComputationOnGraphs.en.md)
* [Graph Construction & Representation](https://reference.wolfram.com/language/guide/GraphConstructionAndRepresentation.en.md)
* [Graphs and Matrices](https://reference.wolfram.com/language/guide/GraphsAndMatrices.en.md)
* [Graph Properties & Measurements](https://reference.wolfram.com/language/guide/GraphPropertiesAndMeasurements.en.md)
* [Graph Operations and Modifications](https://reference.wolfram.com/language/guide/GraphModifications.en.md)
* [Statistical Analysis](https://reference.wolfram.com/language/guide/RandomGraphs.en.md)
* [Social Network Analysis](https://reference.wolfram.com/language/guide/SocialNetworks.en.md)
* [Graph Properties](https://reference.wolfram.com/language/guide/GraphProperties.en.md)
* [Mathematical Data Formats](https://reference.wolfram.com/language/guide/MathematicalDataFormats.en.md)
* [Discrete Mathematics](https://reference.wolfram.com/language/guide/DiscreteMathematics.en.md)