Opened 8 years ago

Closed 8 years ago

#14653 closed defect (duplicate)

digraphs.Tournament(1) has 0 vertices

Reported by: rowland Owned by: jason, ncohen, rlm
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: graph theory Keywords: days47.5
Cc: ncohen Merged in:
Authors: Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #14536 Stopgaps:

Description

sage: digraphs.Tournament(1)
Tournament on 1 vertices: Digraph on 0 vertices
sage: digraphs.Tournament(1).vertices()
[]

Causes the following.

sage: digraphs.Tournament(3) + digraphs.Tournament(1)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-50-0b88bd757fb1> in <module>()
----> 1 digraphs.Tournament(Integer(3)) + digraphs.Tournament(Integer(1))

/Applications/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in __add__(self, other_graph)
    363         """
    364         if isinstance(other_graph, GenericGraph):
--> 365             return self.disjoint_union(other_graph, verbose_relabel=False)
    366 
    367     def __eq__(self, other):

/Applications/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in disjoint_union(self, other, verbose_relabel)
  13289             for v in other:
  13290                 r_other[v] = i; i += 1
> 13291             G = self.relabel(r_self, inplace=False).union(other.relabel(r_other, inplace=False))
  13292         elif any(u==v for u in self for v in other):
  13293             r_self = dict([[v,(0,v)] for v in self])

/Applications/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in relabel(self, perm, inplace, return_map, check_input, complete_partial_function)
  16024                               return_map= return_map,
  16025                               check_input = check_input,
> 16026                               complete_partial_function = complete_partial_function)
  16027 
  16028             if return_map:

/Applications/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in relabel(self, perm, inplace, return_map, check_input, complete_partial_function)
  16096                 new_attr = {}
  16097                 for v,value in getattr(self, attr).iteritems():
> 16098                     new_attr[perm[v]] = value
  16099 
  16100                 setattr(self, attr, new_attr)

KeyError: 0

Found while implementing #14099

Change History (6)

comment:1 Changed 8 years ago by ncohen

What about fixing this as a review of #14536 ? It renames the Tournament method :-)

Nathann

comment:2 Changed 8 years ago by rowland

But renaming it won't fix the errors in

sage: digraphs.Tournament(3) + digraphs.Tournament(1)

comment:3 Changed 8 years ago by ncohen

  • Dependencies set to #14536

Indeed.

I had forgotten thant #14653 had been reviewed already. Well, then you can fix it by replacing DiGraph() by DiGraph(n) in the source code of the new TransitiveTournament method, formerly known at Tournament :-)

Nathann

comment:4 Changed 8 years ago by chapoton

  • Milestone changed from sage-5.10 to sage-duplicate/invalid/wontfix
  • Reviewers set to Frédéric Chapoton
  • Status changed from new to needs_review

Well, this has been solved in #14536. I think therefore this ticket can be closed.

comment:5 Changed 8 years ago by chapoton

  • Status changed from needs_review to positive_review

confirm that the issue is solved in 5.10.rc1, positive review

comment:6 Changed 8 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.