networkx 书中代码实现 书中p165,networkx和matplotlib结合使用可视化wordnet的网络结构(语义网络) import networkx as nx import matplotlib from nltk.corpus import wordnet as wn def traverse(graph, start, node): graph.depth[node.name] = node.shortest_path_distance(start) for child in node.hyponyms(): graph.add_edge