Ticket #13006 (closed defect: fixed)

Opened 12 months ago

Last modified 12 months ago

All-paths in a graph blows up when start and end are identical vertices

Reported by: rbeezer Owned by: jason, ncohen, rlm
Priority: minor Milestone: sage-5.1
Component: graph theory Keywords: sd40.5
Cc: Work issues:
Report Upstream: N/A Reviewers: Rob Beezer, William Stein
Authors: Dan Drake Merged in: sage-5.1.beta4
Dependencies: Stopgaps:

Description (last modified by rbeezer) (diff)

Seems to be a problem for digraphs also.

sage: G = graphs.CompleteGraph(4)
sage: G.all_paths(2,2)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<snip>
  11495                     s=act_path_iter[-1].next()  # try to get the next neighbor/successor, ...
  11496                 except (StopIteration):         # ... if there is none ...
<snip>
IndexError: list index out of range

For this trivial situation, there is no "previous" iterator. We could immediately return the trivial answer, or catch the exception, or place an empty iterator on the list.

Apply

  1. 13006.patch Download

Attachments

13006.patch Download (1.6 KB) - added by ddrake 12 months ago.

Change History

Changed 12 months ago by ddrake

comment:1 Changed 12 months ago by ddrake

  • Status changed from new to needs_review
  • Authors set to Dan Drake

comment:2 Changed 12 months ago by rbeezer

  • Status changed from needs_review to positive_review
  • Reviewers set to Rob Beezer
  • Description modified (diff)

Good fix. Passes all tests in sage/graphs and documentation looks good. Positive review.

comment:3 Changed 12 months ago by was

  • Reviewers changed from Rob Beezer to Rob Beezer, William Stein

This seems sensible to me. Simultaneous positive review.

comment:4 Changed 12 months ago by jdemeyer

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