#13730: Speed up some graph iterations
--------------------------------+-------------------------------------------
       Reporter:  dcoudert      |         Owner:  jason, ncohen, rlm
           Type:  enhancement   |        Status:  needs_info        
       Priority:  major         |     Milestone:  sage-5.8          
      Component:  graph theory  |    Resolution:                    
       Keywords:                |   Work issues:                    
Report Upstream:  N/A           |     Reviewers:                    
        Authors:                |     Merged in:                    
   Dependencies:                |      Stopgaps:                    
--------------------------------+-------------------------------------------

Comment (by slani):

 Hello.

 I tried to implement what azi did. I add hash tabel  and update some
 methods. I didn't make other tests.
 I'm new in SAGE development and I would like to work on this problem.
 Please help me and tell me if this patch are going in right direction.

 Best regards,

 slani


 {{{
 new
 ==========================================================
 sage:  G = graphs.RandomBarabasiAlbert(100,2)
 sage: %timeit E = [(u,v) for u in G for v in G.neighbor_iterator(u)]
 625 loops, best of 3: 479 µs per loop
 sage: ggnx = G.networkx_graph()
 sage: %timeit EE = [(u,v) for u in ggnx for v in ggnx.neighbors_iter(u)]
 625 loops, best of 3: 171 µs per loopsage: %timeit EE = [(u,v) for u in
 ggnx for v in ggnx[u]]
 625 loops, best of 3: 159 µs per loop

 sage: %timeit G.neighbors(3)
 625 loops, best of 3: 5.35 µs per loop
 ===========================================================

 old
 ===========================================================
 sage: G = graphs.RandomBarabasiAlbert(100,2)
 sage:  %timeit E = [(u,v) for u in G for v in G.neighbor_iterator(u)]
 125 loops, best of 3: 2.03 ms per loop
 sage: ggnx = G.networkx_graph()
 sage: %timeit EE = [(u,v) for u in ggnx for v in ggnx.neighbors_iter(u)]
 625 loops, best of 3: 177 µs per loop
 sage: %timeit EE = [(u,v) for u in ggnx for v in ggnx[u]]
 625 loops, best of 3: 159 µs per loop

 %timeit G.neighbors(3)
 625 loops, best of 3: 91.1 µs per loop
 ============================================================
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13730#comment:8>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to