环境:ubuntu16.04,python2.7.12
版本:networkx==2.2, matplotlib==1.5.1, numpy==1.11.0
官方文档:https://networkx.github.io/documentation/networkx-2.2/
参考:https://www.cnblogs.com/minglex/p/9205160.html
创建图
import networkx as nx
graph = nx.DiGraph()
节点
添加节点:
graph.add_node(1)
graph.add_node(2, value=float('inf'
1