combinat-0.2.6.2: Generation of various combinatorial objects.

Safe HaskellNone
LanguageHaskell98

Math.Combinat.Partitions.Set

Contents

Description

Synopsis

The type of set partitions

newtype SetPartition Source

A partition of the set [1..n] (in standard order)

Constructors

SetPartition [[Int]] 

Generating set partitions

setPartitionsWithKParts Source

Arguments

:: Int

k = number of parts

-> Int

n = size of the set

-> [SetPartition] 

Synonym for setPartitionsWithKPartsNaive

sort (setPartitionsWithKParts k n) == sort [ p | p <- setPartitions n , numberOfParts p == k ]

setPartitionsNaive :: Int -> [SetPartition] Source

List all set partitions of [1..n], naive algorithm

setPartitionsWithKPartsNaive Source

Arguments

:: Int

k = number of parts

-> Int

n = size of the set

-> [SetPartition] 

Set partitions of the set [1..n] into k parts

countSetPartitions :: Int -> Integer Source

Set partitions are counted by the Bell numbers

countSetPartitionsWithKParts Source

Arguments

:: Int

k = number of parts

-> Int

n = size of the set

-> Integer 

Set partitions of size k are counted by the Stirling numbers of second kind