#18137: Centrality betweenness in Sage
-------------------------+-------------------------------------------------
Reporter: | Owner:
ncohen | Status: needs_review
Type: | Milestone: sage-6.6
enhancement | Resolution:
Priority: major | Merged in:
Component: graph | Reviewers:
theory | Work issues:
Keywords: | Commit:
Authors: | 0402abffb7656e123ce64d38e6a8cb8392eecf89
Nathann Cohen | Stopgaps:
Report Upstream: N/A |
Branch: |
u/ncohen/18137 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by ncohen):
Hello,
> - Wouldn't it be slightly faster to use arrays of bint rather than
bitsets ? It would use more memory, but since you want to be fast, any
saving is important.
It would not be much faster, because most of what this array would contain
is zeroes (bint is an int in memory). Plus the bottleneck is float
computation in this case `:-/`
> - You could add a doctest to compare the result of your implementation
with networkx
There is one, isn't there? In `centrality.pyx`. The one with a "tolerance"
flag.
> - You could pre-compute the `((n-1)*(n-2))`, although its minor
improvement.
I don't think that it is worth it. Save a linear number of multiplications
after all this work, really?.. `:-P`
> - You could add `cdef double x`
Done.
> - Variables `k` and `d` are not used.
Done.
> - You wrote `from centrality import centrality_betweenness`. Shouldn't
it be `from sage.graphs.centrality import centrality_betweenness` ?
They are in the same folder, so it works. It is even more robust as a
result, as we can move them wherever we want and the path does not change.
I also changed a Cython flag which checks for exceptions when doing float
divisions.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/18137#comment:3>
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.