#14657: set_embedding fails for multigraphs
----------------------------+-----------------------------------------------
   Reporter:  nvcleemp      |             Owner:  jason, ncohen, rlm
       Type:  defect        |            Status:  new               
   Priority:  minor         |         Milestone:  sage-5.10         
  Component:  graph theory  |          Keywords:                    
Work issues:                |   Report Upstream:  N/A               
  Reviewers:                |           Authors:                    
  Merged in:                |      Dependencies:                    
   Stopgaps:                |  
----------------------------+-----------------------------------------------
 If you try to set the embedding for a multigraph, you will get an error if
 you specify all edges. If you bundle each multi-edge into a single edge it
 works. The following code, e.g., gives an error:

 {{{
 h = Graph({1:[2], 2:[3,3], 3:[]})
 h.set_embedding({1:[2], 2:[1,3,3], 3:[2,2]})
 }}}

 The cause of this is the following lines in the method
 `check_embedding_validity`:

 {{{
 if len(embedding[v]) != len(self.neighbors(v)):
     return False
 }}}

 A multigraph returns each neighbour only once, and not the number of times
 that there are edges between these two vertices.

 Is this the desired behaviour? If so, then maybe some documentation needs
 to be added to warn the user that this will not work. If not, how do we
 change it? Should the method `neighbors` return the 'multiset' of
 neighbours and not just the 'set'?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14657>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to