Ask Your Question

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

asked 2012-01-10 06:25:38 +0200

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 21:54:14 +0200

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 12:27:03 +0200

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-10 06:25:38 +0200

Seen: 2,383 times

Last updated: Jan 20 '12