Storing and Accessing node attributes python networkx

前端 未结 4 1658
天命终不由人
天命终不由人 2020-12-07 13:41

I have a network of nodes created using python networkx. i want to store information in nodes such that i can access the information later based on the node lab

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 14:04

    Apparently now

    G.node[1]['name'] = 'alpha'
    

    do not work anymore.

    I used this : https://networkx.github.io/documentation/stable/reference/classes/generated/networkx.Graph.nodes.html

    adding an s at node :

    G.nodes[1]['name'] = 'alpha'
    

提交回复
热议问题