Functions to save/load cdlib communities to/from file.

CSV format

The easiest way to save the result of a community discovery algorithm is to organize it in a .csv file. The following methods allows to read/write communities to/from csv.

read_community_csv(path, delimiter, …) Read community list from comma separated value (csv) file.
write_community_csv(communities, path, …) Save community structure to comma separated value (csv) file.


CSV formatting allows only to save/retrieve NodeClustering object loosing most of the metadata present in the CD computation result - e.g., algorithm name, parameters, coverage…

JSON format

JSON format allows to store/load community discovery algorithm results in a more comprehensive way.

read_community_json(path, compress) Read community list from JSON file.
write_community_json(communities, path, compress) Generate a JSON representation of the clustering object


JSON formatting allows only to save/retrieve all kind of Clustering object maintaining all their metadata - except for the graph object instance.