def coset_enumeration_r(fp_grp, Y):
 C = CosetTable(fp_grp, Y)
 R = fp_grp.relators()
 A_dict = C.A_dict
 A_dict_inv = C.A_dict_inv
 p = C.p
 for w in Y:
  C.scan_and_fill(0, w)
 alpha = 0
 while (alpha < C.n):
  if (p[alpha] == alpha):
   for w in R:
    C.scan_and_fill(alpha, w)
    if (p[alpha] < alpha):
     break
   if (p[alpha] == alpha):
    for x in A_dict:
     if (C.table[alpha][A_dict[x]] is None):
      C.define(alpha, x)
  alpha += 1
 return C

def coset_enumeration_r ( fp_grp , Y ) : C = CosetTable ( fp_grp , Y ) R = fp_grp . relators ( ) A_dict = C . A_dict A_dict_inv = C . A_dict_inv p = C . p for w in Y : C . scan_and_fill ( 0 , w ) alpha = 0 while ( alpha < C . n ) : if ( p [ alpha ] == alpha ) : for w in R : C . scan_and_fill ( alpha , w ) if ( p [ alpha ] < alpha ) : break if ( p [ alpha ] == alpha ) : for x in A_dict : if ( C . table [ alpha ] [ A_dict [ x ] ] is None ) : C . define ( alpha , x ) alpha += 1 return C
this is easier of the two implemented methods of coset enumeration .