Opened 10 years ago

Closed 10 years ago

#13006 closed defect (fixed)

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: Merged in: sage-5.1.beta4
Authors: Dan Drake Reviewers: Rob Beezer, William Stein
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by rbeezer)

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)
  11495                     s=act_path_iter[-1].next()  # try to get the next neighbor/successor, ...
  11496                 except (StopIteration):         # ... if there is none ...
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.


  1. 13006.patch

Attachments (1)

13006.patch (1.6 KB) - added by ddrake 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by ddrake

comment:1 Changed 10 years ago by ddrake

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

comment:2 Changed 10 years ago by rbeezer

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

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

comment:3 Changed 10 years ago by was

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

This seems sensible to me. Simultaneous positive review.

comment:4 Changed 10 years ago by jdemeyer

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