Ask Your Question

Can I show the edge weights on a graph in a drawing?

asked 2012-01-09 23:25:38 -0500

anonymous user


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

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-01-10 14:54:14 -0500

kartikv gravatar image

Don't know how to animate a graph, but

G = DiGraph(A, format='weighted_adjacency_matrix') H = G.plot(edge_labels=True, graph_border=True)

will display the weights in a graph with adj matrix A.

edit flag offensive delete link more

answered 2012-01-20 05:27:03 -0500

Two more points: First, I found the following site helpful for displaying graphs

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".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-01-09 23:25:38 -0500

Seen: 1,280 times

Last updated: Jan 20 '12