Set partition

List all partitions a set n elements
Updated 12 Dec 2020

View License

A set of of n elements can be partitioned in non empty subsets.

This package provide function to list all possible partitions. The number of partition is Bell's number.

The number of subsets that composed the partitions can be optionally specified. The number of partition is Stirling's number of the second kind.

Cite As

Bruno Luong (2024). Set partition (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: PARTITIONS


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Correct formating of cell of numeric

Partitions display function

Possibility to partition generic set elements (following Matt Fig's idea). New function to replace elements of a standard set partitioning list

Correct a BUG for N=0. Minor speed improvement.

Improve engine and example usage in the help as suggested Darren Rowland