Skip to content

Conversation

thelahunginjeet
Copy link

I've modified the code to work with edge weights; checked the results of Q by-hand and everything checks out.

Copy link
Owner

@zhiyzuo zhiyzuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kevin, thank you very much for your input.
In addition to my comment in the code, can you also update the Quick-Start.ipynb with one toy example that you have tested? Thanks!

network,partition = transform_net_and_part(network,partition)
# get the modularity matrix
Q = get_base_modularity_matrix(network)
if type(network) == nx.Graph:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here could be further trimmed as:

if nx.is_weighted(network): 
    norm_fac = nx.to_scipy_sparse_matrix(network).sum()
elif type(network) == nx.Graph:
    norm_fac = 2.*(network.number_of_edges())
elif type(network) == nx.DiGraph:
    norm_fac = 1.*network.number_of_edges()
else:
    print('Invalid graph type')
    raise TypeError

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reply! I'll try to get this in there ASAP.

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

Successfully merging this pull request may close these issues.

2 participants