0

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;
Paul
  • 26,170
  • 12
  • 85
  • 119
Babgen
  • 113
  • 3

1 Answers1

0

Here are Sage equivalents to some of these commands. Incidentally, we use GAP for the group calculations!

sage: D = DihedralGroup(5)
sage: D.subgroups()
[Permutation Group with generators [()], Permutation Group with generators [(2,5)(3,4)], Permutation Group with generators [(1,2)(3,5)], Permutation Group with generators [(1,3)(4,5)], Permutation Group with generators [(1,4)(2,3)], Permutation Group with generators [(1,5)(2,4)], Permutation Group with generators [(1,2,3,4,5)], Permutation Group with generators [(1,5,4,3,2), (1,5)(2,4)]]
sage: divisors(D.cardinality())
[1, 2, 5, 10]

To make graphs in Sage, you can pass dictionaries of lists or other things; see

sage: Graph?

for more information on that.

Edit - left in to make comments comprehensible:

By the way, it looks like you are trying to make a list of pairs of subgroups A and B such that |A||B|=ord(G). Is that necessarily the same as groups whose sum (whatever you mean by that - direct sum?) is the original group? I'm thinking for instance of even a group of order four; summing any two subgroups of order two may not be isomorphic to the original group - for instance, if the two subgroups are the same one if you mean some sort of ambient sum (does this even make sense?), or if you use direct sum but the group is the cyclic group of order 4, not the Klein four group.

kcrisman
  • 4,374
  • 20
  • 41
  • Sum means operator of group. For example let G be Klein four group {1,a,b,ab}. Klein four group has 2 subgroup A={1,a} and B={1,b} so AB=G how can I define my graph? – Babgen Oct 16 '12 at 13:28
  • Oh, you don't mean sum at all, but group product (not even semi direct, just elementwise), okay. Same problem, though; for the same subgroups of an order four group, your code wouldn't necessarily give such pairs - just candidates for that. Presumably to do this one would need to know whether there even was an easy way to do a group product in GAP, let alone Sage. I don't know this. – kcrisman Oct 17 '12 at 01:50