简体   繁体   中英

Pick data from NodeClustring object

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM