Why do I get AttributeError: module 'networkx' has no attribute 'average_neighbor_in_degree'?
Why do I get AttributeError: module 'networkx' has no attribute 'average_neighbor_in_degree'?
我有 networkx v.2.3,我需要计算有向图节点的平均邻居度。为什么该方法未被识别?
import networkx as nx
G = nx.DiGraph()
G.add_path([0,1,2,3])
nx.average_neighbor_in_degree(G)
average_neighbor_in_degree
方法在 networkx 1.6 中被替换 - 请参阅 release notes(感谢 @Delena Malan)。
此功能在 networkx 2.3 中可用 average_neighbor_degree
方法使用 target
& source
关键字参数:
代码:
import networkx as nx
G = nx.DiGraph()
G.add_path([0,1,2,3])
print(nx.average_neighbor_degree(G, source='in', target='in'))
输出:
{0: 1.0, 1: 1.0, 2: 1.0, 3: 0.0}
我有 networkx v.2.3,我需要计算有向图节点的平均邻居度。为什么该方法未被识别?
import networkx as nx
G = nx.DiGraph()
G.add_path([0,1,2,3])
nx.average_neighbor_in_degree(G)
average_neighbor_in_degree
方法在 networkx 1.6 中被替换 - 请参阅 release notes(感谢 @Delena Malan)。
此功能在 networkx 2.3 中可用 average_neighbor_degree
方法使用 target
& source
关键字参数:
代码:
import networkx as nx
G = nx.DiGraph()
G.add_path([0,1,2,3])
print(nx.average_neighbor_degree(G, source='in', target='in'))
输出:
{0: 1.0, 1: 1.0, 2: 1.0, 3: 0.0}