allstructs - Maple Help

combstruct

 allstructs
 list all the combinatorial objects of a specified size

 Calling Sequence allstructs([A, spec, typ], size=n) allstructs(struct(args), size=n)

Parameters

 A - nonterminal of spec spec - combinatorial specification typ - labeling type; 'labeled' or 'unlabeled', the default is 'unlabeled' n - non-negative integer specifying the size of the object or string 'allsizes' struct - one of a predefined list of available structures args - argument list that corresponds to the structure struct

Description

 • The allstructs command returns all elements of the combinatorial class of the specified size.
 • It returns a list, except in some instances with the structure Subset (combination). If the argument to Subset is a set, allstructs returns a set of the subsets.
 • If the size is not specified, the default size for the structure is used. The size must be specified when working with grammar specifications.
 Use the string 'allsizes' which is available only for predefined structures when all possible sizes should be generated.
 • For information on how to create an iterator for these structures that produces one element at a time rather than returning all of them at once, see combstruct[iterstructs].
 • For a list of available structures, see combstruct[structures].

Examples

 > $\mathrm{with}\left(\mathrm{combstruct}\right):$
 > $\mathrm{allstructs}\left(\mathrm{Subset}\left(\left\{\mathrm{red},\mathrm{blue}\right\}\right)\right)$
 $\left\{{\varnothing }{,}\left\{{\mathrm{blue}}\right\}{,}\left\{{\mathrm{red}}\right\}{,}\left\{{\mathrm{blue}}{,}{\mathrm{red}}\right\}\right\}$ (1)
 > $\mathrm{allstructs}\left(\mathrm{Permutation}\left(\left[a,b,c\right]\right),\mathrm{size}=2\right)$
 $\left[\left[{a}{,}{b}\right]{,}\left[{a}{,}{c}\right]{,}\left[{b}{,}{a}\right]{,}\left[{b}{,}{c}\right]{,}\left[{c}{,}{a}\right]{,}\left[{c}{,}{b}\right]\right]$ (2)
 > $\mathrm{allstructs}\left(\left[T,\left\{T=\mathrm{Prod}\left(Z,\mathrm{PowerSet}\left(T\right)\right)\right\},\mathrm{unlabeled}\right],\mathrm{size}=6\right)$
 $\left[{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right)\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{PowerSet}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right){,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Ε}}\right)\right)\right)\right]$ (3)