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

Comment (by slani):

 Replying to [comment:23 vdelecroix]:
 > Replying to [comment:22 slani]:
 > Hello,
 >
 > > I don't know, but I came to the conclusion that we have tow problems:
 > > 1. conversion from vertex ints to vertex lables
 >
 > This should not slow down too much (not x4). It is a lookup in an array.
 Did you make some timings to see whether this is slow ? Perhaps we have to
 dig the way it is implemented.
 >
 > > 2. how to faster return vertex ints from data structure we have for
 nbrs
 >
 > It might be a good idea to see whether iterator over int vertices are
 faster compared to the labeled one.
 >
 > Other possibilities
 >
 > 3. There are 3 levels in a graph: the `GenericGraph` class, the
 `backend` (stored at `my_graph._backend`) and then the datastructure
 (stored at `my_graph._backend._cg` for c graphs or
 `my_graph._backend._nxg` for networkx).
 >
 > 4. Possibly #14690 might be a good speedup (if it works one day ;-)


 [[BR]]
 I modified  data structure for saving nbrs. I implemented linked list and
 save all nbrs for vertex on one place in vertices (not on 16 different
 places). Obvious this is nod good for adds and removes nbrs.


 {{{
 sage: %timeit E = [(u,v) for u in G for v in G.neighbor_iterator(u)]
 625 loops, best of 3: 871 µs per loop
 }}}
 Very small improvements.

 How can networkX data structure (python dict) return data so fast?

 Best, [[BR]]
 Uros

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