#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:
  matchings, graphs                  |    Reviewers:
        Authors:  Arvind Ayyer       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  6091b96904f172d6aea9e4926cb14257850c77ea
  public/ayyer/perfect_matchings     |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by vferay):

 Replying to [comment:13 ayyer]:

 > 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?
 Hi Arvind,

 the bug comes from the perfect matching library: when elements of the base
 set are themselves pairs of integers, the function 'flatten' goes too
 far... I guess that adding the optional argument 'max_level=1' to all
 'flatten' functions in the PerfectMatching library should solve the
 problem.

 Now the question is (perhaps for Nathan): should that be a separate post
 on the trac/patch ?

 I have another question : for the moment, you return perfect matchings as
 a list of pairs. Mathematically, I think it is more logical to treat it as
 a set of sets (two perfect matchings which differ by a permutations of the
 pairs are equal). But perhaps turning it into a set in sage would imply
 unnecessary copies/tests, so I wonder what is the best choice...

 Best,
 Valentin

--
Ticket URL: <http://trac.sagemath.org/ticket/17132#comment:16>
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