#7540: Speed up shortest_path_all_pairs() and update distance_graph
----------------------------+-----------------------------------------------
   Reporter:  ncohen        |       Owner:  rlm     
       Type:  enhancement   |      Status:  new     
   Priority:  major         |   Milestone:  sage-4.3
  Component:  graph theory  |    Keywords:          
Work_issues:                |      Author:          
   Upstream:  N/A           |    Reviewer:          
     Merged:                |  
----------------------------+-----------------------------------------------
Description changed by ncohen:

Old description:

> As mentionned in #7533 by Rob Beezer, the function
> shortest_path_all_pairs() is much slower than computing independently all
> the distances, which is a bit worrying. Easy explanation ( at least it is
> an explanation for me, though there may be a deeper one ), distance() is
> a function from NetworkX while the Floyd-Marshall algorithm is directly
> written in Python, hence the slowness.
>
> This function is very fundamental and should be improved ! The difference
> is amazing :
>
> {{{
> sage: g=graphs.RandomGNP(200,.1)
> sage: time e=g.shortest_path_all_pairs()
> CPU times: user 16.51 s, sys: 0.06 s, total: 16.57 s
> Wall time: 16.60 s
> sage: time a=[g.distance(i,j) for (i,j) in Subsets(g,2)]
> CPU times: user 1.06 s, sys: 0.00 s, total: 1.06 s
> Wall time: 1.06 s
> }}}

New description:

 As mentionned in #7533 by Rob Beezer, the function
 shortest_path_all_pairs() is much slower than computing independently all
 the distances, which is a bit worrying. Easy explanation ( at least it is
 an explanation for me, though there may be a deeper one ), distance() is a
 function from NetworkX while the Floyd-Marshall algorithm is directly
 written in Python, hence the slowness.

 This function is very fundamental and should be improved ! The difference
 is amazing :

 {{{
 sage: g=graphs.RandomGNP(200,.1)
 sage: time e=g.shortest_path_all_pairs()
 CPU times: user 16.51 s, sys: 0.06 s, total: 16.57 s
 Wall time: 16.60 s
 sage: time a=[g.distance(i,j) for (i,j) in Subsets(g,2)]
 CPU times: user 1.06 s, sys: 0.00 s, total: 1.06 s
 Wall time: 1.06 s
 }}}

 See http://groups.google.com/group/sage-
 devel/browse_thread/thread/8edd29e9bddc67e5 for discussion.

--

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