Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
比较networkx中的2个节点属性_Networkx - Fatal编程技术网

比较networkx中的2个节点属性

比较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

我有两个图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
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上?关于节点的属性?