Is there any example in python, how to convert file from *.gml to *.edgelist? Thank you
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
In [1]: import networkx as nx
In [2]: g = nx.read_gml('gmlFile.gml')
In [3]: nx.write_edgelist(g, 'edgelistFile.csv', delimiter=',')
Documentation
read_gml(path, encoding='UTF-8', relabel=False)
write_edgelist(G, path, comments='#', delimiter=' ', data=True, encoding='utf-8')[source]