summaryrefslogtreecommitdiff
path: root/networkx/algorithms/dag.py
diff options
context:
space:
mode:
authorJim Kitchen <jim22k@gmail.com>2022-10-06 15:12:37 -0500
committerMridul Seth <git@mriduls.com>2022-10-12 12:05:14 +0400
commit71434d674cf8ec6c3007dd41b78ee6f407e9b4eb (patch)
tree2a21038cf9ada28a92ae3dfab4b0aab5a06140cd /networkx/algorithms/dag.py
parentdb7fea7fcbb2470e80e785454e7e71f1a3f80200 (diff)
downloadnetworkx-71434d674cf8ec6c3007dd41b78ee6f407e9b4eb.tar.gz
Dispatch more algorithms and improve auto-test capabilities
Diffstat (limited to 'networkx/algorithms/dag.py')
-rw-r--r--networkx/algorithms/dag.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/networkx/algorithms/dag.py b/networkx/algorithms/dag.py
index 826b87ff..f7692d1f 100644
--- a/networkx/algorithms/dag.py
+++ b/networkx/algorithms/dag.py
@@ -36,6 +36,7 @@ __all__ = [
chaini = chain.from_iterable
+@nx.dispatch("descendants")
def descendants(G, source):
"""Returns all nodes reachable from `source` in `G`.
@@ -72,6 +73,7 @@ def descendants(G, source):
return {child for parent, child in nx.bfs_edges(G, source)}
+@nx.dispatch("ancestors")
def ancestors(G, source):
"""Returns all nodes having a path to `source` in `G`.