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
I have been using leidenalg for years, and I would like to thank you for your work.
My question is if there is a helper function within leidenalg or igraph that calculates the multilayer modularity score for a given quality function and VertexPartition, similar to G.modularity() in igraph?
In particular, for a given list of upper triangular np.arrays of adjacency matrices (list_adjacency):
length = len(list_adjacency)
size = list_adjacency[0].shape[0]
Gs = []
for l in range(length):
conn_indices = np.where(list_adjacency[l])
weights = list_adjacency[l][conn_indices] # get the weights corresponding to these indices
edges = zip(*conn_indices) # a sequence of (i, j) tuples, each corresponding to an edge from i -> j
G = ig.Graph(n = size, edges=edges, directed=False)# initialize the graph from the edge sequence
G.vs['id'] = list(range(list_adjacency[l].shape[0]))
G.vs['node_size'] = 0
G.es['weight'] = weights #assign node names and weights to be attributes of the vertices and edgesrespectively
Gs.append(G)
I'm trying to compute the Multilayer Modularity score (or whatever quality function is being used) for the interslice_partition below:
Hello Vincent
I have been using
leidenalg
for years, and I would like to thank you for your work.My question is if there is a helper function within
leidenalg
origraph
that calculates the multilayer modularity score for a given quality function andVertexPartition
, similar toG.modularity()
inigraph
?In particular, for a given list of upper triangular
np.array
s of adjacency matrices (list_adjacency
):I'm trying to compute the Multilayer Modularity score (or whatever quality function is being used) for the
interslice_partition
below:Something like:
Note that last argument
VertexPart
would indicate the quality function that is used, which is different fromG.modularity()
.Thank you
The text was updated successfully, but these errors were encountered: