Opened 12 years ago

Closed 12 years ago

#6858 closed defect (fixed)

[with patch, positive review] Cayley graph connecting set

Reported by: rlm Owned by: rlm
Priority: major Milestone: sage-4.1.2
Component: graph theory Keywords:
Cc: Merged in: Sage 4.1.2.alpha2
Authors: Robert Miller Reviewers: Nathann Cohen
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Reported by Chris Godsil.

Attachments (1)

trac_6858.patch (2.6 KB) - added by rlm 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by ncohen

Hmmm.. I may have done something wrong, but here is what I tried

sage: g=PermutationGroup([(i+1,j+1) for i in range(5) for j in range(5) if j!=i])
sage: (1,2) in g
True
sage: (2,3) in g
True
sage: g.cayley_graph(connecting_set=[(1,2),(2,3)])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/user/ncohen/home/.sage/temp/rebelote.inria.fr/4013/_user_ncohen_home__sage_init_sage_0.py in <module>()

/usr/local/sage/local/lib/python2.6/site-packages/sage/groups/group.so in sage.groups.group.FiniteGroup.cayley_graph (sage/groups/group.c:2157)()

/usr/local/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:8537)()

TypeError: unsupported operand parent(s) for '*': 'Permutation Group with generators [(4,5), (3,4), (3,5), (2,3), (2,4), (2,5), (1,2), (1,3), (1,4), (1,5)]' and '<type 'tuple'>'

Even though it's apparent I know very few about groups in Sage as I had to build S_n by enumerating generators ( I guess there is a command to do that with only the cardinal ? ) ;

comment:2 Changed 12 years ago by ncohen

  • Summary changed from [with patch, needs review] Cayley graph connecting set to [with patch, needs work] Cayley graph connecting set

Changed 12 years ago by rlm

comment:3 Changed 12 years ago by rlm

  • Summary changed from [with patch, needs work] Cayley graph connecting set to [with patch, needs review] Cayley graph connecting set

OK, this new patch should do the trick.

comment:4 Changed 12 years ago by ncohen

  • Summary changed from [with patch, needs review] Cayley graph connecting set to [with patch, positive review] Cayley graph connecting set

Applies fine, documented,does its job.... Positive review ! ;-)

When testing the patch, I tried ( among others ) :

sage: len(g.cayley_graph(connecting_set=[(1,2)]).connected_components())
60
sage: len(g.cayley_graph(connecting_set=[(1,2),(2,3)]).connected_components())
20
sage: len(g.cayley_graph(connecting_set=[(1,2),(2,3),(3,4)]).connected_components())
5

If you think it useful, it could also be included in the examples contained in the docstring, even though there are already two and it may not be necessary at all :-)

Nathann

comment:5 Changed 12 years ago by mvngu

  • Merged in set to Sage 4.1.2.alpha2
  • Resolution set to fixed
  • Reviewers set to Nathann Cohen
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.