You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# We'll need the graph's adjacency matrix often, so store it once
77
+
self.graph_adj_matrix=nx.adj_matrix(graph).todense() # Must convert to dense matrix before making into a numpy array (line was previously: self.graph_adj_matrix = nx.adj_matrix(graph))
77
78
self.graph_adj_matrix=nx.adj_matrix(graph)
78
79
#make sure adj_matrix is binary otherwise raise exception
79
80
ifnotself.graph_adj_matrix.sum() == \
@@ -1290,7 +1291,7 @@ def modularity_matrix(g):
1290
1291
modularity matrix (graph laplacian)
1291
1292
1292
1293
"""
1293
-
A=np.asarray(nx.adjacency_matrix(g))
1294
+
A=np.asarray(nx.adjacency_matrix(g).todense()) # Must convert to dense matrix before making into a numpy array (line was previously: A = np.asarray(nx.adjacency_matrix(g)))
A=np.asarray(nx.adjacency_matrix(g).todense()) # Must convert to dense matrix before making into a numpy array (line was previously:(A = np.asarray(nx.adjacency_matrix(g)))
1318
1319
ifnotA.sum() ==A.astype(bool).sum():
1319
1320
raiseValueError('Adjacency matrix is weighted, need binary matrix')
0 commit comments