Skip to content

Commit

Permalink
⬇️ markov_clustering moved to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRossetti committed May 13, 2024
1 parent b6c837a commit 5ae2b89
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions cdlib/test/test_community_discovery_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5ae2b89

Please sign in to comment.