Ask Your Question
1

edge labels and vertex size causes problems

asked 11 years ago

god.one gravatar image

updated 10 years ago

Hi,

I have several problems creating a graph. I want to misuse the graph tools in sagemath to create a flow diagram, but I encountered two problems:

First, the vertex_size option does not work at all in my code and

second, relating to the question here, is there now a possibility to shift the edge labels? I work with sage 5.9 in a virtual box environment

from sage.graphs.graph_plot import GraphPlot
h = DiGraph({0:[1,2], 1:[3], 2:[4]})
for u,v,l in h.edges():
    h.set_edge_label(u,v,'(' + str(u) + ',' + str(v) + ')')
h1=h.graphplot(save_pos=True, edge_labels=True, talk=True)
h1.show()
print h.get_pos()
h.set_pos({0:[0,0],1:[1,1],2:[1,-1],3:[2,1],4:[3,-1]})
h1=h.graphplot(save_pos=True, edge_labels=True, talk=True, vertex_size=0)
h1.set_vertices(vertex_shape='s')
h1.show()

Thanks in advance.

Preview: (hide)

Comments

Anybody any ideas?

god.one gravatar imagegod.one ( 11 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 10 years ago

kcrisman gravatar image

First answer: the vertex_size option does work, but the talk option has obscured this. Essentially, the labels are now taking up the place where the vertex would have been.

Secondly, I have (finally) opened Trac 16450 for something related to the edge labeling problem. But the hack here should work.

Preview: (hide)
link

Comments

Up to now I did not test it with my example but I like to thank you in advance.

god.one gravatar imagegod.one ( 10 years ago )

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

Seen: 614 times

Last updated: Jun 05 '14