(degree, generators, alpha, pairs, af=False)
return [_af_new(y) for _, y in tr]
r"""Computes a transversal for the orbit of ``alpha`` as a set.

    generators   generators of the group ``G``

    For a permutation group ``G``, a transversal for the orbit
    ``Orb = \{g(\alpha) | g \in G\}`` is a set
    ``\{g_\beta | g_\beta(\alpha) = \beta\}`` for ``\beta \in Orb``.
    Note that there may be more than one possible transversal.
    If ``pairs`` is set to ``True``, it returns the list of pairs
    ``(\beta, g_\beta)``. For a proof of correctness, see [1], p.79

    if af is True, the transversal elements are given in array form

    Examples
    ========

    >>> from sympy.combinatorics import Permutation
    >>> Permutation.print_cyclic = True
    >>> from sympy.combinatorics.named_groups import DihedralGroup
    >>> from sympy.combinatorics.perm_groups import _orbit_transversal
    >>> G = DihedralGroup(6)
    >>> _orbit_transversal(G.degree, G.generators, 0, False)
        [Permutation(5),
         Permutation(0, 1, 2, 3, 4, 5),
         Permutation(0, 5)(1, 4)(2, 3),
         Permutation(0, 2, 4)(1, 3, 5),
         Permutation(5)(0, 4)(1, 3),
         Permutation(0, 3)(1, 4)(2, 5)]
r"""Computes a transversal for the orbit of ``alpha`` as a set.
r Computes a transversal for the orbit of alpha as a set .
def _orbit_transversal(degree, generators, alpha, pairs, af=False):
    r"""Computes a transversal for the orbit of ``alpha`` as a set.

    generators   generators of the group ``G``

    For a permutation group ``G``, a transversal for the orbit
    ``Orb = \{g(\alpha) | g \in G\}`` is a set
    ``\{g_\beta | g_\beta(\alpha) = \beta\}`` for ``\beta \in Orb``.
    Note that there may be more than one possible transversal.
    If ``pairs`` is set to ``True``, it returns the list of pairs
    ``(\beta, g_\beta)``. For a proof of correctness, see [1], p.79

    if af is True, the transversal elements are given in array form

    Examples
    ========

    >>> from sympy.combinatorics import Permutation
    >>> Permutation.print_cyclic = True
    >>> from sympy.combinatorics.named_groups import DihedralGroup
    >>> from sympy.combinatorics.perm_groups import _orbit_transversal
    >>> G = DihedralGroup(6)
    >>> _orbit_transversal(G.degree, G.generators, 0, False)
        [Permutation(5),
         Permutation(0, 1, 2, 3, 4, 5),
         Permutation(0, 5)(1, 4)(2, 3),
         Permutation(0, 2, 4)(1, 3, 5),
         Permutation(5)(0, 4)(1, 3),
         Permutation(0, 3)(1, 4)(2, 5)]
    """

    tr = [(alpha, list(range(degree)))]
    used = [False]*degree
    used[alpha] = True
    gens = [x._array_form for x in generators]
    for x, px in tr:
        for gen in gens:
            temp = gen[x]
            if used[temp] == False:
                tr.append((temp, _af_rmul(gen, px)))
                used[temp] = True
    if pairs:
        if not af:
            tr = [(x, _af_new(y)) for x, y in tr]
        return tr

    if af:
        return [y for _, y in tr]

    return [_af_new(y) for _, y in tr]
def _orbit_transversal ( degree , generators , alpha , pairs , af = False ) : tr = [ ( alpha , list ( range ( degree ) ) ) ] used = [ False ] * degree used [ alpha ] = True gens = [ x . _array_form for x in generators ] for x , px in tr : for gen in gens : temp = gen [ x ] if used [ temp ] == False : tr . append ( ( temp , _af_rmul ( gen , px ) ) ) used [ temp ] = True if pairs : if not af : tr = [ ( x , _af_new ( y ) ) for x , y in tr ] return tr if af : return [ y for _ , y in tr ] return [ _af_new ( y ) for _ , y in tr ]