#13599: Bugfix in is_cartesian_product
---------------------------------+------------------------------------------
       Reporter:  ncohen         |         Owner:  jason, ncohen, rlm
           Type:  defect         |        Status:  needs_review      
       Priority:  major          |     Milestone:  sage-5.5          
      Component:  graph theory   |    Resolution:                    
       Keywords:                 |   Work issues:                    
Report Upstream:  N/A            |     Reviewers:  David Coudert     
        Authors:  Nathann Cohen  |     Merged in:                    
   Dependencies:                 |      Stopgaps:                    
---------------------------------+------------------------------------------

Comment (by ncohen):

 Ahahahah. Actually, what I should do is cache the list of edges.. Thanks
 for the hint ! `:-)`

 {{{
 g = graphs.RandomGNP(100,.2)
 def test(g):
    c = 0
    for u,v in g.edge_iterator(labels = False):
        for uu,vv in g.edge_iterator(labels = False):
             c += uu+vv+u+v
    return c

 def test2(g):
    c = 0
    edges = g.edges(labels = False)
    for i,(u,v) in enumerate(edges):
        for j in range(i+1, len(edges)):
             uu,vv = edges[j]
             c += uu+vv+u+v
    return c

 sage: %time test(g)
 CPU times: user 4.60 s, sys: 0.00 s, total: 4.60 s
 Wall time: 4.60 s
 198772752
 sage: %time test2(g)
 CPU times: user 0.78 s, sys: 0.00 s, total: 0.78 s
 Wall time: 0.78 s
 99287188
 }}}

 This thing is ..... very ..... slow `:-/`

 Nathann

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