From 05aa74c9036151c7002c4b18ad682c70ab080345 Mon Sep 17 00:00:00 2001 From: Md Naim Date: Wed, 27 Sep 2023 09:18:40 -0700 Subject: [PATCH] As networkx is not a dependency of cuGrap, need to check degree array in a loop --- python/cugraph/cugraph/community/louvain.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/cugraph/cugraph/community/louvain.py b/python/cugraph/cugraph/community/louvain.py index a37fe8d638f..44f66e67422 100644 --- a/python/cugraph/cugraph/community/louvain.py +++ b/python/cugraph/cugraph/community/louvain.py @@ -11,7 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import networkx as nx from cugraph.utilities import ( is_nx_graph_type, ensure_cugraph_obj_for_nx, @@ -100,7 +99,7 @@ def louvain(G, max_level=None, max_iter=None, resolution=1.0, threshold=1e-7): isolated_vertices = list() if is_nx_graph_type(type(G)): - isolated_vertices = list(nx.isolates(G)) + isolated_vertices = [v for v in range(G.number_of_nodes()) if G.degree[v] == 0] else: # FIXME: Gather isolated vertices of G pass