Network.nsi_local_clustering(typical_weight=w) will contain NaNs if k = Network.nsi_degree() contains 1.s because it divides by (k * (k-1.0)) when w is not None. This is the case for Network.SmallTestNetwork():
from pyunicorn.core import Network
net = Network.SmallTestNetwork()
res = net.nsi_local_clustering(typical_weight=2.0)
produces
Calculating corrected n.s.i. local clustering coefficients...
pyunicorn/src/pyunicorn/core/network.py:2847: RuntimeWarning: invalid value encountered in divide
return (numerator/typical_weight**2 - 3.0*k - 1.0) / (k * (k-1.0))
test_network.py::test_nsi_local_clustering() does not cover the case of given typical_weight parameter. Note that the implementation is in line with the description paper. But how can k = 1. be accounted for?
Side note: The TODO list at the top of core/network.py contains
# - find segfault problem in a.w. shortest path betweenness
I can't find any method called aw_/nsi_shortest_path_betweenness or similar. What is meant by this, can the TODO be removed? (EDIT: resolved as of f9f158a)
Network.nsi_local_clustering(typical_weight=w)
will containNaN
s ifk = Network.nsi_degree()
contains1.
s because it divides by(k * (k-1.0))
whenw
is notNone
. This is the case forNetwork.SmallTestNetwork()
:produces
test_network.py::test_nsi_local_clustering()
does not cover the case of giventypical_weight
parameter. Note that the implementation is in line with the description paper. But how cank = 1.
be accounted for?Side note: The TODO list at the top of
core/network.py
containsI can't find any method called
aw_
/nsi_shortest_path_betweenness
or similar. What is meant by this, can the TODO be removed? (EDIT: resolved as of f9f158a)