ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 07 Mar 2018 13:21:06 +0100Flow gives error for disconnected verticeshttps://ask.sagemath.org/question/41419/flow-gives-error-for-disconnected-vertices/ When calculating the flow between to vertices which are not connected in a graph, the method returns a ValueError. I would have assumed that it would just return 0. Here's a minimal example:
G=Graph({0:[],1:[]})
G.flow(0,1) # raises the error ValueError: vertex '0' is not in the (di)graph
If on the other hand one tries the shortest_path method it just returns a empty list, since there is not path between 0 and 1.
G.shortest_path(0,1) #returns []AckslWed, 07 Mar 2018 13:21:06 +0100https://ask.sagemath.org/question/41419/edge labels and vertex size causes problemshttps://ask.sagemath.org/question/10776/edge-labels-and-vertex-size-causes-problems/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](http://ask.sagemath.org/question/1700/getting-edge-labels-in-a-digraph-to-display), 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.god.oneTue, 26 Nov 2013 04:33:26 +0100https://ask.sagemath.org/question/10776/