def low_index_subgroups(G, N, Y=[]):
 C = CosetTable(G, [])
 R = G.relators()
 len_short_rel = 5
 R2 = set([rel for rel in R if (len(rel) > len_short_rel)])
 R1 = set([rel.identity_cyclic_reduction() for rel in (set(R) - R2)])
 R1_c_list = C.conjugates(R1)
 S = []
 descendant_subgroups(S, C, R1_c_list, C.A[0], R2, N, Y)
 return S

def low_index_subgroups ( G , N , Y = [ ] ) : C = CosetTable ( G , [ ] ) R = G . relators ( ) len_short_rel = 5 R2 = set ( [ rel for rel in R if ( len ( rel ) > len_short_rel ) ] ) R1 = set ( [ rel . identity_cyclic_reduction ( ) for rel in ( set ( R ) - R2 ) ] ) R1_c_list = C . conjugates ( R1 ) S = [ ] descendant_subgroups ( S , C , R1_c_list , C . A [ 0 ] , R2 , N , Y ) return S
implements the low index subgroups algorithm .