#12362: Improvement of GNP generators for graphs and digraphs
-----------------------------------------------+----------------------------
Reporter: dcoudert | Owner: jason, ncohen,
rlm
Type: enhancement | Status: closed
Priority: minor | Milestone: sage-5.0
Component: graph theory | Resolution: fixed
Keywords: directed graphs, generators | Work issues:
Report Upstream: N/A | Reviewers: Nathann Cohen
Authors: David Coudert | Merged in: sage-5.0.beta9
Dependencies: | Stopgaps:
-----------------------------------------------+----------------------------
Comment (by dcoudert):
Bravo !
{{{
sage: %timeit graphs.RandomGNP(2000, .01, method='networkx', fast = True)
5 loops, best of 3: 234 ms per loop
sage: %timeit graphs.RandomGNP(2000, .01, method='Sage')
5 loops, best of 3: 163 ms per loop
sage: %timeit graphs.RandomGNP(2000, .001, method='networkx', fast = True)
25 loops, best of 3: 27.7 ms per loop
sage: %timeit graphs.RandomGNP(2000, .001, method='Sage')
5 loops, best of 3: 50.2 ms per loop
sage: %timeit graphs.RandomGNP(2000, .1, method='networkx', fast = True)
5 loops, best of 3: 2.38 s per loop
sage: %timeit graphs.RandomGNP(2000, .1, method='Sage')
5 loops, best of 3: 1.33 s per loop
}}}
I will open a new ticket to correct this. Sorry.
A remaining question is which should be the default algorithm. Apparently,
the Sage implementation is often faster than the networkx one, except for
large sparse graphs
{{{
sage: %timeit graphs.RandomGNP(10000, 0.001, method='Sage')
5 loops, best of 3: 1.21 s per loop
sage: %timeit graphs.RandomGNP(10000, 0.001, method='networkx', fast =
True)
5 loops, best of 3: 612 ms per loop
sage: %timeit graphs.RandomGNP(10000, 0.01, method='Sage')
5 loops, best of 3: 4.17 s per loop
sage: %timeit graphs.RandomGNP(10000, 0.01, method='networkx', fast =
True)
5 loops, best of 3: 6.09 s per loop
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12362#comment:44>
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.