Pick data from NodeClustring object

Viewed 133

I was working with cdlib and detecting my data communities. but I need clusters of communities. how can I pick data from this object?

from cdlib import algorithms
import networkx as nx

coms = algorithms.louvain( G )
print(coms.data)

this is result of print(coms)

<cdlib.classes.node_clustering.NodeClustering object at 0x7fe46ec70ac0>

1 Answers

I found it. but not sure it's good to do. but worked.

We can save it using

from cdlib import readwrite

readwrite.write_community_csv(coms, "communities.csv", ",")

then read again communities.csv dataset and use clusters data

Related