cdlib.readwrite.read_community_csv

cdlib.readwrite.read_community_csv(path: str, delimiter: str = ', ', nodetype: type = <class 'str'>, compress: bool = False) object

Read community list from comma separated value (csv) file.

Parameters:
  • path – input filename

  • delimiter – column delimiter

  • nodetype – specify the type of node labels, default str

  • compress – wheter the file is compressed or not, default False

Returns:

NodeClustering object

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", ",")
>>> coms = readwrite.read_community_csv(coms, "communities.csv", ",", str)