diff options
author | Jim Kitchen <jim22k@gmail.com> | 2022-10-11 15:24:14 -0500 |
---|---|---|
committer | Mridul Seth <git@mriduls.com> | 2022-10-12 12:05:14 +0400 |
commit | c2111a36841d5e43b6beae1fd667996d35646e30 (patch) | |
tree | 38fa5e1316ca45a9906169ceb7ac21bfc52a612e /networkx/algorithms/reciprocity.py | |
parent | 71434d674cf8ec6c3007dd41b78ee6f407e9b4eb (diff) | |
download | networkx-nx-sparse.tar.gz |
Allow dispatcher decorator without a namenx-sparse
- Name is taken from the decorated function
- Raise error if backend doesn't implement a decorated function which is called
- Check for duplicate names for dispatching algorithms
Diffstat (limited to 'networkx/algorithms/reciprocity.py')
-rw-r--r-- | networkx/algorithms/reciprocity.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/networkx/algorithms/reciprocity.py b/networkx/algorithms/reciprocity.py index 9819de8b..660d922f 100644 --- a/networkx/algorithms/reciprocity.py +++ b/networkx/algorithms/reciprocity.py @@ -7,7 +7,7 @@ from ..utils import not_implemented_for __all__ = ["reciprocity", "overall_reciprocity"] -@nx.dispatch("reciprocity") +@nx.dispatch @not_implemented_for("undirected", "multigraph") def reciprocity(G, nodes=None): r"""Compute the reciprocity in a directed graph. @@ -75,7 +75,7 @@ def _reciprocity_iter(G, nodes): yield (node, reciprocity) -@nx.dispatch("overall_reciprocity") +@nx.dispatch @not_implemented_for("undirected", "multigraph") def overall_reciprocity(G): """Compute the reciprocity for the whole graph. |