def _orbits(degree, generators):
 seen = set()
 orbs = []
 sorted_I = list(range(degree))
 I = set(sorted_I)
 while I:
  i = sorted_I[0]
  orb = _orbit(degree, generators, i)
  orbs.append(orb)
  I -= orb
  sorted_I = [i for i in sorted_I if (i not in orb)]
 return orbs

def _orbits ( degree , generators ) : seen = set ( ) orbs = [ ] sorted_I = list ( range ( degree ) ) I = set ( sorted_I ) while I : i = sorted_I [ 0 ] orb = _orbit ( degree , generators , i ) orbs . append ( orb ) I -= orb sorted_I = [ i for i in sorted_I if ( i not in orb ) ] return orbs
compute the orbits of g .