使用 Sage 绘制图表

Graph using Sage

 G = DiGraph(A, format='weighted_adjacency_matrix')
 G.relabel([1..10],inplace=True)

 H = G.plot(edge_labels=False, graph_border=True)
 H.show()

是否可以通过这张图突出显示某条路线?即让一些线条具有不同的颜色,比如红色?

这是您要找的吗?

sage: g = graphs.PetersenGraph()
sage: g.show(edge_colors={'red':[(0,1),(1,6),(6,9),(9,4)] })

可以在此页面上找到所有可用的图表选项的文档:

http://www.sagemath.org/doc/reference/plotting/sage/graphs/graph_plot.html

内森