使用 NetworkX 将 .net 或 .bz2 文件作为网络导入 Python 中



我已经下载了一个文件名为.net(或.bz2)的数据集,我想将其导入iPython Notebook以使用NetworkX创建具有数据集的网络,但是我无法找到如何导入该文件。

任何帮助非常感谢!

假设您已经下载并解压缩了 ZIP 文件:

import networkx as nx
fyle = 'eatRS.net'
G = nx.read_pajek(fyle)
# G now contains the network
print(len((G.nodes())))

最新更新