Changes between Initial Version and Version 1 of Ticket #23290

06/21/17 02:14:07 (3 years ago)
sage: edgelist = [(0,0,'a'), (0,1,'b'), (1,1,'c')]
sage: G = Graph(edgelist, loops=True, multiedges=True)
sage: G.merge_vertices([0,1]); G.edges()

It looks like merge_vertices() works by computing the edge boundary between the specified set of vertices and the rest of the graph, then deleting all the vertices except the first one, then putting the edges back in.

So there are actually two issues here. (1) Loops not on the first vertex will be lost (because they're not in the edge boundary and their vertices get deleted), and (2) we'll lose other edges that are not in the edge boundary so they should become loops.

(1) is certainly a defect. I'm not so certain about (2) because I don't know if it's appropriate for this method to create loops. In fact, it's probably not.


  • Ticket #23290

    • Property Authors changed from to Zachary Gershkoff
    • Property Cc dcoudert tscrim Stefan added
    • Property Component changed from PLEASE CHANGE to graph theory
    • Property Priority changed from major to minor
    • Property Type changed from PLEASE CHANGE to defect
  • Ticket #23290 – Description

    initial v1  
     1merge_vertices() accepts a list of vertices as input, but loops are lost unless they're on the first vertex.