ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 20 Jan 2012 05:27:03 -0600Can I show the edge weights on a graph in a drawing?https://ask.sagemath.org/question/8572/can-i-show-the-edge-weights-on-a-graph-in-a-drawing/I'm trying to draw and animate a bipartite graph with weights, and I was wondering if I could display the weights in the drawing when I do Graph.show().Mon, 09 Jan 2012 23:25:38 -0600https://ask.sagemath.org/question/8572/can-i-show-the-edge-weights-on-a-graph-in-a-drawing/Answer by Sara Billey for <p>I'm trying to draw and animate a bipartite graph with weights, and I was wondering if I could display the weights in the drawing when I do Graph.show().</p>
https://ask.sagemath.org/question/8572/can-i-show-the-edge-weights-on-a-graph-in-a-drawing/?answer=13155#post-id-13155Two more points: First, I found the following site helpful for displaying graphs
http://www.sagenb.org/home/pub/2351/
Second, graphviz is really great at displaying graphs with edge labels and many other decorations. Its a whole graph layout programming language, but it can't be included in sage because of a licensing issue apparently. The link above shows how to output a graph from sage to a dot file suitable for graphviz. For example, after downloading graphviz on your computer, you can run "dotty file.dot". Fri, 20 Jan 2012 05:27:03 -0600https://ask.sagemath.org/question/8572/can-i-show-the-edge-weights-on-a-graph-in-a-drawing/?answer=13155#post-id-13155Answer by kartikv for <p>I'm trying to draw and animate a bipartite graph with weights, and I was wondering if I could display the weights in the drawing when I do Graph.show().</p>
https://ask.sagemath.org/question/8572/can-i-show-the-edge-weights-on-a-graph-in-a-drawing/?answer=13110#post-id-13110Don't know how to animate a graph, but
G = DiGraph(A, format='weighted_adjacency_matrix')
H = G.plot(edge_labels=True, graph_border=True)
H.show()
will display the weights in a graph with adj matrix A.Tue, 10 Jan 2012 14:54:14 -0600https://ask.sagemath.org/question/8572/can-i-show-the-edge-weights-on-a-graph-in-a-drawing/?answer=13110#post-id-13110