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]

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 ]
computes a transversal for the orbit of alpha as a set .