[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Subsets of a Finite Set

Subsets of a Finite Set

Subsets(S) : SetEnum -> SetEnum
The set of all subsets of the set S.
Subsets(S, k) : SetEnum, RngIntElt -> SetEnum
The set of subsets of S of size k. If k is larger than the cardinality of S then the result will be empty.
Multisets(S, k) : SetEnum, RngIntElt -> SetEnum
The set of multisets consisting of k not necessarily distinct elements of S.
Subsequences(S, k) : SetEnum, RngIntElt -> SetEnum
The set of sequences of length k with elements from S.
Permutations(S) : SetEnum -> SetEnum;
The set of permutations (stored as sequences) of the elements of S.
Permutations(S, k) : SetEnum, RngIntElt -> SetEnum;
The set of permutations (stored as sequences) of each of the subsets of S of cardinality k.

Example EnumComb_OddGraph (H54E1)

The use of Subsets is illustrated in the construction of the Petersen graph as the third Odd Graph. The nth Odd Graph has its vertices in correspondence with the n - 1 element subsets of { 1 ... 2n - 1 }, and an edge between two vertices iff their corresponding sets have empty intersection.

> V := Subsets( {1 .. 2*n-1}, n-1) where n is 3;
> V;
{
    { 1, 5 },
    { 2, 5 },
    { 1, 3 },
    { 1, 4 },
    { 2, 4 },
    { 3, 5 },
    { 2, 3 },
    { 1, 2 },
    { 3, 4 },
    { 4, 5 }
}
> E := { {u, v} : u,v in V | IsDisjoint(u, v) };
> Petersen := Graph< V | E >;

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]