Class Combinatorial
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
Provides combinatorial algorithms for generating tuples, combinations, permutations, and partitions.
[Version(1, 4, 0)]
public static class Combinatorial
- Inheritance
-
Combinatorial
- Inherited Members
Remarks
Except for PowerSet<T>(IEnumerable<T>), all methods are implemented after Knuth, described in The Art of Computer Programming, Volume 4.
Methods
- Combinations<T>(IEnumerable<T>, int)
Generates all combinations of m elements selected from the list.
- Combinations<T>(int, int, Func<int[], T>)
Generates all combinations of m elements from n and applies a selector to each.
- MultiRadixTuples(int[])
Generates all tuples with mixed radixes.
- MultiRadixTuples<T>(IEnumerable<IEnumerable<T>>)
Generates all combinations by selecting one element from each inner enumerable in every possible way.
- Partitions<T>(IEnumerable<T>)
Returns all the set partitions of the given 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, all possible subsets of the input.
- Tuples(int)
Generates all possible tuples of length n with digits 0 to n-1.
- Tuples<T>(int, Func<int[], T>)
Generates n-tuples of integers 0 to n-1 and applies the selector to them.