Ask Your Question

Revision history [back]

Unfortunately, if you start defining your groups the "normal" way with groups.misc.AdditiveCyclic, you will not find a way to construct subgroups (at least i did not find any subgroup method or similar). So, you will have to use permuation groups (they can compute subgroups) wich is already a workaround.

So, let me suggest to work directly with this basic property of cyclic groups:

$\langle i \rangle \subseteq \langle j \rangle$ in $\mathbb{Z}_n$ if, and only if, $gcd(j,n) | gcd(i,n)$ (where $|$ stands for "divides").

Hence, the following code should do the trick:

def gr(n):
    G = Graph(n)
    for i in range(n):
        for j in range(i+1,n):
            a,b = gcd(i,n), gcd(j,n)
            if (a.divides(b) or b.divides(a)) and a != b:
    return G

Then, you can do: