I have implemented some speedups at #5421.

First, let me remark that switching to c_graphs when possible is
advisable, even for graphs as small as 7 vertices. I tested the
is_isomorphic function on all pairs of such graphs, and used the
longest one as a case study. In particular, with c_graph already as
the underlying implementation, the timing of isomorph testing itself
is about (max) 0.000172s. Switching from NetworkX implementation to
c_graph takes about (max) 0.000796s. The sum is 0.000968s, which is
still faster than sending NICE the NetworkX graph, which takes about
(max) 0.001330s.

On to the speedups: the old benchmarks--

sage: G = list(graphs(6))
sage: G = [g.copy(implementation='c_graph') for g in G]
sage: %time go(G)
CPU times: user 0.64 s, sys: 0.00 s, total: 0.65 s
Wall time: 0.66 s
False

sage: G = list(graphs(7))
sage: G = [g.copy(implementation='c_graph') for g in G]
sage: %time go(G)
CPU times: user 30.70 s, sys: 0.11 s, total: 30.81 s
Wall time: 31.11 s
False

And the new ones--

sage: G = list(graphs(6))
sage: G = [g.copy(implementation='c_graph') for g in G]
sage: %time go(G)
CPU times: user 0.24 s, sys: 0.00 s, total: 0.24 s
Wall time: 0.25 s
False
sage: G = list(graphs(7))
sage: G = [g.copy(implementation='c_graph') for g in G]
sage: %time go(G)
CPU times: user 10.62 s, sys: 0.03 s, total: 10.65 s
Wall time: 10.71 s
False

So now we're beating NetworkX three to one (at least on my machine).
I'm still curious why Mark's results are different. Perhaps Cython
runs slower on his machine...

Finally, when we simply pass the Python (NX) data structure to NICE,
the analogous results are:

sage: G = list(graphs(6))
sage: %time go(G)
CPU times: user 0.88 s, sys: 0.00 s, total: 0.88 s
Wall time: 0.89 s
False

sage: G = list(graphs(7))
sage: %time go(G)
CPU times: user 41.88 s, sys: 0.14 s, total: 42.02 s
Wall time: 42.27 s
False


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to