cdlib.readwrite.read_community_json

cdlib.readwrite.read_community_json(path: str, compress: bool = False) object

Read community list from JSON file.

Parameters:
  • path – input filename

  • compress – wheter the file is in a copress format, default False

Returns:

a Clustering object

Example:

>>> import networkx as nx
>>> from cdlib import algorithms, readwrite
>>> g = nx.karate_club_graph()
>>> coms = algorithms.louvain(g)
>>> readwrite.write_community_json(coms, "communities.json")
>>> readwrite.read_community_json(coms, "communities.json")