summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavya Agarwal <82928853+navyagarwal@users.noreply.github.com>2023-03-29 06:34:50 +0530
committerGitHub <noreply@github.com>2023-03-28 21:04:50 -0400
commitfded1b53623e6f2d889c2cb865bb8ecca844fac0 (patch)
tree1315309e79ade09e6f2331421edede8dfc78f0c5
parentabd0a82d06c0ae8ecc1c60e5a9bde4c0dee08d48 (diff)
downloadnetworkx-fded1b53623e6f2d889c2cb865bb8ecca844fac0.tar.gz
Fixed return type inconsistencies in weighted.py (#6568)
Fixed return type inconsistencies
-rw-r--r--networkx/algorithms/shortest_paths/weighted.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/networkx/algorithms/shortest_paths/weighted.py b/networkx/algorithms/shortest_paths/weighted.py
index a717b671..9d87f8e5 100644
--- a/networkx/algorithms/shortest_paths/weighted.py
+++ b/networkx/algorithms/shortest_paths/weighted.py
@@ -1097,8 +1097,9 @@ def all_pairs_dijkstra_path(G, cutoff=None, weight="weight"):
Returns
-------
- distance : dictionary
- Dictionary, keyed by source and target, of shortest paths.
+ paths : iterator
+ (source, dictionary) iterator with dictionary keyed by target and
+ shortest path as the key value.
Examples
--------
@@ -1677,8 +1678,8 @@ def single_source_bellman_ford_path_length(G, source, weight="weight"):
Returns
-------
- length : iterator
- (target, shortest path length) iterator
+ length : dictionary
+ Dictionary of shortest path length keyed by target
Raises
------
@@ -1688,7 +1689,7 @@ def single_source_bellman_ford_path_length(G, source, weight="weight"):
Examples
--------
>>> G = nx.path_graph(5)
- >>> length = dict(nx.single_source_bellman_ford_path_length(G, 0))
+ >>> length = nx.single_source_bellman_ford_path_length(G, 0)
>>> length[4]
4
>>> for node in [0, 1, 2, 3, 4]:
@@ -1885,8 +1886,9 @@ def all_pairs_bellman_ford_path(G, weight="weight"):
Returns
-------
- distance : dictionary
- Dictionary, keyed by source and target, of shortest paths.
+ paths : iterator
+ (source, dictionary) iterator with dictionary keyed by target and
+ shortest path as the key value.
Examples
--------