# Revision history [back]

### 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 []

 2 retagged tmonteil 20663 ●25 ●146 ●382 http://wiki.sagemath.o...

### 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 []