Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distance_bin yields incorrect result and does not warn if the input array is a matrix #90

Open
mdarnold1 opened this issue Dec 16, 2020 · 1 comment

Comments

@mdarnold1
Copy link

distance_bin yields incorrect result: output is non-symmetric and does not match scipy.sparse.csgraph.dijkstra
The Matlab version of BCT does not have this problem.

@mdarnold1
Copy link
Author

mdarnold1 commented Dec 16, 2020

The problem appears to be that distance_bin does not check if the input is a matrix (which is a likely use case if the graph was converted from scipy.sparse).

Then this shortcut for & is incorrect because * implies matrix (not element-wise) multplication:
L = (nPATH != 0) * (D == 0)

I suggest replacing the * with & since this is the intended function and it is just as fast.

@mdarnold1 mdarnold1 changed the title distance_bin yields incorrect result distance_bin yields incorrect result and does not warn if the input array is a matrix Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants