Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

edge labels and vertex size causes problems

Hi,

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

First, the vertex_size option does no 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.

click to hide/show revision 2
fixed spelling errors, push question

edge labels and vertex size causes problems

Hi,

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

First, the vertex_size option does no 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.