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

avoid random result randomness in find_partition #106

Closed kalthwaini closed 1 year ago

kalthwaini commented 2 years ago

as many clustering algorithms, find_partition is giving diff results over multiple executions of same input. I'm trying to stablize this and have fixed results of same input. I have tried the seed parameter, but didn't work for me. Is there a way to reach this? (have same results for same input)

prakritipaul commented 2 years ago

Similar question as mine.

vtraag commented 2 years ago

Sorry for the late reply!

Could you perhaps include some code that demonstrates the problem for you?

If I run

part1 = la.find_partition(G, la.ModularityVertexPartition, seed=0)
part2 = la.find_partition(G, la.ModularityVertexPartition, seed=0)

then part1.membership == part2.membership, in other words, I get identical partition, even for random graphs G.