-
Notifications
You must be signed in to change notification settings - Fork 150
strength_dir not matching output with description #133
Copy link
Copy link
Open
Description
In the function strength_dir there should be 3 outputs (in-strength, out-strength and in + out), but the function returns only the sum of the in plus out strength.
Here is the modified version adding the missing outputs.
def strengths_dir(CIJ):
'''
Node strength is the sum of weights of links connected to the node. The
instrength is the sum of inward link weights and the outstrength is the
sum of outward link weights.
Parameters
----------
CIJ : NxN np.ndarray
directed weighted connection matrix
Returns
-------
is : Nx1 np.ndarray
node in-strength
os : Nx1 np.ndarray
node out-strength
str : Nx1 np.ndarray
node strength (in-strength + out-strength)
Notes
-----
Inputs are assumed to be on the columns of the CIJ matrix.
'''
istr = np.sum(CIJ, axis=0)
ostr = np.sum(CIJ, axis=1)
return istr, ostr, istr + ostr
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels