#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:                     |  88e58625775dfa5cea13db7336dc5f5371ab3768
  public/ayyer/perfect_matchings     |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by ayyer):

 > This why the technique is to remove the vertices before calling the
 subfunction, and to add them back (with their edges) right after the
 subfunction call. This is a way to avoid having many copies of the whole
 graph, when all you need is -- as you say -- to have a temporarily smaller
 graph.

 Oh, I see now! You want me to create another function which will delete
 the vertices without creating a copy. Here's what I did, and it seems to
 work. It seems a bit long though...
 {{{
 P = perfect_matchings(Graph([e for e in G.edges() if e[0] != g and e[0] !=
 h and e[1] != g and e[1] != h]))
 }}}
 Is this acceptable? It seems that if {{{G.delete_vertices()}}} returned
 the graph instead of removing it in-place, it would have been much easier
 to return the graph. I suppose there were good reasons for doing it this
 way. Oh well!

 Arvind

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