diff --git a/cdlib/algorithms/bipartite_clustering.py b/cdlib/algorithms/bipartite_clustering.py index e43e803e..0370381f 100644 --- a/cdlib/algorithms/bipartite_clustering.py +++ b/cdlib/algorithms/bipartite_clustering.py @@ -231,7 +231,11 @@ def infomap_bipartite(g_original: object, flags: str = "") -> BiNodeClustering: im = imp.Infomap(flags) im.bipartite_start_id = min(Y.keys()) - im.add_nodes(g1.nodes) + if int(imp.__version__.replace(".", "")) >= 171: + n_dict = {i: str(n) for i, n in enumerate(g1.nodes)} + im.add_nodes(n_dict) + else: + im.add_nodes(g1.nodes) for source, target, data in g1.edges(data=True): if "weight" in data: diff --git a/cdlib/algorithms/crisp_partition.py b/cdlib/algorithms/crisp_partition.py index cdd7c661..e454cbe6 100644 --- a/cdlib/algorithms/crisp_partition.py +++ b/cdlib/algorithms/crisp_partition.py @@ -1071,7 +1071,11 @@ def infomap(g_original: object, flags: str = "") -> NodeClustering: with pipes(): im = imp.Infomap(flags) - im.add_nodes(g1.nodes) + if int(imp.__version__.replace(".", "")) >= 171: + n_dict = {i: str(n) for i, n in enumerate(g1.nodes)} + im.add_nodes(n_dict) + else: + im.add_nodes(g1.nodes) for source, target, data in g1.edges(data=True): if "weight" in data: