#13239: Contraction of edges in a graph.
------------------------------------------------+---------------------------
       Reporter:  lkeough                       |         Owner:  jason, 
ncohen, rlm             
           Type:  enhancement                   |        Status:  needs_info    
                 
       Priority:  major                         |     Milestone:  sage-5.3      
                 
      Component:  graph theory                  |    Resolution:                
                 
       Keywords:  SD40                          |   Work issues:                
                 
Report Upstream:  N/A                           |     Reviewers:  Marshall 
Hampton, David Coudert
        Authors:  Lauren Keough, Jeremy Martin  |     Merged in:                
                 
   Dependencies:                                |      Stopgaps:                
                 
------------------------------------------------+---------------------------

Comment (by lkeough):

 Replying to [comment:4 dcoudert]:
 > Hello,
 >
 > I don't understand this new patch. If the behavior of the contract_edge
 function proposed in patch #7304 is not adapted to your purpose, you could
 add extra parameters (inplace = False, keep_multiedges, etc.)
 #7304 will keep multiedges if you do G.allow_multiedges . However, we also
 need to do G.allow_loops (for the tutte polynomial), but if we do that
 then the patch leaves the contracted edge (rather than deleting it which
 is what we want).  I suppose I could use their code and then add a line to
 mine that deletes that loop.

 I'm not really sure what the best option is here.  7304 already has a lot
 of parameters and adding another might be very confusing.  And I'm also
 not sure what most people mean by contracting an edge - I thought the
 definition I have written in this code was "the" definition, but it's
 becoming more apparent that it isn't at all!  Perhaps I could just include
 this code in the Tutte polynomial code and not as a separate function?
 I'm very open to advice on this!

 > Furthermore, it works only for undirected graphs. So it should at least
 be in graph.py and not in generic_graph.py.
 Okay, I will definitely move to graph.py unless I can figure out how to
 make it work for digraphs.

 > In the following example, arc (3,0) becomes arc (0,3)
 > {{{
 > sage: D = digraphs.RandomDirectedGNP(5,.5)
 > sage: h = D.contraction((0,1))
 > sage: D.edges(labels=None)
 > [(0, 1), (0, 2), (0, 3), (1, 0), (1, 3), (1, 4), (2, 0), (3, 0), (3, 1),
 (3, 4), (4, 2)]
 > sage: h.edges(labels=None)
 > [(0, 0), (0, 2), (0, 2), (0, 3), (0, 3), (0, 3), (0, 3), (0, 4), (2, 4),
 (3, 4)]
 > }}}
 >
 > D.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13239#comment:5>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to