#NEWLINE# def shortest_augmenting_path( G , s , t , capacity = 'capacity' , residual = None , value_only = False , two_phase = False , cutoff = None ) : #NEWLINE# #INDENT# "Find a maximum single-commodity flow using the shortest augmenting path\n    algorithm.\n\n    This function returns the residual network resulting after computing\n    the maximum flow. See below for details about the conventions\n    NetworkX uses for defining residual networks.\n\n    This algorithm has a running time of `O(n^2 m)` for `n` nodes and `m`\n    edges.\n\n\n    Parameters\n    ----------\n    G : NetworkX graph\n        Edges of the graph are expected to have an attribute called\n        'capacity'. If this attribute is not present, the edge is\n        considered to have infinite capacity.\n\n    s : node\n        Source node for the flow.\n\n    t : node\n        Sink node for the flow.\n\n    capacity : string\n        Edges of the graph G are expected to have an attribute capacity\n        that indicates how much flow the edge can support. If this\n        attribute is not present, the edge is considered to have\n        infinite capacity. Default value: 'capacity'.\n\n    residual : NetworkX graph\n        Residual network on which the algorithm is to be executed. If None, a\n        new residual network is created. Default value: None.\n\n    value_only : bool\n        If True compute only the value of the maximum flow. This parameter\n        will be ignored by this algorithm because it is not applicable.\n\n    two_phase : bool\n        If True, a two-phase variant is used. The two-phase variant improves\n        the running time on unit-capacity networks from `O(nm)` to\n        `O(\\min(n^{2/3}, m^{1/2}) m)`. Default value: False.\n\n    cutoff : integer, float\n        If specified, the algorithm will terminate when the flow value reaches\n        or exceeds the cutoff. In this case, it may be unable to immediately\n        determine a minimum cut. Default value: None.\n\n    Returns\n    -------\n    R : NetworkX DiGraph\n        Residual network after computing the maximum flow.\n\n    Raises\n    ------\n    NetworkXError\n        The algorithm does not support MultiGraph and MultiDiGraph. If\n        the input graph is an instance of one of these two classes, a\n        NetworkXError is raised.\n\n    NetworkXUnbounded\n        If the graph has a path of infinite capacity, the value of a\n        feasible flow on the graph is unbounded above and the function\n        raises a NetworkXUnbounded.\n\n    See also\n    --------\n    :meth:`maximum_flow`\n    :meth:`minimum_cut`\n    :meth:`edmonds_karp`\n    :meth:`preflow_push`\n\n    Notes\n    -----\n    The residual network :samp:`R` from an input graph :samp:`G` has the\n    same nodes as :samp:`G`. :samp:`R` is a DiGraph that contains a pair\n    of edges :samp:`(u, v)` and :samp:`(v, u)` iff :samp:`(u, v)` is not a\n    self-loop, and at least one of :samp:`(u, v)` and :samp:`(v, u)` exists\n    in :samp:`G`.\n\n    For each edge :samp:`(u, v)` in :samp:`R`, :samp:`R[u][v]['capacity']`\n    is equal to the capacity of :samp:`(u, v)` in :samp:`G` if it exists\n    in :samp:`G` or zero otherwise. If the capacity is infinite,\n    :samp:`R[u][v]['capacity']` will have a high arbitrary finite value\n    that does not affect the solution of the problem. This value is stored in\n    :samp:`R.graph['inf']`. For each edge :samp:`(u, v)` in :samp:`R`,\n    :samp:`R[u][v]['flow']` represents the flow function of :samp:`(u, v)` and\n    satisfies :samp:`R[u][v]['flow'] == -R[v][u]['flow']`.\n\n    The flow value, defined as the total flow into :samp:`t`, the sink, is\n    stored in :samp:`R.graph['flow_value']`. If :samp:`cutoff` is not\n    specified, reachability to :samp:`t` using only edges :samp:`(u, v)` such\n    that :samp:`R[u][v]['flow'] < R[u][v]['capacity']` induces a minimum\n    :samp:`s`-:samp:`t` cut.\n\n    Examples\n    --------\n    >>> import networkx as nx\n    >>> from networkx.algorithms.flow import shortest_augmenting_path\n\n    The functions that implement flow algorithms and output a residual\n    network, such as this one, are not imported to the base NetworkX\n    namespace, so you have to explicitly import them from the flow package.\n\n    >>> G = nx.DiGraph()\n    >>> G.add_edge('x','a', capacity=3.0)\n    >>> G.add_edge('x','b', capacity=1.0)\n    >>> G.add_edge('a','c', capacity=3.0)\n    >>> G.add_edge('b','c', capacity=5.0)\n    >>> G.add_edge('b','d', capacity=4.0)\n    >>> G.add_edge('d','e', capacity=2.0)\n    >>> G.add_edge('c','y', capacity=2.0)\n    >>> G.add_edge('e','y', capacity=3.0)\n    >>> R = shortest_augmenting_path(G, 'x', 'y')\n    >>> flow_value = nx.maximum_flow_value(G, 'x', 'y')\n    >>> flow_value\n    3.0\n    >>> flow_value == R.graph['flow_value']\n    True\n\n    " #NEWLINE# R = shortest_augmenting_path_impl ( G , s , t , capacity , two_phase , two_phase , cutoff ) #NEWLINE# R . graph [ 'algorithm' ] = 'shortest_augmenting_path' #NEWLINE# return R