Ticket #10441 (closed defect: fixed)

Opened 2 years ago

Last modified 16 months ago

Error creating an empty multi-edge (di)graph

Reported by: mhs Owned by: somebody
Priority: major Milestone: sage-5.0
Component: graph theory Keywords: creating empty Graph, DiGraph, multiple_edges=True
Cc: mvngu, brunellus Work issues:
Report Upstream: N/A Reviewers: Nathann Cohen
Authors: Lukáš Lánský Merged in: sage-5.0.beta3
Dependencies: Stopgaps:

Description (last modified by mhs) (diff)

In SAGE 4.5.1 if you try to create an empty graph or digraph using the multi-edge keyword the (di)graph created is a non-multi (di)graph.

Examples of the strange behaviour:

sage: G=Graph(multiple_edges=True)
sage: G
Graph on 0 vertices
sage: G=Graph([],multiple_edges=True)
sage: G
Graph on 0 vertices
sage: H=DiGraph(multiple_edges=True)
sage: H
Digraph on 0 vertices
sage: H=DiGraph([],multiple_edges=True)
sage: H
Digraph on 0 vertices

Nevertheless it works fine, i.e. produces a multi-graph/multi-digraph if one uses an empty dictionary like in the following:

sage: G=Graph({},multiple_edges=True)
sage: G
Multi-graph on 0 vertices
sage: H=DiGraph({},multiple_edges=True)
sage: H
Multi-digraph on 0 vertices

After posting on sage-develop Strange behaviour of add_edges  http://groups.google.com/group/sage-devel/browse_thread/thread/69773eae8ba3cefc I was asked to open a new ticket...

Attachments

trac_10441_multigraph.patch Download (2.5 KB) - added by brunellus 16 months ago.

Change History

comment:1 Changed 2 years ago by mhs

  • Description modified (diff)

comment:2 Changed 2 years ago by mvngu

  • Cc mvngu added
  • Reviewers somebody deleted
  • Report Upstream changed from Not yet reported upstream; Will do shortly. to N/A
  • Authors MHS deleted

comment:3 Changed 17 months ago by brunellus

  • Cc brunellus added

comment:4 Changed 16 months ago by brunellus

I think that having kwds in the Graph constructor is very confusing, because any misspelling of an argument pass through without notice. Do you see some serious reason why is this there? I'm looking into the code and can't see anything.

comment:5 Changed 16 months ago by brunellus

  • Status changed from new to needs_review

I started #12318 for the mentioned problem.

Fix for this ticket is a rather simple one, I think. Prove me wrong! :-)

comment:6 Changed 16 months ago by ncohen

Hellooooooooooooo !!

Well, the code building the graph is a bit messy but indeed what you wrote 1) prevents the bug 2) is what we should do until somebody comes with another weird situation :-)

Would it be possible to move your "# not a multi [...]" comments to the line just above the test, though ? That's where we put flags like "optional" or "not tested" for the automatic tests, and it's best to be sure these comments do not interfere ^^;

Nathann

comment:7 Changed 16 months ago by ncohen

  • Status changed from needs_review to needs_work

Changed 16 months ago by brunellus

comment:8 Changed 16 months ago by brunellus

  • Status changed from needs_work to needs_review

Thanks! Is it better now?

comment:9 Changed 16 months ago by ncohen

  • Status changed from needs_review to positive_review
  • Reviewers set to Nathann Cohen
  • Authors set to Lukáš Lánský

Hellooooooo !!!

I thought you would put the comments just before the "::" but there's no problem with way either... Good to go ! :-)

Nathann

comment:10 Changed 16 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.0.beta3
Note: See TracTickets for help on using tickets.