Skip to content

Commit

Permalink
🐛 community I/O
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRossetti committed Mar 12, 2019
1 parent b6181b5 commit 8f13283
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cdlib/algorithms/crisp_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def frc_fgsn(graph, theta, eps, r):
nx.relabel_nodes(g, maps, False)
fuzz_assoc = {maps[nid]: v for nid, v in fuzz_assoc.items()}
else:
coms = [tuple(c) for c in communities]
coms = [list(c) for c in communities]

return FuzzyNodeClustering(coms, fuzz_assoc, graph, "FuzzyComm", method_parameters={"theta": theta,
"eps": eps, "r": r})
2 changes: 1 addition & 1 deletion cdlib/classes/node_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def fraction_over_median_degree(self, **kwargs):
"""
if self.__check_graph():
return evaluation.fraction_over_median_degree(self.graph, self,**kwargs)
return evaluation.fraction_over_median_degree(self.graph, self, **kwargs)
else:
raise ValueError("Graph instance not specified")

Expand Down
8 changes: 4 additions & 4 deletions cdlib/readwrite/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def read_community_csv(path, delimiter=",", nodetype=str):
with open(path) as f:
for row in f:
community = list(map(nodetype, row.rstrip().split(delimiter)))
communities.append(tuple(community))
communities.append(list(community))

return NodeClustering(communities, None, "")

Expand Down Expand Up @@ -106,7 +106,7 @@ def read_community_json(path):
with open(path, "r") as f:
coms = json.load(f)

nc = NodeClustering([tuple(c) for c in coms['communities']], None, coms['algorithm'],
nc = NodeClustering([list(c) for c in coms['communities']], None, coms['algorithm'],
coms['params'], coms['overlap'])
nc.node_coverage = coms['coverage']

Expand All @@ -120,7 +120,7 @@ def read_community_json(path):
cm = []
for e in c:
cm.append(tuple(e))
cms.append(tuple(cm))
cms.append(list(cm))
nc.communities = cms
nc.__class__ = EdgeClustering

Expand Down Expand Up @@ -148,7 +148,7 @@ def read_community_from_json_string(json_repr):

coms = json.loads(json_repr)

nc = NodeClustering([tuple(c) for c in coms['communities']], None, coms['algorithm'],
nc = NodeClustering([list(c) for c in coms['communities']], None, coms['algorithm'],
coms['params'], coms['overlap'])
nc.node_coverage = coms['coverage']

Expand Down

0 comments on commit 8f13283

Please sign in to comment.