Ask Your Question
1

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

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

anonymous user

Anonymous

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

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

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) H.show()

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

edit flag offensive delete link more
0

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

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

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

Stats

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

Seen: 1,373 times

Last updated: Jan 20 '12