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

Error in lines 970-971 #2

Open
fishbacp opened this issue Dec 30, 2019 · 3 comments
Open

Error in lines 970-971 #2

fishbacp opened this issue Dec 30, 2019 · 3 comments

Comments

@fishbacp
Copy link

I was not able to get this file to work unless I changed lines 970-971 from

 M[i, y_coor] = B[a, z]
 M[y_coor, i] = B[a, z]

to

M[i, y_coor-1] = B[a, z]
M[y_coor-1, i] = B[a, z]
@titipata
Copy link
Contributor

Thanks for the report! Can you make a PR to fix this error?

@fishbacp
Copy link
Author

fishbacp commented Dec 31, 2019 via email

@titipata
Copy link
Contributor

titipata commented Jan 6, 2020

@fishbacp Thanks a ton! I did a quick fix to the code and it should work now. I'm not sure if the math is completely right tho. Feel free to take a look!

import networkx as nx
import numpy as np
from nct import small_world_propensity, regular_matrix_generator

n = 10
k = 4
p = .01
G = nx.watts_strogatz_graph(n,k,p)
G = np.array(nx.to_numpy_matrix(G)) # has to be array input instead of matrix
SWP, delta_C, delta_L = small_world_propensity(G, method='O')
print(SWP, delta_C, delta_L)
>> (0.29237040411638093, 1.0, 0.03846153846153852)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants