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
{{ message }}
Repository navigation
Consider switch to graspologic-native for faster Leiden implementation #4441
Additional function parameters / changed functionality / changed defaults?
Please describe your wishes
Hi,
I was working on speeding up my own clustering pipelines for multiplexed protein data and discovered https://github.com/graspologic-org/graspologic-native which has a performant Leiden implementation in Rust. It is also MIT-licensed and could thus avoid problems with igraph. While igraph does perform well, I would propose to replace leidenalg with a more performant default that most users would not need to switch and that is useful for pharma, biotech, etc.
Same neighbors graph from pp.neighbors, resolution 1, median of 5–7 seeds, on my M3 Max. ARI was calculated against igraph (igraph vs itself across seeds: 0.96–0.98). The 40k graph comes from sc.datasets.blobs. With graspologic-native, there is also the possibility of zero copy CSR input which could take adata.obsp["connectivities"] directly via leiden_csr.
We are going to switch to igraph for scanpy 2.0 as the default and I think we even warn right now on using leidenalg for large-ish datasets. We can't change the default until 2.0 and graspologic looks to have the same speed as igraph. I think it would make sense to offer it, though, if it were to take a random seed and therefore be reproducible. There's definitely a need for that, but if not, I don't know of a reason not to just point people to #4170, which is also very very fast.
Activity
ilan-gold commentedon Nov 6, 2026
We are going to switch to
igraphfor scanpy 2.0 as the default and I think we even warn right now on usingleidenalgfor large-ish datasets. We can't change the default until 2.0 and graspologic looks to have the same speed asigraph. I think it would make sense to offer it, though, if it were to take a random seed and therefore be reproducible. There's definitely a need for that, but if not, I don't know of a reason not to just point people to #4170, which is also very very fast.flying-sheep commentedon Nov 10, 2026
see also #4110