diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2021-10-18 09:14:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 12:14:06 -0400 |
commit | d2ba0ef672eb53e362e65195715d3bcba9a6077f (patch) | |
tree | 953a372728ce33f1da6288c1ed110a7fb8c07d61 | |
parent | 9ae1ac441cc34c2950389ca5e97f9000d308fbe5 (diff) | |
download | networkx-d2ba0ef672eb53e362e65195715d3bcba9a6077f.tar.gz |
Add note about checking for path existence to all_simple_paths. (#5059)
-rw-r--r-- | networkx/algorithms/simple_paths.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/networkx/algorithms/simple_paths.py b/networkx/algorithms/simple_paths.py index b99272e7..34a260ba 100644 --- a/networkx/algorithms/simple_paths.py +++ b/networkx/algorithms/simple_paths.py @@ -207,6 +207,11 @@ def all_simple_paths(G, source, target, cutoff=None): number of simple paths in a graph can be very large, e.g. $O(n!)$ in the complete graph of order $n$. + This function does not check that a path exists between `source` and + `target`. For large graphs, this may result in very long runtimes. + Consider using `has_path` to check that a path exists between `source` and + `target` before calling this function on large graphs. + References ---------- .. [1] R. Sedgewick, "Algorithms in C, Part 5: Graph Algorithms", @@ -214,7 +219,7 @@ def all_simple_paths(G, source, target, cutoff=None): See Also -------- - all_shortest_paths, shortest_path + all_shortest_paths, shortest_path, has_path """ if source not in G: |