#13006: All-paths in a graph blows up when start and end are identical vertices
--------------------------------+-------------------------------------------
       Reporter:  rbeezer       |         Owner:  jason, ncohen, rlm
           Type:  defect        |        Status:  positive_review   
       Priority:  minor         |     Milestone:  sage-5.1          
      Component:  graph theory  |    Resolution:                    
       Keywords:  sd40.5        |   Work issues:                    
Report Upstream:  N/A           |     Reviewers:  Rob Beezer        
        Authors:  Dan Drake     |     Merged in:                    
   Dependencies:                |      Stopgaps:                    
--------------------------------+-------------------------------------------
Changes (by rbeezer):

  * status:  needs_review => positive_review
  * reviewer:  => Rob Beezer


Old description:

> 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.

New description:

 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. [attachment:13006.patch]

--

Comment:

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

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13006#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to