Ask Your Question
1

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

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

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

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

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

Seen: 2,439 times

Last updated: Jan 20 '12