1 | initial version |
Here's a way:
n = 12
G = AdditiveAbelianGroup([n])
from collections import defaultdict
subgroup_gens = defaultdict(list)
for g in G:
subgroup_gens[G.submodule([g])].append(ZZ(g[0]))
mylabel = lambda H: LatexExpr('$' + '='.join('\\langle ' + str(g) + ' \\rangle' for g in subgroup_gens[H]) + '$')
Graph([(mylabel(H),mylabel(K)) for H in subgroup_gens.keys() for K in subgroup_gens.keys() if H != K and H.is_submodule(K)]).plot(figsize=6)