GAP function to convert a subgroup lattice to a simple graph?

Here is a way to construct such a graph with the GRAPE package, starting with subgroup class representatives as seeds:

gap> G:=SymmetricGroup(4);; # or whatever group you want
gap> cl:=ConjugacyClassesSubgroups(G);;
gap> reps:=List(cl,Representative);;
gap> gamma:=Graph(G,reps,OnPoints,IsSubset);;

Here we use that the group G acts on its subgroups, reps contains representatives of all orbits, the action of a group element on a subgroup is by OnPoints (i.e. via the ^ operator), and the edge relation we want is given by IsSubset. (If you want to revert the relation use

function(x,y) return IsSubset(y,x);end

instead. If you want to make the graph undirected use

function(x,y) return IsSubset(y,x) or IsSubset(y,x);end

instead. Now the graph gamma contains a component names that gives the correspondence of subgroups to index numbers.


You might look at DotFileLatticeSubgroups, which outputs the subgroup lattice to a dot file visualizable by GraphViz. It'd be easy to modify this (or alternatively, to postprocess its output) to get a list of vertices and edges. I agree that it'd be nice to have a clean way to get a list of edges out of a subgroup lattice sheet. Perhaps something under the Poset menu?

PS: You mention xgap. If you have a Mac handy, you might enjoy my slightly more modern take, Gap.app

UPDATE: I wrote a function that will take a GraphicSubgroupLattice and return a list of edges of the represented Hasse diagram. To use it, type
L:=GraphicSubgroupLattice(DihedralGroup(8));
then get the subgroups you'd like to look at in the Hasse diagram (e.g. by doing Subgroups | All Subgroups), then type
GraphicLatticeToGraph(L);
I expect that it will also work with other poset objects in xgap/Gap.app, but have not tested it.

The function follows.

GraphicLatticeToGraph:=function(L)
  local Gr, lev, cl, H, M;

  Gr:=[];

  for lev in L!.levels do
    for cl in lev!.classes do
      for H in cl do
        for M in H!.maximals do
          AddSet(Gr, [M!.label, H!.label]);
        od;
      od;
    od;
  od;
  return Gr;
end;