Are you reinventing the wheel? :-)

One should be able to import into Sage any graph that GAP can make
using its package Grape. Grape is essentially doing what you seem to
be doing: takes a permutation group and constructs a graph invariant
under it.
E.g.
gap> LoadPackage("grape");
gap> G:=NullGraph(DihedralGroup(IsPermGroup,20),10);
rec( isGraph := true, order := 10,
  group := Group([ (1,2,3,4,5,6,7,8,9,10), (2,10)(3,9)(4,8)(5,7) ]),
  schreierVector := [ -1, 1, 1, 1, 1, 1, 2, 2, 2, 2 ], adjacencies :=
[ [  ] ],
  representatives := [ 1 ], isSimple := true )
gap> AddEdgeOrbit(G,[1,2]);
gap> G;
rec( isGraph := true, order := 10,
  group := Group([ (1,2,3,4,5,6,7,8,9,10), (2,10)(3,9)(4,8)(5,7) ]),
  schreierVector := [ -1, 1, 1, 1, 1, 1, 2, 2, 2, 2 ],
  adjacencies := [ [ 2, 10 ] ], representatives := [ 1 ], isSimple :=
true )
gap> AddEdgeOrbit(G,[1,3]);
gap> G;
rec( isGraph := true, order := 10,
  group := Group([ (1,2,3,4,5,6,7,8,9,10), (2,10)(3,9)(4,8)(5,7) ]),
  schreierVector := [ -1, 1, 1, 1, 1, 1, 2, 2, 2, 2 ],
  adjacencies := [ [ 2, 3, 9, 10 ] ], representatives := [ 1 ],
isSimple := true )

we thus constructed a vertex-transitive degree 4 graph on 10 vertices,
with the dihedral group of order 20 as an automorphism group.

Unfortunately Sage does not handle graphs that are specified by edge
orbits, last time I checked.

Dima


On Nov 24, 6:28 pm, Nathann Cohen <nathann.co...@gmail.com> wrote:
> Hello everybody !!!
>
> Working on Minh's patches for new graph generators, I had to create
> Dihedral groups, which took me more than.... half a second. Which mean
> it can be improved :-D
>
> More seriously, the way I found to create them was to use the
> DihedralGroup() method, which one does not have to import first. It is
> nice, but it also means that I still do not know how to list all the
> group Sage knows how to build.. Well, for graphs and words we already
> have something nice :
>
> We create a graph/word with the Graph/Word constructor, which appears
> in the namespace. If we omit the upper case, we have a graphs/words
> object, whose methods are the different constructors of graphs/words.
> So graphs.<tab>/words.<tab> gives you the list of all constructors,
> which is the best way to find one quickly. What about doing the same
> with groups, or finding a common way to organise this ? :-)
>
> Nathann
>
> P.S. (if anybody has any smart idea about how to deal with classes
> having *far too many* different methods, I am also very interested.
> Something will have to be decided soon for the Graph class anyway...
> :-/ )

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to