# Create graph

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;
```

As I said on stackoverflow, this assumes that the group product of any two subgroups whose orders multiply to the order of the group is the original group, but this is not the case. For instance, when |G|=4 and n=3 and l=2 and i=2, the subgroups could be the SAME subgroup, and naturally the product of BB = B, since there is an identity in any subgroup and group multiplication is closed.