Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#15627 closed defect (fixed)

(disjoint) Union of graphs with multiple edges

Reported by: ncohen Owned by:
Priority: major Milestone: sage-6.2
Component: graph theory Keywords:
Cc: SimonKing, chapoton Merged in:
Authors: Nathann Cohen Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: 9f1716e (Commits) Commit:
Dependencies: #15623 Stopgaps:

Description (last modified by chapoton)

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 (13)

comment:1 Changed 6 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

comment:2 Changed 6 years ago by git

  • Commit set to 6cb609d59f91eaeab786c5679969edaeec63b733

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

6cb609dtrac #15627: (disjoint) Union of graphs with multiple edges
b6ed038trac #15623: Immutable graph backend for Posets
0f57805trac #15622: Immutable graphs must not be relabeled
c441178trac #15619: bug in the former definition; exception to avoid it in the future
0229348trac #15619: Pickling of immutable graphs
7860f39trac #15603: "immutable=True" for Graph/Digraph __init__ and copy()
2525d22Trac 15278: Fix syntax error in doc test
fcf9e30Trac 15278: Only graphs that use the static backend are identical with their copy
8fc9c94Merge branch 'develop' into ticket/15278
51d6328Trac 15278: Error messages explain how to create (im)mutable graph copy

comment:3 Changed 6 years ago by chapoton

There is a typo "afinite projective plane"

I propose to replace "No other value is available for this parameter." by

"For the moment, no other value is available for this parameter."

comment:4 Changed 6 years ago by chapoton

oops, wrong ticket !

comment:5 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:6 Changed 5 years ago by chapoton

There is a failing doctest about the immutability :

sage: (2*g)._backend
    Traceback (most recent call last):
      ...
    NotImplementedError: An immutable graph does not change name

I suggest also to add a reference to :trac:`15627`

comment:7 Changed 5 years ago by chapoton

  • Status changed from needs_review to needs_work

comment:8 Changed 5 years ago by git

  • Commit changed from 6cb609d59f91eaeab786c5679969edaeec63b733 to 9f1716eea045ef52356433458dc1c6b708fdf13e

Branch pushed to git repo; I updated commit sha1. New commits:

a79d1b0trac #15627: rebase on 6.2.beta3
9f1716etrac #15627: Fixed doctest

comment:9 Changed 5 years ago by ncohen

  • Status changed from needs_work to needs_review

Here it is !

Nathann

comment:10 Changed 5 years ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

Ok, good enough for me (even if not fully pep8 or python3)

:)

comment:11 Changed 5 years ago by ncohen

Ahahah. Thanks for the review :-)

Nathann

comment:12 Changed 5 years ago by vbraun

  • Branch changed from u/ncohen/15627 to 9f1716eea045ef52356433458dc1c6b708fdf13e
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:13 Changed 4 years ago by chapoton

  • Commit 9f1716eea045ef52356433458dc1c6b708fdf13e deleted
  • Description modified (diff)
Note: See TracTickets for help on using tickets.