@@ -1845,11 +1845,13 @@ def path_BFS(
18451845 :raises TypeError: ``S`` or ``G`` is neither a vertex nor a string
18461846 :raises KeyError: ``S`` or ``G`` is a name not in the graph
18471847 :raises ValueError: an edge on the path has no cost
1848- :return: list of vertices from S to G inclusive, path length
1849- :rtype: list of BaseVertex subclass, float
1848+ :return: list of vertices from S to G inclusive and path length, or
1849+ None if there is no path
1850+ :rtype: (list of BaseVertex subclass, float) or None
18501851
18511852 Returns a list of vertices that form a path from vertex ``S`` to
1852- vertex ``G`` if possible, otherwise return None.
1853+ vertex ``G`` if possible, otherwise returns None -- so check the
1854+ result before unpacking it.
18531855
18541856 .. runblock:: pycon
18551857
@@ -1947,11 +1949,13 @@ def path_UCS(
19471949 :raises TypeError: ``S`` or ``G`` is neither a vertex nor a string
19481950 :raises KeyError: ``S`` or ``G`` is a name not in the graph
19491951 :raises ValueError: an edge examined during the search has no cost
1950- :return: list of vertices from S to G inclusive, path length, tree
1951- :rtype: list of BaseVertex subclass, float, dict
1952+ :return: list of vertices from S to G inclusive, path length and
1953+ search tree, or None if there is no path
1954+ :rtype: (list of BaseVertex subclass, float, dict) or None
19521955
19531956 Returns a list of vertices that form a path from vertex ``S`` to
1954- vertex ``G`` if possible, otherwise return None.
1957+ vertex ``G`` if possible, otherwise returns None -- so check the
1958+ result before unpacking it.
19551959
19561960 The search tree is returned as dict that maps a vertex to its parent.
19571961
@@ -2067,11 +2071,13 @@ def path_Astar(
20672071 :raises TypeError: ``S`` or ``G`` is neither a vertex nor a string
20682072 :raises KeyError: ``S`` or ``G`` is a name not in the graph
20692073 :raises ValueError: an edge examined during the search has no cost
2070- :return: list of vertices from S to G inclusive, path length, tree
2071- :rtype: list of BaseVertex subclass, float, dict
2074+ :return: list of vertices from S to G inclusive, path length and
2075+ search tree, or None if there is no path
2076+ :rtype: (list of BaseVertex subclass, float, dict) or None
20722077
20732078 Returns a list of vertices that form a path from vertex ``S`` to
2074- vertex ``G`` if possible, otherwise return None.
2079+ vertex ``G`` if possible, otherwise returns None -- so check the
2080+ result before unpacking it.
20752081
20762082 The search tree is returned as dict that maps a vertex to its parent.
20772083
0 commit comments