Group action

241 views
Skip to first unread message

Nathann Cohen

unread,
May 14, 2012, 10:57:40 AM5/14/12
to Sage Support
Hellooooooo everybody !!!

I would like to play with groups in Sage but I do not know how. I
actually get my groups from a graph in the following way :

sage: g = graphs.PetersenGraph()
sage: ag = g.automorphism_group()
sage: type(ag)
<class 'sage.groups.perm_gps.permgroup.PermutationGroup_generic_with_category'>

What I would like to do with this group is to consider it as a group
action on my vertices and compute the orbits of some *sets* of
vertices. Indeed, the method ag.orbits() would give me the list of all
orbits of my vertices, but I would like to compute the orbit of a Set
of vertices, that is all sets of the form "gg * my_set for gg in ag".

Is there any way to achieve it with Sage ?

Thaank youuuuuuuuuuuuuuuuuuuuuuuuuu !!!!

Nathann

David Joyner

unread,
May 14, 2012, 4:55:28 PM5/14/12
to sage-s...@googlegroups.com
The short answer is yes, if you use GAP. The problem is that I don't
know the syntax for group actions in GAP well enough to give you a
beter answer quickly. If you post a specific question to GAP support, I think
it would be answered immediately.


>
> Thaank youuuuuuuuuuuuuuuuuuuuuuuuuu !!!!
>
> Nathann
>
> --
> To post to this group, send email to sage-s...@googlegroups.com
> To unsubscribe from this group, send email to sage-support...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

Dima Pasechnik

unread,
May 14, 2012, 7:02:46 PM5/14/12
to sage-s...@googlegroups.com
Well, you can call GAP,  e.g. as follows:

sage: gap("Orbit("+str(ag._gap_())+",[1,2,7],OnSets);")
[ [ 1, 2, 7 ], [ 1, 2, 3 ], [ 1, 6, 9 ], [ 2, 3, 4 ], [ 3, 4, 10 ], 
  [ 1, 6, 8 ], [ 3, 4, 8 ], [ 4, 9, 10 ], [ 4, 7, 9 ], [ 5, 8, 10 ], 
  [ 2, 5, 7 ], [ 5, 6, 8 ], [ 3, 5, 8 ], [ 4, 6, 9 ], [ 5, 7, 10 ], 
  [ 5, 7, 9 ], [ 6, 7, 9 ], [ 3, 6, 8 ], [ 1, 6, 10 ], [ 2, 7, 9 ], 
  [ 1, 2, 10 ], [ 2, 3, 8 ], [ 6, 8, 9 ], [ 1, 5, 10 ], [ 2, 3, 7 ], 
  [ 1, 4, 10 ], [ 5, 7, 8 ], [ 3, 4, 9 ], [ 4, 5, 10 ], [ 1, 2, 6 ] ]
sage: 
 

Thaank youuuuuuuuuuuuuuuuuuuuuuuuuu !!!!

Nathann

Dima Pasechnik

unread,
May 14, 2012, 7:04:59 PM5/14/12
to sage-s...@googlegroups.com
PS. it should not be hard to expand the ag.orbit method to incorporate the action type...

 

Thaank youuuuuuuuuuuuuuuuuuuuuuuuuu !!!!

Nathann

Emil

unread,
May 14, 2012, 9:02:07 PM5/14/12
to sage-s...@googlegroups.com
One thing to watch out for is that the generators returned by automorphism_group contain symbols that may not be the actual vertices. I realised this once after several frustrating hours of bizarre results from my program. I'm not sure if this is still the case in recent versions. 

Emil
--

Nathann Cohen

unread,
May 15, 2012, 2:20:33 AM5/15/12
to sage-s...@googlegroups.com
> One thing to watch out for is that the generators returned by
> automorphism_group contain symbols that may not be the actual vertices. I
> realised this once after several frustrating hours of bizarre results from
> my program. I'm not sure if this is still the case in recent versions.

Yep. I wasted 30 minutes easily on that one too. Actually the elements
are always 1...n regardless of the graph's labelling (which often
starts at 0). That's a shame.

