Opened 7 years ago

Last modified 5 years ago

#15627 closed defect

(disjoint) Union of graphs with multiple edges — at Version 1

Reported by: ncohen Owned by:
Priority: major Milestone: sage-6.2
Component: graph theory Keywords:
Cc: SimonKing, chapoton Merged in:
Authors: Nathann Cohen Reviewers:
Report Upstream: N/A Work issues:
Branch: u/ncohen/15627 (Commits, GitHub, GitLab) Commit:
Dependencies: #15623 Stopgaps:

Status badges

Description (last modified by ncohen)

Err... Right now, the disjoint union of two graphs with multiedges/loops is the disjoint union of those two graphs without loops nor multiple edges. That's clearly missing from the code.

Here is the new behaviour

	Multiple edges and loops::                                                                                                                                                             
                                                                                                                                                                                               
            sage: g = Graph(multiedges=True, loops=True)                                                                                                                                       
            sage: g.add_edges(graphs.PetersenGraph().edges())                                                                                                                                  
	    sage: g.add_edges(graphs.PetersenGraph().edges())                                                                                                                                  
            sage: g.add_edge(0,0)                                                                                                                                                              
            sage: g.add_edge(0,0,"Hey")                                                                                                                                                        
            sage: g.add_edge(0,9)                                                                                                                                                              
            sage: g.add_edge(0,9)                                                                                                                                                              
            sage: g.add_edge(0,9)                                                                                                                                                              
            sage: (2*g.size()) == (2*g).size()                                                                                                                                                 
            True                                                                                                                                                                               
                                                                                                                                                                                               
        Immutable input ? Immutable output::                                                                                                                                                   
                                                                                                                                                                                               
            sage: g = g.copy(immutable=True)                                                                                                                                                   
            sage: (2*g)._backend                                                                                                                                                               
            <class 'sage.graphs.base.static_sparse_backend.StaticSparseBackend'>  

I hate multiedges. I hate loops. I hate labels.

Nathann

Change History (1)

comment:1 Changed 7 years ago by ncohen

  • Branch set to u/ncohen/15627
  • Dependencies changed from #15603 to #15623
  • Description modified (diff)
  • Status changed from new to needs_review
Note: See TracTickets for help on using tickets.