Skip to content

Commit 8b7d3ca

Browse files
committed
Remove warning on leidenalg performance
It is still extremely slow for large numbers of layers, but remains arguably one of the most popular modularity optimization algorithms. See #10
1 parent 8b750e0 commit 8b7d3ca

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

utilities/leiden_utilities.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from multiprocessing import Pool, cpu_count
77
import numpy as np
88
import psutil
9-
import warnings
109

1110
LOW_MEMORY_THRESHOLD = 1e9 # 1 GB
1211

@@ -68,18 +67,13 @@ def split_intralayer_leiden_graph(G_intralayer, layer_membership):
6867
6968
This is needed since leidenalg lacks support for faster multilayer optimization.
7069
71-
WARNING: Optimization can be EXTREMELY slow! Leidenalg does not properly implement multilayer optimization.
72-
7370
:param G_intralayer: intralayer graph of interest
7471
:type G_intralayer: igraph.Graph
7572
:param layer_vec: list of each vertex's layer membership
7673
:type layer_vec: list[int]
7774
:return: list of intralayer networks
7875
:rtype: list[igraph.Graph]
7976
"""
80-
warnings.warn("You are using Leiden multilayer modularity optimization. THIS CAN BE EXTREMELY SLOW! "
81-
"leidenalg's implementation is inefficient, especially when there are many layers.")
82-
8377
# internally use hashable objects for memoization
8478
return _split_leiden_graph_layers_cached(n=G_intralayer.vcount(), G_es=tuple(G_intralayer.es),
8579
is_directed=G_intralayer.is_directed(),
@@ -108,7 +102,8 @@ def _split_leiden_graph_layers_cached(n, G_es, is_directed, layer_membership):
108102
def multilayer_leiden(G_intralayer, G_interlayer, layer_vec, gamma, omega, optimiser=None, return_partition=False):
109103
r"""Run the Leiden modularity maximization algorithm at a single (:math:`\gamma, \omega`) value.
110104
111-
WARNING: Optimization can be EXTREMELY slow! Leidenalg does not properly implement multilayer optimization.
105+
WARNING: Optimization can be EXTREMELY slow for large numbers of layers! Leidenalg does not properly implement
106+
multilayer optimization.
112107
113108
:param G_intralayer: intralayer graph of interest
114109
:type G_intralayer: igraph.Graph
@@ -236,6 +231,9 @@ def repeated_parallel_leiden_from_gammas_omegas(G_intralayer, G_interlayer, laye
236231
"""
237232
Runs leidenalg at each gamma and omega in ``gammas`` and ``omegas``, using all CPU cores available.
238233
234+
WARNING: Optimization can be EXTREMELY slow for large numbers of layers! Leidenalg does not properly implement
235+
multilayer optimization.
236+
239237
:param G_intralayer: intralayer graph of interest
240238
:type G_intralayer: igraph.Graph
241239
:param G_interlayer: interlayer graph of interest

0 commit comments

Comments
 (0)