比较networkx中的2个节点属性
我有两个图G和K。我想对图G的节点和图K的节点号2进行比较测试。如果G节点等于第二个节点的值,则结果为真,否则结果为假。我编写了下面的代码,其中肯定包含了一个错误,即G的节点数的泛化。比较networkx中的2个节点属性,networkx,Networkx,我有两个图G和K。我想对图G的节点和图K的节点号2进行比较测试。如果G节点等于第二个节点的值,则结果为真,否则结果为假。我编写了下面的代码,其中肯定包含了一个错误,即G的节点数的泛化。 m=nx. number_of_nodes(G) def comparaison (G,K): for i in range(m): if (G.nodes['ni']== G3.nodes['n2']): print True else: print False c
m=nx. number_of_nodes(G)
def comparaison (G,K):
for i in range(m):
if (G.nodes['ni']== G3.nodes['n2']):
print True
else:
print False
comparaison(G,K)
m=nx. number_of_nodes(G)
def comparaison (G,K):
for i in range(m):
if (G.nodes['ni']== G3.nodes['n2']):
print True
else:
print False
comparaison(G,K)
为此,我需要您的帮助对什么进行比较测试?在节点的id上?关于节点的属性?