Nathann

Mike Hansen

unread,
May 15, 2012, 2:31:37 AM5/15/12
to sage-s...@googlegroups.com
This is because permutation groups used to not support arbitrary
domains. Since they do now, it should be easy to return an
automorphism group that actually acts on the vertices.

--Mike

Nathann Cohen

unread,
May 15, 2012, 3:54:15 AM5/15/12
to sage-s...@googlegroups.com
> Well, you can call GAP,  e.g. as follows:
>
> sage: gap("Orbit("+str(ag._gap_())+",[1,2,7],OnSets);")
> [ [ 1, 2, 7 ], [ 1, 2, 3 ], [ 1, 6, 9 ], [ 2, 3, 4 ], [ 3, 4, 10 ],
>   [ 1, 6, 8 ], [ 3, 4, 8 ], [ 4, 9, 10 ], [ 4, 7, 9 ], [ 5, 8, 10 ],
>   [ 2, 5, 7 ], [ 5, 6, 8 ], [ 3, 5, 8 ], [ 4, 6, 9 ], [ 5, 7, 10 ],
>   [ 5, 7, 9 ], [ 6, 7, 9 ], [ 3, 6, 8 ], [ 1, 6, 10 ], [ 2, 7, 9 ],
>   [ 1, 2, 10 ], [ 2, 3, 8 ], [ 6, 8, 9 ], [ 1, 5, 10 ], [ 2, 3, 7 ],
>   [ 1, 4, 10 ], [ 5, 7, 8 ], [ 3, 4, 9 ], [ 4, 5, 10 ], [ 1, 2, 6 ] ]

THaaaaaaaank you Dima !! I finally got it to work thanks to you....
Too me some time to find out that Gap would return a totally weird
error message if the list you give as an argument is not sorted, and I
guess most of the time it takes to run the computation is devoted to
translating Gap object to Sage ones afterwards, but.... It works !!
;-))))

(But Gap definitely has the worst syntax ever)

Nathann

Dima Pasechnik

unread,
May 15, 2012, 5:19:52 AM5/15/12
to sage-s...@googlegroups.com


On Tuesday, 15 May 2012 09:54:15 UTC+2, Nathann Cohen wrote:
> Well, you can call GAP,  e.g. as follows:
>
> sage: gap("Orbit("+str(ag._gap_())+",[1,2,7],OnSets);")
> [ [ 1, 2, 7 ], [ 1, 2, 3 ], [ 1, 6, 9 ], [ 2, 3, 4 ], [ 3, 4, 10 ],
>   [ 1, 6, 8 ], [ 3, 4, 8 ], [ 4, 9, 10 ], [ 4, 7, 9 ], [ 5, 8, 10 ],
>   [ 2, 5, 7 ], [ 5, 6, 8 ], [ 3, 5, 8 ], [ 4, 6, 9 ], [ 5, 7, 10 ],
>   [ 5, 7, 9 ], [ 6, 7, 9 ], [ 3, 6, 8 ], [ 1, 6, 10 ], [ 2, 7, 9 ],
>   [ 1, 2, 10 ], [ 2, 3, 8 ], [ 6, 8, 9 ], [ 1, 5, 10 ], [ 2, 3, 7 ],
>   [ 1, 4, 10 ], [ 5, 7, 8 ], [ 3, 4, 9 ], [ 4, 5, 10 ], [ 1, 2, 6 ] ]

THaaaaaaaank you Dima !! I finally got it to work thanks to you....
Too me some time to find out that Gap would return a totally weird
error message if the list you give as an argument is not sorted, and I
guess most of the time it takes to run the computation is devoted to

IMHO most of the time is spent on IPC, via pexpect...

Nathann Cohen

unread,
May 15, 2012, 4:50:35 PM5/15/12
to sage-s...@googlegroups.com
> IMHO most of the time is spent on IPC, via pexpect...

Oh, *THAT* is pexpect ? Then I guess I begin to understand why there
was so much fuss about it being slow some time ago ^^;

Nathann
Reply all
Reply to author
Forward
0 new messages