cdlib.readwrite.read_community_csv

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

从逗号分隔值(csv)文件中读取社区列表。

Parameters:
  • path – 输入文件名

  • delimiter – 列分隔符

  • nodetype – 指定节点标签的类型,默认为 str

  • compress – 文件是否压缩,默认为 False

Returns:

节点聚类对象

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)