The gap.eval's can be removed like this:

C3 = CyclicPermutationGroup(3)._gap_()
C = C3.CayleyGraph(C3.GeneratorsOfGroup())
V = C.Vertices().Elements()
E = C.UndirectedEdges()
L = [[y[1] for y in [x for x in E if v in x] if y[1]!=v]+[y[2]
for y in [x for x in E if v in x] if y[2]!=v] for v in V]
d = dict(zip(V,L))
G = Graph(d)
show(G.plot())

GAP lists are indexed from 1, not 0, so I changed the line for L.
This was needed to get it to work on https://sage.math.washington.edu:8103/

On Aug 6, 7:46 am, "David Joyner" <[EMAIL PROTECTED]> wrote:
> Here is an example of constructing a Cayley graph in SAGE (this uses grape):
>
> sage: gap.eval("C := CayleyGraph(Group([(1,2,3)]),[(1,2,3)])")
> 'rec( isGraph := true, order := 3, group := Group([ (1,2,3) ]), \n
> schreierVector := [ -1, 1, 1 ], adjacencies := [ [ 2, 3 ] ], \n
> representatives := [ 1 ], names := [ (), (1,2,3), (1,3,2) ], \n
> isSimple := true )'
> sage: V = eval(gap.eval("Elements(Vertices(C))"))
> sage: E = eval(gap.eval("UndirectedEdges(C)"))
> sage: L = [[y[0] for y in [x for x in E if v in x] if y[0]!=v]+[y[1]
> for y in [x for x in E if v in x] if y[1]!=v] for v in V]
> sage: d = dict(zip(V,L))
> sage: G = Graph(d)
> sage: show(G.plot())
>
> Question: Can anyone this of a simpler way to do this?
>
> - David Joyner


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to