#13970: Fix memory allocation in distances all pairs
---------------------------------+------------------------------------------
       Reporter:  dcoudert       |         Owner:  jason, ncohen, rlm
           Type:  enhancement    |        Status:  needs_review      
       Priority:  major          |     Milestone:  sage-5.7          
      Component:  graph theory   |    Resolution:                    
       Keywords:                 |   Work issues:                    
Report Upstream:  N/A            |     Reviewers:  Nathann Cohen     
        Authors:  David Coudert  |     Merged in:                    
   Dependencies:                 |      Stopgaps:                    
---------------------------------+------------------------------------------

Comment (by ncohen):

 Yep. It's because the first test is
 {{{
     if G.order() > g.n:
         raise ValueError("This structure can handle at most "+str(<int>
 g.n)+" vertices !")
 }}}

 And later there is a
 {{{
     for i in range(1,g.n+1):
         g.neighbors[i] = g.neighbors[i-1] + <int>
 (cg.out_degree(vertices[i-1]) if isdigraph else G.degree(vertices[i-1]))
 }}}

 Actually, using an integer instead of a unsigned short would be sufficient
 to handle graphs with exactly `2^16` vertices, but I personally believe
 that the first test should be changed to `if G.order() >= g.n:`. Unless we
 have a very very very specific reason for creating grap with `2^16`
 vertices `:-P`

 Nathann

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13970#comment:10>
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