|
10 | 10 |
|
11 | 11 | from .. import _utils |
12 | 12 | from .. import logging as logg |
13 | | -from .._compat import deprecated, pkg_version, warn |
14 | | -from .._utils import _choose_graph, _doc_params, dematrix |
| 13 | +from .._compat import deprecated, pkg_version |
| 14 | +from .._utils import _choose_graph, _doc_params |
15 | 15 | from ._docs import ( |
16 | 16 | doc_adata, |
17 | 17 | doc_adjacency, |
@@ -54,7 +54,7 @@ def louvain( # noqa: PLR0912, PLR0913, PLR0915 |
54 | 54 | restrict_to: tuple[str, Sequence[str]] | None = None, |
55 | 55 | key_added: str = "louvain", |
56 | 56 | adjacency: CSBase | None = None, |
57 | | - flavor: Literal["vtraag", "igraph", "rapids"] = "vtraag", |
| 57 | + flavor: Literal["vtraag", "igraph"] = "vtraag", |
58 | 58 | directed: bool = True, |
59 | 59 | use_weights: bool = False, |
60 | 60 | partition_type: type[MutableVertexPartition] | None = None, |
@@ -99,11 +99,6 @@ def louvain( # noqa: PLR0912, PLR0913, PLR0915 |
99 | 99 | Much more powerful than ``'igraph'``, and the default. |
100 | 100 | ``'igraph'`` |
101 | 101 | Built in ``igraph`` method. |
102 | | - ``'rapids'`` |
103 | | - GPU accelerated implementation. |
104 | | -
|
105 | | - .. deprecated:: 1.10.0 |
106 | | - Use :func:`rapids_singlecell.tl.louvain` instead. |
107 | 102 | directed |
108 | 103 | Interpret the ``adjacency`` matrix as directed graph? |
109 | 104 | use_weights |
@@ -180,44 +175,6 @@ def louvain( # noqa: PLR0912, PLR0913, PLR0915 |
180 | 175 | else: |
181 | 176 | part = g.community_multilevel(weights=weights) |
182 | 177 | groups = np.array(part.membership) |
183 | | - elif flavor == "rapids": |
184 | | - msg = ( |
185 | | - "`flavor='rapids'` is deprecated. " |
186 | | - "Use `rapids_singlecell.tl.louvain` instead." |
187 | | - ) |
188 | | - warn(msg, FutureWarning) |
189 | | - # nvLouvain only works with undirected graphs, |
190 | | - # and `adjacency` must have a directed edge in both directions |
191 | | - import cudf |
192 | | - import cugraph |
193 | | - |
194 | | - offsets = cudf.Series(adjacency.indptr) |
195 | | - indices = cudf.Series(adjacency.indices) |
196 | | - if use_weights: |
197 | | - sources, targets = adjacency.nonzero() |
198 | | - weights = dematrix(adjacency[sources, targets]).ravel() |
199 | | - weights = cudf.Series(weights) |
200 | | - else: |
201 | | - weights = None |
202 | | - g = cugraph.Graph() |
203 | | - |
204 | | - if hasattr(g, "add_adj_list"): |
205 | | - g.add_adj_list(offsets, indices, weights) |
206 | | - else: |
207 | | - g.from_cudf_adjlist(offsets, indices, weights) |
208 | | - |
209 | | - logg.info(' using the "louvain" package of rapids') |
210 | | - if resolution is not None: |
211 | | - louvain_parts, _ = cugraph.louvain(g, resolution=resolution) |
212 | | - else: |
213 | | - louvain_parts, _ = cugraph.louvain(g) |
214 | | - groups = ( |
215 | | - louvain_parts |
216 | | - .to_pandas() |
217 | | - .sort_values("vertex")[["partition"]] |
218 | | - .to_numpy() |
219 | | - .ravel() |
220 | | - ) |
221 | 178 | elif flavor == "taynaud": |
222 | 179 | # this is deprecated |
223 | 180 | import community |
|
0 commit comments