Search code examples
dotsageedgesarrows

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()

Would it be possible to highlight a certain route through this graph? i.e make some lines a different colour, say, red?


Solution

  • Is this what you are looking for ?

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

    The documentation of all available options for graph plots can be found on this page:

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

    Nathann