First time here? Check out the FAQ!

Ask Your Question
1

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

asked 13 years ago

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 13 years ago

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.

Preview: (hide)
link
0

answered 13 years ago

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

Preview: (hide)
link

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: 13 years ago

Seen: 2,497 times

Last updated: Jan 20 '12