id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
26194,Graph.flow() raises a ValueError if the source or sink is isolated,pbanks,,"When computing the maximal flow of a graph using the Ford-Fulkerson algorithm, Sage throws an exception if the requested source or sink vertices have no edges incident to them with positive capacity:
{{{
G = Graph([range(4), [(1, 2)]], format='vertices_and_edges')
G.flow(0, 1, algorithm='FF') # raises ValueError: vertex '0' is not in the (di)graph
G.flow(1, 3, algorithm='FF') # raises ValueError: vertex '3' is not in the (di)graph
G.flow(0, 1, algorithm='LP') # returns 0 as expected
G.flow(0, 1, algorithm='igraph') # returns 0 as expected
}}}
The expected value of all of these calls should be 0.
This occurs running SageMath version 8.1 on Ubuntu 18.04.1.
The cause of this error is the assumption that the residual graph constructed in _ford_fulkerson contains both the source and the sink. Simply checking that this assumption is true (and returning 0 if it is not) should fix the issue.",defect,new,minor,sage-duplicate/invalid/wontfix,graph theory,,"graph, network, flow",,,,,N/A,,,,,