gives a partition of vertices of the graph g.
FindGraphPartition[g,k]
gives a partition of vertices into k approximately equal-size parts.
FindGraphPartition[g,{n1,…,nk}]
gives a partition of vertices into parts with sizes n1, …, nk.
FindGraphPartition[g,{α1,…,αk}]
gives a partition of vertices into parts with approximate size proportions α1, …, αk.
FindGraphPartition[{vw,…},…]
uses rules vw to specify the graph g.
FindGraphPartition
gives a partition of vertices of the graph g.
FindGraphPartition[g,k]
gives a partition of vertices into k approximately equal-size parts.
FindGraphPartition[g,{n1,…,nk}]
gives a partition of vertices into parts with sizes n1, …, nk.
FindGraphPartition[g,{α1,…,αk}]
gives a partition of vertices into parts with approximate size proportions α1, …, αk.
FindGraphPartition[{vw,…},…]
uses rules vw to specify the graph g.
Details
- FindGraphPartition finds a partition of vertices such that the number of edges having endpoints in different parts is minimized.
- FindGraphPartition[g] is equivalent to FindGraphPartition[g,2].
- FindGraphPartition treats graphs as undirected simple graphs.
- For a weighted graph, FindGraphPartition finds a partition such that the sum of edge weights for edges having endpoints in different parts is minimized.
- FindGraphPartition[g,{α1,…,αk}] will give a partition where the size of a part is given by the sum of its vertex weights.
- The partitions are ordered by their length with the largest part first.
Examples
open all close allBasic Examples (1)
Scope (10)
FindGraphPartition works with undirected graphs:
FindGraphPartition[[image]]FindGraphPartition[[image]]FindGraphPartition[[image]]FindGraphPartition[[image]]FindGraphPartition[[image]]Find a k-way partition of a graph:
FindGraphPartition[[image], 3]Find a partition with specified sizes:
FindGraphPartition[[image], {1, 2, 3}]Find a partition with specified proportions:
FindGraphPartition[[image], {0.4, 0.6}]Use rules to specify the graph:
FindGraphPartition[{1 -> 2, 2 -> 3, 3 -> 1, 2 -> 4, 4 -> 5, 5 -> 6, 6 -> 4}]FindGraphPartition works with large graphs:
g = ExampleData[{"NetworkGraph", "Internet"}];FindGraphPartition[g]//Short//TimingApplications (4)
Partition an irregular mesh over a three-dimensional structure into four parts:
mesh = AdjacencyGraph[Import["LinearAlgebraExamples/Data/can__229.psa"]]Short[FindGraphPartition[mesh, 4]]Highlight the partitioned mesh:
HighlightGraph[mesh, Subgraph[mesh, #]& /@ %]Reorder the matrix into block-diagonal form with the number of off-diagonal elements minimized:
m = (| | | | | | | | | | | | | | | | | | | | |
| - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |);ordering = Flatten[FindGraphPartition[AdjacencyGraph[m]]]Show the matrix before and after the ordering:
Row[{MatrixPlot[m], MatrixPlot[m[[ordering, ordering]]]}, Spacer[50]]A sponsored search graph with advertisers and phrases as nodes and links from an advertiser to a phrase he bids on:
g = [image];Find submarkets and groups of advertisers that do most of their spending on a group of query phrases:
FindGraphPartition[g, 3]Find communities in social networks using graph partitioning:
club = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}]FindGraphPartition[club, {0.38, 0.62}]HighlightGraph[club, Subgraph[club, #]& /@ %]Properties & Relations (1)
Use FindGraphCommunities to find communities in a graph:
g = RandomGraph[WattsStrogatzGraphDistribution[20, 0.1, 3]];FindGraphCommunities[g]See Also
Related Guides
Text
Wolfram Research (2012), FindGraphPartition, Wolfram Language function, https://reference.wolfram.com/language/ref/FindGraphPartition.html (updated 2015).
CMS
Wolfram Language. 2012. "FindGraphPartition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FindGraphPartition.html.
APA
Wolfram Language. (2012). FindGraphPartition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindGraphPartition.html
BibTeX
@misc{reference.wolfram_2026_findgraphpartition, author="Wolfram Research", title="{FindGraphPartition}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FindGraphPartition.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_findgraphpartition, organization={Wolfram Research}, title={FindGraphPartition}, year={2015}, url={https://reference.wolfram.com/language/ref/FindGraphPartition.html}, note=[Accessed: 13-June-2026]}