Changes between Initial Version and Version 1 of Ticket #11053


Ignore:
Timestamp:
03/26/11 21:15:25 (10 years ago)
Author:
ncohen
Comment:

Before

sage: g = graphs.Grid2dGraph(60,60)
sage: %time d = g.shortest_path_all_pairs()
CPU times: user 14.52 s, sys: 0.51 s, total: 15.03 s
Wall time: 15.03 s
sage: g = graphs.Grid2dGraph(30,30)
sage: %timeit d = g.shortest_path_all_pairs()
5 loops, best of 3: 752 ms per loop
sage: g = graphs.PetersenGraph()
sage: %timeit d = g.shortest_path_all_pairs()
625 loops, best of 3: 73.5 µs per loop

After

sage: g = graphs.Grid2dGraph(60,60)
sage: %time d = g.shortest_path_all_pairs()
CPU times: user 10.70 s, sys: 0.53 s, total: 11.23 s
Wall time: 11.24 s
sage: g = graphs.Grid2dGraph(30,30)
sage: %timeit d = g.shortest_path_all_pairs()
5 loops, best of 3: 549 ms per loop
sage: g = graphs.PetersenGraph()
sage: %timeit d = g.shortest_path_all_pairs()
625 loops, best of 3: 53.4 µs per loop

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11053

    • Property Status changed from new to needs_review
  • Ticket #11053 – Description

    initial v1  
    11After taking a look at the SparseGraph backend, it looks like some time is actually spent obtaining the list of neighbors. This patch caches so that the out_neighbors method does not have to be called so often.
     2
     3Requires : #10905