I want define new graph in sage. Let G be finite group. The graph's vertices are subgroup and two vertices are adjacent if and only if sum of two subgroup is G.
I have trouble with define this graph in sage. Any suggestion? I have idea in gap but I don't have idea what can I change in sage?
Summands := function(G)
local n, i, sgl, l, A, B, D;
obtain a list of all subgroups
sgl := List(LatticeSubgroups(G)!.conjugacyClassesSubgroups, Representative);
n is the number of divisors of |G|
n := Size(DivisorsInt(Size(G)));
D := [];
if IsOddInt(n) then l := QuoInt(n + 1, 2);
else l := QuoInt(n, 2);
fi;
for i in [1..l] do
for A in Filtered(sgl, function(g) return Size(g) = DivisorsInt(Size(G))[i]; end) do
for B in Filtered(sgl, function(g) return Size(g) = DivisorsInt(Size(G))[n+1-i]; end) do
Add(D, [A, B]);
od;
od;
od;
return D;
end;