Opened 9 years ago

Closed 8 years ago

#10441 closed defect (fixed)

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 Merged in: sage-5.0.beta3
Authors: Lukáš Lánský Reviewers: Nathann Cohen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by mhs)

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

trac_10441_multigraph.patch (2.5 KB) - added by brunellus 8 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by mhs

  • Description modified (diff)

comment:2 Changed 9 years ago by mvngu

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

comment:3 Changed 8 years ago by brunellus

  • Cc brunellus added

comment:4 Changed 8 years 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 8 years 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 8 years 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 8 years ago by ncohen

  • Status changed from needs_review to needs_work

Changed 8 years ago by brunellus

comment:8 Changed 8 years ago by brunellus

  • Status changed from needs_work to needs_review

Thanks! Is it better now?

comment:9 Changed 8 years ago by ncohen

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

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 8 years ago by jdemeyer

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