#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: | 18d641858474d73a3e7dd3e5c02e2baecca2aa14
public/ayyer/perfect_matchings | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by ayyer):
I'm stuck trying to fix (2) above. The function {{{perfect_matchings(G)}}}
works perfectly if I attach the file, like so.
{{{
sage: G = graphs.GridGraph([3,2])
sage: attach("src/sage/graphs/perfect_matchings.py")
sage: perfect_matchings(G)
[[((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))]]
}}}
But I get funny errors if I try to modify the file
''src/sage/graphs/all.py'' in any reasonable way. For example, if I add
the line {{{from sage.graphs.perfect_matchings import *}}}, I get the
following strange error.
{{{
sage: perfect_matchings(G)
---------------------------------------------------------------------------
NameError Traceback (most recent call
last)
<ipython-input-2-a5bbd0fdbb1c> in <module>()
----> 1 perfect_matchings(G)
/opt/sage/sage-git/local/lib/python2.7/site-
packages/sage/graphs/perfect_matchings.pyc in perfect_matchings(G)
46 PP = []
47 for h in N:
---> 48 H = copy(G)
49 H.delete_vertices([g,h])
50 P = perfect_matchings(H)
NameError: global name 'copy' is not defined
}}}
On the other hand, if I try {{{import sage.graphs.perfect_matchings}}}, I
get
{{{
sage: perfect_matchings(G)
---------------------------------------------------------------------------
NameError Traceback (most recent call
last)
<ipython-input-2-a5bbd0fdbb1c> in <module>()
----> 1 perfect_matchings(G)
NameError: name 'perfect_matchings' is not defined
}}}
I have no idea what to do at this stage. Could someone help? Thanks a lot.
--
Ticket URL: <http://trac.sagemath.org/ticket/17132#comment:2>
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.