官方教程 博客:NetworkX NetworkX 使用(二) Introduction to Graph Analysis with NetworkX %pylab inline import networkx as nx Populating the interactive namespace from numpy and matplotlib G = nx.Graph() G.add_node(1) G.add_nodes_from([2,3]) G.add_edge(1,2) e = (