Subgroup method


The subgroup method is an algorithm used in the mathematical field of group theory. It is used to find the word of an element. It doesn't always return the minimal word, but it can return optimal words based on the series of subgroups that is used. The code looks like this:
function operate
generator operated on element>

function subgroup
sequence :=
word :=
for subgroup in sequence
coset_representatives :=
coset representatives of /subgroup>
for operation in coset_representatives
if operate is in the next subgroup then
append operation onto word
g = operate
break
return word