Ask Your Question
1

edge labels and vertex size causes problems

asked 2013-11-25 21:33:26 -0500

god.one gravatar image

updated 2014-05-21 20:07:30 -0500

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.

edit retag flag offensive close merge delete

Comments

Anybody any ideas?

god.one gravatar imagegod.one ( 2013-12-10 20:23:29 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-06-05 16:37:34 -0500

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.

edit flag offensive delete link more

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 ( 2014-06-05 19:05:03 -0500 )edit

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: 2013-11-25 21:33:26 -0500

Seen: 185 times

Last updated: Jun 05 '14