#18250: G.triangles_count speedup
----------------------------+---------------------------------
Reporter: ncohen | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.7
Component: graph theory | Keywords:
Merged in: | Authors: Nathann Cohen
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
----------------------------+---------------------------------
I thought that we had a decent implementation of `G.triangles_count`.
Turns out that we did not.
Here is what the branch does:
- Exception on non-simple graphs. The digraph version can handle loops (it
cannot handle multiple edges) and the graph version cannot handle any of
the
two.
- (obvious) speedup in the 'iter' algorithm. Before:
{{{
sage: %timeit _=g.triangles_count(algorithm='iter')
1 loops, best of 3: 10.2 s per loop
}}}
After:
{{{
sage: g=graphs.RandomGNP(700,.3)
sage: %timeit _=g.triangles_count(algorithm='iter')
1 loops, best of 3: 6.37 s per loop
}}}
- Added `triangles_count` in `static_sparse_graph` and another one in
`static_dense_graph`. They first copy the graph in a proper data
structure and
count the triangles on the copy. They can take require more memory
(though
they are 100000x cheaper than the default data structure)
- The default algorithm is 'iter' in the code but 'matrix' in the doc.
Fixed:
`sparse_copy` is now the default.
Overall, comparing default implementations:
Before
{{{
}}}
After
{{{
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/18250>
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.
For more options, visit https://groups.google.com/d/optout.