提问人:Patcharaporn Kladkham 提问时间:3/31/2023 最后编辑:Felix KlingPatcharaporn Kladkham 更新时间:11/16/2023 访问量:3145
AttributeError:模块“networkx”没有属性“info”
AttributeError: module 'networkx' has no attribute 'info'
问:
import networkx as nx
G = nx.read_edgelist('webpages.txt', create_using=nx.DiGraph())
print(nx.info(G))
AttributeError: module 'networkx' has no attribute 'info'
print(nx.info(G)) 没有错误
答:
0赞
tax evader
3/31/2023
#1
info
方法已从 NetworkX 3 中删除
应考虑直接访问 Graph 属性
print('Number of nodes', len(G.nodes))
print('Number of edges', len(G.edges))
print('Average degree', sum(dict(G.degree).values()) / len(G.nodes))
1赞
Tom G.
6/5/2023
#2
您也可以只获取图形属性print(G)
0赞
Mohammad Heydari
11/16/2023
#3
评论