cdlib.readwrite.write_community_csv

write_community_csv(communities: object, path: str, delimiter: str = ', ', compress: bool = False)

Save community structure to comma separated value (csv) file.

Parameters:
  • communities – a NodeClustering object
  • path – output filename
  • delimiter – column delimiter
  • compress – wheter to copress the csv, default False
Example:
>>> import networkx as nx
>>> from cdlib import algorithms, readwrite
>>> g = nx.karate_club_graph()
>>> coms = algorithms.louvain(g)
>>> readwrite.write_community_csv(coms, "communities.csv", ",")