Table of Contents

Class Combinatorial

Namespace
Gamelogic.Extensions.Algorithms
Assembly
Gamelogic.Extensions.dll

Combinatorial algorithms, including generating tuples, combinations, permutations and partitions.

Except for PowerSet, all methods are implemented after Knuth, described in The Art of Computer Programming Volume 4.

[Version(1, 4, 0)]
public static class Combinatorial
Inheritance
Combinatorial
Inherited Members

Methods

Combinations<T>(IEnumerable<T>, int)

Generates all combinations of m elements selected from the list.

Combinations<T>(int, int, Func<int[], T>)
MultiRadixTuples(int[])

Generates all tuples with mixed radixes.

MultiRadixTuples<T>(IEnumerable<IEnumerable<T>>)
Partitions<T>(IEnumerable<T>)

Returns a list of all the partitions of a list.

Permutations(int)

Generates all permutations of the numbers 0 to n - 1.

Permutations<T>(IEnumerable<T>)

Generates all permutations of the list of elements.

PowerSet<T>(IEnumerable<T>)

Returns the power set of the input, that is, the set of all subsets of the input.

Tuples(int)

Generate all possible tuples of length n with digits 0 to n-1.

Tuples<T>(IEnumerable<T>)
Tuples<T>(int, Func<int[], T>)

Generates n-tuples of integers 0 to n-1 and applies the selector to them.