Learn R Programming

salso (version 0.1.9)

enumerate.partitions: Enumerate Partitions of a Set

Description

This function produces a matrix whose rows provide all possible partitions of the set of integers {0, 1, ..., n-1}. These partitions are provided as cluster labels, where two items are in the same subset (i.e., cluster) if their labels are equal.

Usage

enumerate.partitions(nItems)

Arguments

nItems

The size of the set {0, 1, ..., n-1}, i.e., n.

Value

A matrix of integers, where each row is a partition encoded as a vector of cluster labels.

Examples

Run this code
# NOT RUN {
enumerate.partitions(5)

# }

Run the code above in your browser using DataLab