From 5ae2b89358ed5a2bb9bf26c71cb3f51558abab82 Mon Sep 17 00:00:00 2001 From: GiulioRossetti Date: Mon, 13 May 2024 10:00:32 +0200 Subject: [PATCH] :arrow_down: markov_clustering moved to optional --- cdlib/test/test_community_discovery_models.py | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/cdlib/test/test_community_discovery_models.py b/cdlib/test/test_community_discovery_models.py index 82442705..956aaf71 100644 --- a/cdlib/test/test_community_discovery_models.py +++ b/cdlib/test/test_community_discovery_models.py @@ -54,6 +54,11 @@ except ModuleNotFoundError: by = None +try: + import markov_clustering as mc +except ModuleNotFoundError: + mc = None + try: from cdlib.algorithms.internal.LPAM import LPAM except ModuleNotFoundError: @@ -354,23 +359,25 @@ def test_osse(self): self.assertEqual(type(communities.communities[0][0]), str) def test_markov_clustering(self): - g = get_string_graph() - communities = algorithms.markov_clustering(g) - self.assertEqual(type(communities.communities), list) - if len(communities.communities) > 0: - self.assertEqual(type(communities.communities[0]), list) - if len(communities.communities[0]) > 0: - self.assertEqual(type(communities.communities[0][0]), str) + if mc is not None: + g = get_string_graph() - g = nx.karate_club_graph() + communities = algorithms.markov_clustering(g) + self.assertEqual(type(communities.communities), list) + if len(communities.communities) > 0: + self.assertEqual(type(communities.communities[0]), list) + if len(communities.communities[0]) > 0: + self.assertEqual(type(communities.communities[0][0]), str) - communities = algorithms.markov_clustering(g) - self.assertEqual(type(communities.communities), list) - if len(communities.communities) > 0: - self.assertEqual(type(communities.communities[0]), list) - if len(communities.communities[0]) > 0: - self.assertEqual(type(communities.communities[0][0]), int) + g = nx.karate_club_graph() + + communities = algorithms.markov_clustering(g) + self.assertEqual(type(communities.communities), list) + if len(communities.communities) > 0: + self.assertEqual(type(communities.communities[0]), list) + if len(communities.communities[0]) > 0: + self.assertEqual(type(communities.communities[0][0]), int) # def test_bigClam(self): # if karateclub is None: