GraphLib
2.0
une librairie C# pour l’exploitation de graphes en reconnaissance des formes
|
Permutations defines a meta-collection, typically a list of lists, of all possible orderings of a set of values. This list is enumerable and allows the scanning of all possible permutations using a simple foreach() loop. The MetaCollectionType parameter of the constructor allows for the creation of two types of sets, those with and without repetition in the output set when presented with repetition in the input set. More...
Classes | |
class | Enumerator |
The enumerator that enumerates each meta-collection of the enclosing Permutations class. More... | |
Public Member Functions | |
Permutations (IList< T > values) | |
Create a permutation set from the provided list of values. The values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets More... | |
Permutations (IList< T > values, GenerateOption type) | |
Create a permutation set from the provided list of values. If type is MetaCollectionType.WithholdRepetitionSets, then values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer. More... | |
Permutations (IList< T > values, IComparer< T > comparer) | |
Create a permutation set from the provided list of values. The values will be compared using the supplied IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets More... | |
virtual IEnumerator | GetEnumerator () |
Gets an enumerator for collecting the list of permutations. More... | |
Protected Member Functions | |
Permutations () | |
No default constructor, must at least provided a list of values. More... | |
Properties | |
long | Count [get] |
The count of all permutations that will be returned. If type is MetaCollectionType.WithholdGeneratedSets, then this does not double count permutations with multiple identical values. I.e. count of permutations of "AAB" will be 3 instead of 6. If type is MetaCollectionType.WithRepetition, then this is all combinations and is therefore N!, where N is the number of values. More... | |
GenerateOption | Type [get] |
The type of Permutations set that is generated. More... | |
int | UpperIndex [get] |
The upper index of the meta-collection, equal to the number of items in the initial set. More... | |
int | LowerIndex [get] |
The lower index of the meta-collection, equal to the number of items returned each iteration. For Permutation, this is always equal to the UpperIndex. More... | |
![]() | |
long | Count [get] |
The count of items in the collection. This is not inherited from ICollection since this meta-collection cannot be extended by users. More... | |
GenerateOption | Type [get] |
The type of the meta-collection, determining how the collections are determined from the inputs. More... | |
int | UpperIndex [get] |
The upper index of the meta-collection, which is the size of the input collection. More... | |
int | LowerIndex [get] |
The lower index of the meta-collection, which is the size of each output collection. More... | |
Permutations defines a meta-collection, typically a list of lists, of all possible orderings of a set of values. This list is enumerable and allows the scanning of all possible permutations using a simple foreach() loop. The MetaCollectionType parameter of the constructor allows for the creation of two types of sets, those with and without repetition in the output set when presented with repetition in the input set.
When given a input collect {A A B}, the following sets are generated: MetaCollectionType.WithRepetition => {A A B}, {A B A}, {A A B}, {A B A}, {B A A}, {B A A} MetaCollectionType.WithoutRepetition => {A A B}, {A B A}, {B A A}
When generating non-repetition sets, ordering is based on the lexicographic ordering of the lists based on the provided Comparer. If no comparer is provided, then T must be IComparable on T.
When generating repetition sets, no comparisions are performed and therefore no comparer is required and T does not need to be IComparable.
T | The type of the values within the list. |
|
protected |
No default constructor, must at least provided a list of values.
Matching.Permutations< T >.Permutations | ( | IList< T > | values | ) |
Create a permutation set from the provided list of values. The values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets
values | List of values to permute. |
Matching.Permutations< T >.Permutations | ( | IList< T > | values, |
GenerateOption | type | ||
) |
Create a permutation set from the provided list of values. If type is MetaCollectionType.WithholdRepetitionSets, then values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer.
values | List of values to permute. |
type | The type of permutation set to calculate. |
Matching.Permutations< T >.Permutations | ( | IList< T > | values, |
IComparer< T > | comparer | ||
) |
Create a permutation set from the provided list of values. The values will be compared using the supplied IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets
values | List of values to permute. |
comparer | Comparer used for defining the lexigraphic order. |
|
virtual |
Gets an enumerator for collecting the list of permutations.
|
get |
The count of all permutations that will be returned. If type is MetaCollectionType.WithholdGeneratedSets, then this does not double count permutations with multiple identical values. I.e. count of permutations of "AAB" will be 3 instead of 6. If type is MetaCollectionType.WithRepetition, then this is all combinations and is therefore N!, where N is the number of values.
|
get |
The lower index of the meta-collection, equal to the number of items returned each iteration. For Permutation, this is always equal to the UpperIndex.
|
get |
The type of Permutations set that is generated.
|
get |
The upper index of the meta-collection, equal to the number of items in the initial set.