#17132: Perfect Matchings for Graphs
-------------------------------------+-------------------------------------
       Reporter:  ayyer              |        Owner:
           Type:  task               |       Status:  new
       Priority:  minor              |    Milestone:  sage-6.4
      Component:  graph theory       |   Resolution:
       Keywords:  perfect            |    Merged in:  6.3
  matchings, graphs                  |    Reviewers:
        Authors:  Arvind Ayyer       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  36fd1151164215523d7d24c6713a53deae5c3b90
  public/ayyer/perfect_matchings     |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by ayyer):

 Based on email exchanges with ''nathann'' and ''vferay'', I want to give
 an option for the output to be treated as an element of the class
 {{{PerfectMatchings}}} (point (3) in the ticket). So I was playing with
 forcing the conversion.
 {{{
 sage: G = graphs.Grid2dGraph(3,2)
 sage: PM = G.perfect_matchings()
 sage: PM
 [[((1, 1), (2, 1)), ((1, 0), (2, 0)), ((0, 0), (0, 1))],
  [((2, 0), (2, 1)), ((1, 0), (1, 1)), ((0, 0), (0, 1))],
  [((2, 0), (2, 1)), ((0, 1), (1, 1)), ((0, 0), (1, 0))]]
 }}}
 However, this seems to give some funny errors. If I try to force each list
 to be an element of the class, I get
 {{{
 sage: [PerfectMatching(p) for p in PM]
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-13-a4d340e78f6e> in <module>()
 ----> 1 [PerfectMatching(p) for p in PM]

 /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7
 /site-packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
 (build/cythonized/sage/misc/classcall_metaclass.c:1282)()

 /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7
 /site-packages/sage/combinat/perfect_matching.pyc in
 __classcall_private__(cls, p)
     182             if len(objects) < 2*len(data):
     183                 raise ValueError("%s is not a valid perfect
 matching:\n"
 --> 184                                  "there are some repetitions" % p)
     185         # Second case: p is a permutation or a list of integers,
 we have to
     186         # check if it is a fix-point-free involution.

 ValueError: [((1, 1), (2, 1)), ((1, 0), (2, 0)), ((0, 0), (0, 1))] is not
 a valid perfect matching:
 there are some repetitions
 }}}
 If I first force it to be a tuple, I get another error
 {{{
 sage: [PerfectMatching(tuple(p)) for p in PM]
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-12-a67059f6b75f> in <module>()
 ----> 1 [PerfectMatching(tuple(p)) for p in PM]

 /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7
 /site-packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
 (build/cythonized/sage/misc/classcall_metaclass.c:1282)()

 /Applications/Sage-6.2.app/Contents/Resources/sage/local/lib/python2.7
 /site-packages/sage/combinat/perfect_matching.pyc in
 __classcall_private__(cls, p)
     182             if len(objects) < 2*len(data):
     183                 raise ValueError("%s is not a valid perfect
 matching:\n"
 --> 184                                  "there are some repetitions" % p)
     185         # Second case: p is a permutation or a list of integers,
 we have to
     186         # check if it is a fix-point-free involution.

 TypeError: not all arguments converted during string formatting
 }}}
 Can someone take a look?

--
Ticket URL: <http://trac.sagemath.org/ticket/17132#comment:13>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to