nxpd 一个 Python 包,用来绘制可视化的 NetworkX 图形,使用 pydot 和 graphviz 包。
nxpd
示例代码:
import networkx as nx from nxpd import draw G = nx.cycle_graph(4, create_using=nx.DiGraph()) draw(G) draw(G, show='ipynb') G = nx.DiGraph() G.graph['rankdir'] = 'LR' G.graph['dpi'] = 120 G.add_cycle(range(4)) G.add_node(0, color='red', style='filled', fillcolor='pink') G.add_node(1, shape='square') G.add_node(3, style='filled', fillcolor='#00ffff') G.add_edge(0, 1, color='red', style='dashed') G.add_edge(3, 3, label='a') draw(G)