布局算法不设置节点属性(但应该设置)。这是设置属性的方法:
In [1]: import networkx as nxIn [2]: G=nx.path_graph(4)In [3]: pos=nx.spring_layout(G)In [4]: nx.set_node_attributes(G,'pos',pos)In [5]: G.nodeOut[5]: {0: {'pos': array([ 0., 0.])}, 1: {'pos': array([ 0.32267963, 0.03340727])}, 2: {'pos': array([ 0.67729057, 0.07011044])}, 3: {'pos': array([ 1. , 0.10350174])}}


