vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
606 stars 78 forks source link

How should I assign weights to different layers when doing community detection? #128

Closed chansigit closed 1 year ago

chansigit commented 1 year ago

Dear author, I am performing community detection on a multiplex network (same sets of nodes, different layers, no inter-layer edges)

I hope to assign different weights to different layers so that some node types of edges could be more important in the community formation.

How can I achieve this in "find_partition_multiplex"? I failed to find the answer from the doc.

Looking forward to your answer.

Thanks!

geniusadventurer commented 1 year ago

Hello, I am doing the same thing as you do. You can read https://leidenalg.readthedocs.io/en/latest/multiplex.html#layer-multiplex for details. You can use the function la.CPMVertexPartition to generate the network, and then use the function optimiser.optimise_partition_multiplex. You can assign different weights to different layers in the parameter 'layer_weights' in the latter function.

vtraag commented 1 year ago

@geniusadventurer, thanks for replying to the question of @chansigit ! PR #129 by @bfarahdel seems to have made this a little bit easier.