Opened 10 years ago

Closed 10 years ago

#10932 closed defect (fixed)

Fix typo in the multiple edges detection code of DiGraph

Reported by: nthiery Owned by: jason, ncohen, rlm
Priority: major Milestone: sage-4.7
Component: graph theory Keywords:
Cc: ncohen Merged in: sage-4.7.alpha2
Authors: Nicolas M. Thiéry Reviewers: Nathann Cohen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by nthiery)

sage: DiGraph([(1, 2, 0), (1,2,1)])
Traceback (most recent call last):
  ...
  File "/opt/sage-4.6.2/local/lib/python2.6/site-packages/sage/graphs/digraph.py", line 417, in __init__
    (u in data[v])):
KeyError: 2

sage: DiGraph([(1, 2, 0)])
------------------------------------------------------------
Traceback (most recent call last):
  ...
  File "/opt/sage-4.6.2/local/lib/python2.6/site-packages/sage/graphs/digraph.py", line 417, in __init__
    (u in data[v])):
KeyError: 2

The test should have been v in data[u]. I'll attach soon a patch doing this:

     sage: DiGraph([(1, 2, 0), (1,2,1)])
     Multi-digraph on 2 vertices
     sage: DiGraph([(1, 2, 0)])
     Digraph on 2 vertices

Attachments (1)

trac_10932-digraphs-multiple_edges_constructor-nt.patch (1.2 KB) - added by nthiery 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by nthiery

  • Status changed from new to needs_review

comment:2 Changed 10 years ago by nthiery

  • Description modified (diff)

Btw: pyflakes complains about choice not being defined on l. 602 of this file. But I leave that to someone else to investigate this further.

comment:3 follow-up: Changed 10 years ago by ncohen

  • Status changed from needs_review to positive_review

I thought there would be a similar problem in graph.py, but the situation there is obviously more... symmetric :-)

Nathann

comment:4 in reply to: ↑ 3 Changed 10 years ago by nthiery

Replying to ncohen:

I thought there would be a similar problem in graph.py, but the situation there is obviously more... symmetric :-)

Nathann

Thanks for the review!

comment:5 Changed 10 years ago by jdemeyer

  • Milestone set to sage-4.7

comment:6 Changed 10 years ago by jdemeyer

  • Reviewers set to Nathann Cohen

comment:7 Changed 10 years ago by jdemeyer

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